diff --git a/bin/unit_tests/assets/fontrendering/eepp-textedit-arabic.webp b/bin/unit_tests/assets/fontrendering/eepp-textedit-arabic.webp new file mode 100644 index 000000000..667ac730a Binary files /dev/null and b/bin/unit_tests/assets/fontrendering/eepp-textedit-arabic.webp differ diff --git a/bin/unit_tests/assets/fontrendering/eepp-textedit-hebrew.webp b/bin/unit_tests/assets/fontrendering/eepp-textedit-hebrew.webp new file mode 100644 index 000000000..9f6ba1905 Binary files /dev/null and b/bin/unit_tests/assets/fontrendering/eepp-textedit-hebrew.webp differ diff --git a/bin/unit_tests/assets/textfiles/test-arabic.uext b/bin/unit_tests/assets/textfiles/test-arabic.uext index f148e5c67..79e2592e7 100644 --- a/bin/unit_tests/assets/textfiles/test-arabic.uext +++ b/bin/unit_tests/assets/textfiles/test-arabic.uext @@ -21,4 +21,4 @@ How much is this?: كم سعره؟ Where is the bathroom?: أين الحمام؟ Help!: المساعدة! Stop!: توقف! -Call the police!: اتصل بالشرطة! +Call the police!: اتصل بالشرطة! \ No newline at end of file diff --git a/bin/unit_tests/assets/textfiles/test-hebrew.uext b/bin/unit_tests/assets/textfiles/test-hebrew.uext new file mode 100644 index 000000000..4e1a09cff --- /dev/null +++ b/bin/unit_tests/assets/textfiles/test-hebrew.uext @@ -0,0 +1,24 @@ +Hello: שלום +Good morning: בוקר טוב +Good night: לילה טוב +Thank you: תודה +You're welcome: בשמחה +Yes / No: כן / לא +Please: בבקשה +Excuse me / Sorry: סליחה / מצטער +How are you?: מה שלומך? +I'm fine. And you?: אני בסדר. ואתה? +What's your name?: מה שמך? +My name is...: שמי... +Nice to meet you: נעים לפגוש אותך +Where are you from?: מאיפה אתה? +I'm from...: אני מ... +Do you speak English?: אתה מדבר אנגלית? +I don't understand: אני לא מבין. +Please speak more slowly: בבקשה דבר לאט יותר. +Please write it down: בבקשה כתוב את זה. +How much is this?: כמה זה עולה? +Where is the bathroom?: איפה השירותים? +Help!: עזרה! +Stop!: עצור! +Call the police!: תתקשר למשטרה! diff --git a/src/tests/ui_perf_test/ui_perf_test.cpp b/src/tests/ui_perf_test/ui_perf_test.cpp index 8d3ac38ef..be7cf9893 100644 --- a/src/tests/ui_perf_test/ui_perf_test.cpp +++ b/src/tests/ui_perf_test/ui_perf_test.cpp @@ -168,16 +168,16 @@ EE_MAIN_FUNC int main( int, char*[] ) { editor->setFontSize( PixelDensity::dpToPx( 12 ) ); FontManager::instance()->addFallbackFont( FontTrueType::New( "arabic", "unit_tests/assets/fonts/NotoNaskhArabic-Regular.ttf" ) ); - FontManager::instance()->addFallbackFont( FontTrueType::New( - "NotoSerifBengali-Regular", "unit_tests/assets/fonts/NotoSansBengali-Regular.ttf" ) ); + // FontManager::instance()->addFallbackFont( FontTrueType::New( + // "NotoSerifBengali-Regular", "unit_tests/assets/fonts/NotoSansBengali-Regular.ttf" ) ); // editor->setLineWrapMode( LineWrapMode::Word ); editor->setFont( FontManager::instance()->getByName( "monospace" ) ); // editor->loadFromFile( "unit_tests/assets/textfiles/test-arabic-simple.uext" ); - // editor->loadFromFile( "unit_tests/assets/textfiles/test-arabic.uext" ); + editor->loadFromFile( "unit_tests/assets/textfiles/test-arabic.uext" ); // editor->loadFromFile( "unit_tests/assets/textfiles/test-bengali.uext" ); // editor->loadFromFile( "unit_tests/assets/textfiles/test-flags.uext" ); // editor->loadFromFile( "unit_tests/assets/textformat/english.utf8.lf.nobom.txt" ); - editor->loadFromFile( "unit_tests/assets/textfiles/test-arabic-mixed.uext" ); + // editor->loadFromFile( "unit_tests/assets/textfiles/test-arabic-mixed.uext" ); // editor->getDocument().textInput( "اسمي..." ); // editor->getDocument().textInput( " হ্যাঁ " ); // editor->getDocument().textInput( "I'm from...: আমি ... থেকে এসেছি।" ); diff --git a/src/tests/unit_tests/fontrendering.cpp b/src/tests/unit_tests/fontrendering.cpp index a0d406735..7691438b7 100644 --- a/src/tests/unit_tests/fontrendering.cpp +++ b/src/tests/unit_tests/fontrendering.cpp @@ -426,6 +426,46 @@ UTEST( FontRendering, textEditBengaliTest ) { compareImages( utest_state, utest_result, app.getWindow(), "eepp-textedit-bengali" ); } +UTEST( FontRendering, textEditArabicTest ) { + BoolScopedOp op( Text::TextShaperEnabled, true ); + UIApplication app( + WindowSettings( 1024, 650, "eepp - TextEdit Arabic", WindowStyle::Default, + WindowBackend::Default, 32, {}, 1, false, true ), + UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1.5f ) ); + FileSystem::changeWorkingDirectory( Sys::getProcessPath() ); + FontTrueType* arabicFont = + FontTrueType::New( "NotoNaskhArabic-Regular", "assets/fonts/NotoNaskhArabic-Regular.ttf" ); + FontManager::instance()->addFallbackFont( arabicFont ); + UTEST_PRINT_STEP( "Text Shaper enabled" ); + auto* editor = UITextEdit::New(); + // editor->setFontSize( PixelDensity::dpToPx( 12 ) ); + editor->setPixelsSize( app.getUI()->getPixelsSize() ); + editor->loadFromFile( "assets/textfiles/test-arabic.uext" ); + SceneManager::instance()->update(); + SceneManager::instance()->draw(); + compareImages( utest_state, utest_result, app.getWindow(), "eepp-textedit-arabic" ); +} + +UTEST( FontRendering, textEditHebrewTest ) { + BoolScopedOp op( Text::TextShaperEnabled, true ); + UIApplication app( + WindowSettings( 1024, 650, "eepp - TextEdit Hebrew", WindowStyle::Default, + WindowBackend::Default, 32, {}, 1, false, true ), + UIApplication::Settings( Sys::getProcessPath() + ".." + FileSystem::getOSSlash(), 1.5f ) ); + FileSystem::changeWorkingDirectory( Sys::getProcessPath() ); + FontTrueType* hebrewFont = + FontTrueType::New( "NotoSansHebrew-Regular", "assets/fonts/NotoSansHebrew-Regular.ttf" ); + FontManager::instance()->addFallbackFont( hebrewFont ); + UTEST_PRINT_STEP( "Text Shaper enabled" ); + auto* editor = UITextEdit::New(); + // editor->setFontSize( PixelDensity::dpToPx( 12 ) ); + editor->setPixelsSize( app.getUI()->getPixelsSize() ); + editor->loadFromFile( "assets/textfiles/test-hebrew.uext" ); + SceneManager::instance()->update(); + SceneManager::instance()->draw(); + compareImages( utest_state, utest_result, app.getWindow(), "eepp-textedit-hebrew" ); +} + UTEST( FontRendering, textSizes ) { auto win = Engine::instance()->createWindow( WindowSettings( 1024, 650, "eepp - Text Sizes", WindowStyle::Default,