diff --git a/CMakeLists.txt b/CMakeLists.txt index e80cd52f..a079f966 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,8 @@ target_include_directories(doctest INTERFACE thirdparty/doctest/doctest) # Add simdutf for UTF conversion operations set (SIMDUTF_TESTS OFF) +set (SIMDUTF_TOOLS OFF) +set (SIMDUTF_ICONV OFF) add_subdirectory (thirdparty/simdutf) # Add span from tcb for compatibility with older compilers for python bindings diff --git a/PhotoshopAPI/src/Core/Struct/PascalString.h b/PhotoshopAPI/src/Core/Struct/PascalString.h index 50ebb5e8..97c7401d 100644 --- a/PhotoshopAPI/src/Core/Struct/PascalString.h +++ b/PhotoshopAPI/src/Core/Struct/PascalString.h @@ -338,22 +338,12 @@ inline static std::string convertStrToUTF8(EncodingType encoding, const std::str } -/// Convert a utf-8 encoded string to another encoding. For the moment we simply map the ascii -/// characters and ignore any special character +/// Convert a utf-8 encoded string to another encoding. For the moment we simply parse the data through as is // --------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------- inline static std::string ConvertUTF8ToStr(EncodingType encoding, const std::string str) { - PROFILE_FUNCTION(); - std::string res = ""; - for (const auto& character : str) - { - if (character < 0x80) - { - res += character; - } - } - return res; + return str; } diff --git a/PhotoshopTest/documents/UnicodeNames/UnicodeLayerNames.psb b/PhotoshopTest/documents/UnicodeNames/UnicodeLayerNames.psb index 05907265..8f770c32 100644 Binary files a/PhotoshopTest/documents/UnicodeNames/UnicodeLayerNames.psb and b/PhotoshopTest/documents/UnicodeNames/UnicodeLayerNames.psb differ diff --git a/PhotoshopTest/documents/UnicodeNames/UnicodeLayerNames.psd b/PhotoshopTest/documents/UnicodeNames/UnicodeLayerNames.psd index 597bfbc4..253a3009 100644 Binary files a/PhotoshopTest/documents/UnicodeNames/UnicodeLayerNames.psd and b/PhotoshopTest/documents/UnicodeNames/UnicodeLayerNames.psd differ diff --git a/PhotoshopTest/src/TestUnicodeLayerNames/TestUnicodeLayerNames.cpp b/PhotoshopTest/src/TestUnicodeLayerNames/TestUnicodeLayerNames.cpp index 63531da6..ba6eddd1 100644 --- a/PhotoshopTest/src/TestUnicodeLayerNames/TestUnicodeLayerNames.cpp +++ b/PhotoshopTest/src/TestUnicodeLayerNames/TestUnicodeLayerNames.cpp @@ -19,7 +19,12 @@ TEST_CASE("Read Unicode layer name from psd file") LayeredFile layeredFile = LayeredFile::read(psd_path); - // Find the two layers by their names and check if the result is not null + // Find the three layers by their names and check if the result is not null + SUBCASE("Find chinese simplified layer") + { + auto ptr = layeredFile.findLayer("Chinese_Simplified/请问可以修改psd 的画板尺寸吗"); + CHECK(ptr); + } SUBCASE("Find overflow layer") { auto ptr = layeredFile.findLayer("äüöUnicodeNameOverflowPascalString--------------------------------------------------------------------------------------------------------------------"); @@ -44,7 +49,12 @@ TEST_CASE("Read Unicode layer name from psb file") LayeredFile layeredFile = LayeredFile::read(psb_path); - // Find the two layers by their names and check if the result is not null + // Find the three layers by their names and check if the result is not null + SUBCASE("Find chinese simplified layer") + { + auto ptr = layeredFile.findLayer("Chinese_Simplified/请问可以修改psd 的画板尺寸吗"); + CHECK(ptr); + } SUBCASE("Find overflow layer") { auto ptr = layeredFile.findLayer("äüöUnicodeNameOverflowPascalString--------------------------------------------------------------------------------------------------------------------"); @@ -74,7 +84,12 @@ TEST_CASE("Read write unicode layer name from psd file") LayeredFile layeredFile = LayeredFile::read(psd_path); - // Find the two layers by their names and check if the result is not null + // Find the three layers by their names and check if the result is not null + SUBCASE("Find chinese simplified layer") + { + auto ptr = layeredFile.findLayer("Chinese_Simplified/请问可以修改psd 的画板尺寸吗"); + CHECK(ptr); + } SUBCASE("Find overflow layer") { auto ptr = layeredFile.findLayer("äüöUnicodeNameOverflowPascalString--------------------------------------------------------------------------------------------------------------------"); @@ -104,7 +119,12 @@ TEST_CASE("Read write unicode layer name from psb file") LayeredFile layeredFile = LayeredFile::read(psb_path); - // Find the two layers by their names and check if the result is not null + // Find the three layers by their names and check if the result is not null + SUBCASE("Find chinese simplified layer") + { + auto ptr = layeredFile.findLayer("Chinese_Simplified/请问可以修改psd 的画板尺寸吗"); + CHECK(ptr); + } SUBCASE("Find overflow layer") { auto ptr = layeredFile.findLayer("äüöUnicodeNameOverflowPascalString--------------------------------------------------------------------------------------------------------------------"); diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 60b4d7eb..de6ef942 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -4,5 +4,8 @@ project(PhotoshopAPIPython) file(GLOB_RECURSE MY_SOURCES CONFIGURE_DEPENDS "src/*.cpp") +# Compile simdutf with position independent code as it otherwise wont compile on gcc ubuntu +set_property(TARGET simdutf PROPERTY POSITION_INDEPENDENT_CODE ON) + pybind11_add_module(psapi src/main.cpp) target_link_libraries(psapi PUBLIC PhotoshopAPI) \ No newline at end of file diff --git a/thirdparty/simdutf b/thirdparty/simdutf index 1c3c8096..c00580bd 160000 --- a/thirdparty/simdutf +++ b/thirdparty/simdutf @@ -1 +1 @@ -Subproject commit 1c3c809681c86d6d59cb05d0fc61400484624b6e +Subproject commit c00580bde0bcc5a8299281910f42f83b7c8ff64c