diff --git a/engine/src/flutter/BUILD.gn b/engine/src/flutter/BUILD.gn index 2888897efa..2549e6d017 100644 --- a/engine/src/flutter/BUILD.gn +++ b/engine/src/flutter/BUILD.gn @@ -21,7 +21,7 @@ config("txt_config") { } source_set("txt") { - if (current_toolchain == host_toolchain) { + if (current_toolchain == host_toolchain && !is_mac) { defines = [ "DIRECTORY_FONT_MANAGER_AVAILABLE" ] } if (is_android) { diff --git a/engine/src/flutter/src/font_collection.h b/engine/src/flutter/src/font_collection.h index f305241669..63c9ca1a38 100644 --- a/engine/src/flutter/src/font_collection.h +++ b/engine/src/flutter/src/font_collection.h @@ -18,6 +18,12 @@ #define LIB_TXT_SRC_FONT_COLLECTION_H_ #define DEFAULT_FAMILY_NAME "Roboto" +#ifdef ANDROID_FONT_MANAGER_AVAILABLE +#undef DEFAULT_FAMILY_NAME +// On Android, Roboto is called 'sans-serif' +#define DEFAULT_FAMILY_NAME "sans-serif" +#endif + #define DEFAULT_CACHE_CAPACITY 20 #include diff --git a/engine/src/flutter/src/paragraph.cc b/engine/src/flutter/src/paragraph.cc index 4b4f8532ae..6b9f8ca5ae 100644 --- a/engine/src/flutter/src/paragraph.cc +++ b/engine/src/flutter/src/paragraph.cc @@ -842,12 +842,10 @@ size_t Paragraph::GetGlyphPositionAtCoordinate( prev_count = 0; for (size_t x_index = 1; x_index < glyph_position_x_[y_index].size() - 1; ++x_index) { - // TODO(garyq): Resolve edge case where second to last glyph position is - // skipped/unreachable. if (dx < glyph_position_x_[y_index][x_index] - (using_glyph_center_as_boundary - ? (glyph_position_x_[y_index][x_index + 1] - - glyph_position_x_[y_index][x_index]) / + ? (glyph_position_x_[y_index][x_index] - + glyph_position_x_[y_index][x_index -1]) / 2.0f : 0)) { break; diff --git a/engine/src/flutter/tests/txt/paragraph_unittests.cc b/engine/src/flutter/tests/txt/paragraph_unittests.cc index 974ac595cf..b28ef56ce9 100644 --- a/engine/src/flutter/tests/txt/paragraph_unittests.cc +++ b/engine/src/flutter/tests/txt/paragraph_unittests.cc @@ -28,7 +28,7 @@ namespace txt { TEST_F(RenderTest, SimpleParagraph) { - const char* text = "Hello World"; + const char* text = "Hello World Text Dialog"; auto icu_text = icu::UnicodeString::fromUTF8(text); std::u16string u16_text(icu_text.getBuffer(), icu_text.getBuffer() + icu_text.length()); @@ -39,6 +39,7 @@ TEST_F(RenderTest, SimpleParagraph) { txt::TextStyle text_style; text_style.color = SK_ColorBLACK; + text_style.font_size = 12; builder.PushStyle(text_style); builder.AddText(u16_text);