From 589cd19d8917426741b73923bfc1094381a12eb4 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 25 Aug 2017 17:14:47 -0700 Subject: [PATCH] Create a unified target for the txt and minikin library, tests and benchmarks. (flutter/engine#4016) --- engine/src/flutter/BUILD.gn | 8 +- engine/src/flutter/third_party/txt/Android.bp | 11 - engine/src/flutter/third_party/txt/BUILD.gn | 147 ++++- .../flutter/third_party/txt/app/Android.bp | 30 - .../flutter/third_party/txt/app/HyphTool.cpp | 64 -- .../third_party/txt/benchmarks/BUILD.gn | 47 -- .../benchmarks/font_collection_benchmarks.cc | 2 +- .../txt/benchmarks/paint_record_benchmarks.cc | 4 +- .../txt/benchmarks/paragraph_benchmarks.cc | 16 +- .../paragraph_builder_benchmarks.cc | 12 +- .../txt/benchmarks/styled_runs_benchmarks.cc | 4 +- .../third_party/txt/benchmarks/utils.cc | 2 +- .../third_party/txt/doc/hyb_file_format.md | 135 ---- .../flutter/third_party/txt/examples/BUILD.gn | 28 - .../flutter/third_party/txt/examples/main.cc | 75 --- .../third_party/txt/libs/minikin/Android.bp | 86 --- .../third_party/txt/libs/minikin/BUILD.gn | 61 -- .../flutter/third_party/txt/shims/BUILD.gn | 34 - .../src/flutter/third_party/txt/src/BUILD.gn | 17 - .../third_party/txt/{shims => src}/log/log.cc | 0 .../third_party/txt/{shims => src}/log/log.h | 0 .../{libs => src}/minikin/CmapCoverage.cpp | 0 .../{include => src}/minikin/CmapCoverage.h | 0 .../txt/{libs => src}/minikin/Emoji.cpp | 0 .../txt/{include => src}/minikin/Emoji.h | 0 .../{libs => src}/minikin/FontCollection.cpp | 0 .../{include => src}/minikin/FontCollection.h | 0 .../txt/{libs => src}/minikin/FontFamily.cpp | 0 .../txt/{include => src}/minikin/FontFamily.h | 0 .../{libs => src}/minikin/FontLanguage.cpp | 0 .../txt/{libs => src}/minikin/FontLanguage.h | 0 .../minikin/FontLanguageListCache.cpp | 0 .../minikin/FontLanguageListCache.h | 0 .../txt/{libs => src}/minikin/FontUtils.cpp | 0 .../txt/{libs => src}/minikin/FontUtils.h | 0 .../{libs => src}/minikin/GraphemeBreak.cpp | 0 .../{include => src}/minikin/GraphemeBreak.h | 0 .../txt/{libs => src}/minikin/HbFontCache.cpp | 0 .../txt/{libs => src}/minikin/HbFontCache.h | 0 .../txt/{libs => src}/minikin/Hyphenator.cpp | 0 .../txt/{include => src}/minikin/Hyphenator.h | 0 .../txt/{libs => src}/minikin/Layout.cpp | 0 .../txt/{include => src}/minikin/Layout.h | 0 .../txt/{libs => src}/minikin/LayoutUtils.cpp | 0 .../txt/{libs => src}/minikin/LayoutUtils.h | 0 .../txt/{libs => src}/minikin/LineBreaker.cpp | 0 .../{include => src}/minikin/LineBreaker.h | 0 .../txt/{libs => src}/minikin/Measurement.cpp | 0 .../{include => src}/minikin/Measurement.h | 0 .../txt/{libs => src}/minikin/MinikinFont.cpp | 0 .../{include => src}/minikin/MinikinFont.h | 0 .../{libs => src}/minikin/MinikinInternal.cpp | 0 .../{libs => src}/minikin/MinikinInternal.h | 0 .../{libs => src}/minikin/SparseBitSet.cpp | 0 .../{include => src}/minikin/SparseBitSet.h | 0 .../txt/{libs => src}/minikin/WordBreaker.cpp | 0 .../{include => src}/minikin/WordBreaker.h | 0 .../txt/src/{ => txt}/font_collection.cc | 4 +- .../txt/src/{ => txt}/font_collection.h | 0 .../txt/src/{ => txt}/font_skia.cc | 2 +- .../third_party/txt/src/{ => txt}/font_skia.h | 0 .../txt/src/{ => txt}/font_style.h | 0 .../txt/src/{ => txt}/font_weight.h | 0 .../txt/src/{ => txt}/paint_record.cc | 2 +- .../txt/src/{ => txt}/paint_record.h | 2 +- .../txt/src/{ => txt}/paragraph.cc | 12 +- .../third_party/txt/src/{ => txt}/paragraph.h | 8 +- .../txt/src/{ => txt}/paragraph_builder.cc | 4 +- .../txt/src/{ => txt}/paragraph_builder.h | 10 +- .../txt/src/{ => txt}/paragraph_style.cc | 8 +- .../txt/src/{ => txt}/paragraph_style.h | 8 +- .../txt/src/{ => txt}/styled_runs.cc | 2 +- .../txt/src/{ => txt}/styled_runs.h | 2 +- .../txt/src/{ => txt}/text_align.h | 0 .../txt/src/{ => txt}/text_baseline.h | 0 .../txt/src/{ => txt}/text_decoration.cc | 8 +- .../txt/src/{ => txt}/text_decoration.h | 2 +- .../txt/src/{ => txt}/text_style.cc | 6 +- .../txt/src/{ => txt}/text_style.h | 8 +- .../txt/{shims => src}/utils/JenkinsHash.cpp | 0 .../txt/{shims => src}/utils/JenkinsHash.h | 0 .../txt/{shims => src}/utils/LruCache.h | 0 .../txt/{shims => src}/utils/TypeHelpers.h | 0 .../flutter/third_party/txt/tests/Android.bp | 33 - .../flutter/third_party/txt/tests/BUILD.gn | 22 - .../{txt => }/font_collection_unittests.cc | 4 +- .../{ => old}/perftests/FontCollection.cpp | 0 .../tests/{ => old}/perftests/FontFamily.cpp | 0 .../{ => old}/perftests/FontLanguage.cpp | 0 .../{ => old}/perftests/GraphemeBreak.cpp | 0 .../tests/{ => old}/perftests/Hyphenator.cpp | 0 .../tests/{ => old}/perftests/WordBreaker.cpp | 0 .../txt/tests/{ => old}/perftests/main.cpp | 0 .../{ => old}/stresstest/MultithreadTest.cpp | 0 .../{ => old}/unittest/CmapCoverageTest.cpp | 0 .../tests/{ => old}/unittest/EmojiTest.cpp | 0 .../unittest/FontCollectionItemizeTest.cpp | 0 .../{ => old}/unittest/FontCollectionTest.cpp | 0 .../{ => old}/unittest/FontFamilyTest.cpp | 0 .../unittest/FontLanguageListCacheTest.cpp | 0 .../{ => old}/unittest/GraphemeBreakTests.cpp | 0 .../{ => old}/unittest/HbFontCacheTest.cpp | 0 .../{ => old}/unittest/HyphenatorTest.cpp | 0 .../tests/{ => old}/unittest/ICUTestBase.h | 0 .../tests/{ => old}/unittest/LayoutTest.cpp | 0 .../{ => old}/unittest/LayoutUtilsTest.cpp | 0 .../{ => old}/unittest/MeasurementTests.cpp | 0 .../{ => old}/unittest/SparseBitSetTest.cpp | 0 .../{ => old}/unittest/UnicodeUtilsTest.cpp | 0 .../{ => old}/unittest/WordBreakerTests.cpp | 0 .../txt/tests/{ => old}/util/FileUtils.cpp | 0 .../txt/tests/{ => old}/util/FileUtils.h | 0 .../tests/{ => old}/util/FontTestUtils.cpp | 0 .../txt/tests/{ => old}/util/FontTestUtils.h | 0 .../{ => old}/util/MinikinFontForTest.cpp | 0 .../tests/{ => old}/util/MinikinFontForTest.h | 0 .../txt/tests/{ => old}/util/UnicodeUtils.cpp | 0 .../txt/tests/{ => old}/util/UnicodeUtils.h | 0 .../tests/{txt => }/paragraph_unittests.cc | 12 +- .../txt/tests/perftests/Android.bp | 49 -- .../txt/tests/perftests/AndroidTest.xml | 26 - .../txt/tests/perftests/how_to_run.txt | 3 - .../txt/tests/{txt => }/render_test.cc | 0 .../txt/tests/{txt => }/render_test.h | 0 .../txt/tests/stresstest/Android.bp | 49 -- .../txt/tests/stresstest/how_to_run.txt | 3 - .../third_party/txt/tests/txt/BUILD.gn | 43 -- .../tests/{txt => }/txt_run_all_unittests.cc | 2 +- .../third_party/txt/tests/unittest/Android.bp | 74 --- .../txt/tests/unittest/AndroidTest.xml | 26 - .../third_party/txt/tests/unittest/BUILD.gn | 41 -- .../txt/tests/unittest/how_to_run.txt | 3 - .../third_party/txt/tests/util/Android.bp | 13 - .../third_party/txt/tests/util/BUILD.gn | 32 - .../third_party/txt/tests/{txt => }/utils.cc | 4 +- .../third_party/txt/tests/{txt => }/utils.h | 0 .../third_party/txt/tools/mk_hyb_file.py | 584 ------------------ 137 files changed, 204 insertions(+), 1690 deletions(-) delete mode 100644 engine/src/flutter/third_party/txt/Android.bp delete mode 100644 engine/src/flutter/third_party/txt/app/Android.bp delete mode 100644 engine/src/flutter/third_party/txt/app/HyphTool.cpp delete mode 100644 engine/src/flutter/third_party/txt/benchmarks/BUILD.gn delete mode 100644 engine/src/flutter/third_party/txt/doc/hyb_file_format.md delete mode 100644 engine/src/flutter/third_party/txt/examples/BUILD.gn delete mode 100644 engine/src/flutter/third_party/txt/examples/main.cc delete mode 100644 engine/src/flutter/third_party/txt/libs/minikin/Android.bp delete mode 100644 engine/src/flutter/third_party/txt/libs/minikin/BUILD.gn delete mode 100644 engine/src/flutter/third_party/txt/shims/BUILD.gn delete mode 100644 engine/src/flutter/third_party/txt/src/BUILD.gn rename engine/src/flutter/third_party/txt/{shims => src}/log/log.cc (100%) rename engine/src/flutter/third_party/txt/{shims => src}/log/log.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/CmapCoverage.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/CmapCoverage.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/Emoji.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/Emoji.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/FontCollection.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/FontCollection.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/FontFamily.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/FontFamily.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/FontLanguage.cpp (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/FontLanguage.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/FontLanguageListCache.cpp (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/FontLanguageListCache.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/FontUtils.cpp (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/FontUtils.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/GraphemeBreak.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/GraphemeBreak.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/HbFontCache.cpp (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/HbFontCache.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/Hyphenator.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/Hyphenator.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/Layout.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/Layout.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/LayoutUtils.cpp (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/LayoutUtils.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/LineBreaker.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/LineBreaker.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/Measurement.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/Measurement.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/MinikinFont.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/MinikinFont.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/MinikinInternal.cpp (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/MinikinInternal.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/SparseBitSet.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/SparseBitSet.h (100%) rename engine/src/flutter/third_party/txt/{libs => src}/minikin/WordBreaker.cpp (100%) rename engine/src/flutter/third_party/txt/{include => src}/minikin/WordBreaker.h (100%) rename engine/src/flutter/third_party/txt/src/{ => txt}/font_collection.cc (99%) rename engine/src/flutter/third_party/txt/src/{ => txt}/font_collection.h (100%) rename engine/src/flutter/third_party/txt/src/{ => txt}/font_skia.cc (98%) rename engine/src/flutter/third_party/txt/src/{ => txt}/font_skia.h (100%) rename engine/src/flutter/third_party/txt/src/{ => txt}/font_style.h (100%) rename engine/src/flutter/third_party/txt/src/{ => txt}/font_weight.h (100%) rename engine/src/flutter/third_party/txt/src/{ => txt}/paint_record.cc (98%) rename engine/src/flutter/third_party/txt/src/{ => txt}/paint_record.h (98%) rename engine/src/flutter/third_party/txt/src/{ => txt}/paragraph.cc (99%) rename engine/src/flutter/third_party/txt/src/{ => txt}/paragraph.h (98%) rename engine/src/flutter/third_party/txt/src/{ => txt}/paragraph_builder.cc (97%) rename engine/src/flutter/third_party/txt/src/{ => txt}/paragraph_builder.h (93%) rename engine/src/flutter/third_party/txt/src/{ => txt}/paragraph_style.cc (89%) rename engine/src/flutter/third_party/txt/src/{ => txt}/paragraph_style.h (90%) rename engine/src/flutter/third_party/txt/src/{ => txt}/styled_runs.cc (98%) rename engine/src/flutter/third_party/txt/src/{ => txt}/styled_runs.h (98%) rename engine/src/flutter/third_party/txt/src/{ => txt}/text_align.h (100%) rename engine/src/flutter/third_party/txt/src/{ => txt}/text_baseline.h (100%) rename engine/src/flutter/third_party/txt/src/{ => txt}/text_decoration.cc (89%) rename engine/src/flutter/third_party/txt/src/{ => txt}/text_decoration.h (95%) rename engine/src/flutter/third_party/txt/src/{ => txt}/text_style.cc (92%) rename engine/src/flutter/third_party/txt/src/{ => txt}/text_style.h (91%) rename engine/src/flutter/third_party/txt/{shims => src}/utils/JenkinsHash.cpp (100%) rename engine/src/flutter/third_party/txt/{shims => src}/utils/JenkinsHash.h (100%) rename engine/src/flutter/third_party/txt/{shims => src}/utils/LruCache.h (100%) rename engine/src/flutter/third_party/txt/{shims => src}/utils/TypeHelpers.h (100%) delete mode 100644 engine/src/flutter/third_party/txt/tests/Android.bp delete mode 100644 engine/src/flutter/third_party/txt/tests/BUILD.gn rename engine/src/flutter/third_party/txt/tests/{txt => }/font_collection_unittests.cc (98%) rename engine/src/flutter/third_party/txt/tests/{ => old}/perftests/FontCollection.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/perftests/FontFamily.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/perftests/FontLanguage.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/perftests/GraphemeBreak.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/perftests/Hyphenator.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/perftests/WordBreaker.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/perftests/main.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/stresstest/MultithreadTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/CmapCoverageTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/EmojiTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/FontCollectionItemizeTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/FontCollectionTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/FontFamilyTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/FontLanguageListCacheTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/GraphemeBreakTests.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/HbFontCacheTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/HyphenatorTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/ICUTestBase.h (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/LayoutTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/LayoutUtilsTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/MeasurementTests.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/SparseBitSetTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/UnicodeUtilsTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/unittest/WordBreakerTests.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/util/FileUtils.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/util/FileUtils.h (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/util/FontTestUtils.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/util/FontTestUtils.h (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/util/MinikinFontForTest.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/util/MinikinFontForTest.h (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/util/UnicodeUtils.cpp (100%) rename engine/src/flutter/third_party/txt/tests/{ => old}/util/UnicodeUtils.h (100%) rename engine/src/flutter/third_party/txt/tests/{txt => }/paragraph_unittests.cc (99%) delete mode 100644 engine/src/flutter/third_party/txt/tests/perftests/Android.bp delete mode 100644 engine/src/flutter/third_party/txt/tests/perftests/AndroidTest.xml delete mode 100644 engine/src/flutter/third_party/txt/tests/perftests/how_to_run.txt rename engine/src/flutter/third_party/txt/tests/{txt => }/render_test.cc (100%) rename engine/src/flutter/third_party/txt/tests/{txt => }/render_test.h (100%) delete mode 100644 engine/src/flutter/third_party/txt/tests/stresstest/Android.bp delete mode 100644 engine/src/flutter/third_party/txt/tests/stresstest/how_to_run.txt delete mode 100644 engine/src/flutter/third_party/txt/tests/txt/BUILD.gn rename engine/src/flutter/third_party/txt/tests/{txt => }/txt_run_all_unittests.cc (97%) delete mode 100644 engine/src/flutter/third_party/txt/tests/unittest/Android.bp delete mode 100644 engine/src/flutter/third_party/txt/tests/unittest/AndroidTest.xml delete mode 100644 engine/src/flutter/third_party/txt/tests/unittest/BUILD.gn delete mode 100644 engine/src/flutter/third_party/txt/tests/unittest/how_to_run.txt delete mode 100644 engine/src/flutter/third_party/txt/tests/util/Android.bp delete mode 100644 engine/src/flutter/third_party/txt/tests/util/BUILD.gn rename engine/src/flutter/third_party/txt/tests/{txt => }/utils.cc (94%) rename engine/src/flutter/third_party/txt/tests/{txt => }/utils.h (100%) delete mode 100755 engine/src/flutter/third_party/txt/tools/mk_hyb_file.py diff --git a/engine/src/flutter/BUILD.gn b/engine/src/flutter/BUILD.gn index 0872c9731c..7258646ea0 100644 --- a/engine/src/flutter/BUILD.gn +++ b/engine/src/flutter/BUILD.gn @@ -14,8 +14,8 @@ group("flutter") { if (!is_fuchsia) { if (current_toolchain == host_toolchain) { deps += [ - "//dart:create_sdk", - "//flutter/frontend_server", + "//dart:create_sdk", + "//flutter/frontend_server", ] } } @@ -42,8 +42,12 @@ group("flutter") { "//flutter/fml:fml_unittests", "//flutter/sky/engine/wtf:wtf_unittests", "//flutter/synchronization:synchronization_unittests", + "//flutter/third_party/txt:txt_unittests", "//lib/ftl:ftl_unittests", ] + if (is_linux) { + deps += [ "//flutter/third_party/txt:txt_benchmarks" ] + } } } diff --git a/engine/src/flutter/third_party/txt/Android.bp b/engine/src/flutter/third_party/txt/Android.bp deleted file mode 100644 index e875a172b0..0000000000 --- a/engine/src/flutter/third_party/txt/Android.bp +++ /dev/null @@ -1,11 +0,0 @@ -cc_library_headers { - name: "libminikin_headers", - host_supported: true, - export_include_dirs: ["include"], -} - -subdirs = [ - "app", - "libs/minikin", - "tests", -] diff --git a/engine/src/flutter/third_party/txt/BUILD.gn b/engine/src/flutter/third_party/txt/BUILD.gn index 2549e6d017..48ce317308 100644 --- a/engine/src/flutter/third_party/txt/BUILD.gn +++ b/engine/src/flutter/third_party/txt/BUILD.gn @@ -13,11 +13,8 @@ # limitations under the License. config("txt_config") { - include_dirs = [ - "//lib/txt/include", - "//third_party/harfbuzz/src", - "//lib/txt/shims", - ] + visibility = [ ":*" ] + include_dirs = [ "src" ] } source_set("txt") { @@ -29,34 +26,126 @@ source_set("txt") { } sources = [ - "src/font_collection.cc", - "src/font_collection.h", - "src/font_skia.cc", - "src/font_skia.h", - "src/font_style.h", - "src/font_weight.h", - "src/paint_record.cc", - "src/paint_record.h", - "src/paragraph.cc", - "src/paragraph.h", - "src/paragraph_builder.cc", - "src/paragraph_builder.h", - "src/paragraph_style.cc", - "src/paragraph_style.h", - "src/styled_runs.cc", - "src/styled_runs.h", - "src/text_align.h", - "src/text_baseline.h", - "src/text_decoration.cc", - "src/text_decoration.h", - "src/text_style.cc", - "src/text_style.h", + "src/log/log.cc", + "src/log/log.h", + "src/minikin/CmapCoverage.cpp", + "src/minikin/CmapCoverage.h", + "src/minikin/Emoji.cpp", + "src/minikin/Emoji.h", + "src/minikin/FontCollection.cpp", + "src/minikin/FontCollection.h", + "src/minikin/FontFamily.cpp", + "src/minikin/FontFamily.h", + "src/minikin/FontLanguage.cpp", + "src/minikin/FontLanguage.h", + "src/minikin/FontLanguageListCache.cpp", + "src/minikin/FontLanguageListCache.h", + "src/minikin/FontUtils.cpp", + "src/minikin/FontUtils.h", + "src/minikin/GraphemeBreak.cpp", + "src/minikin/GraphemeBreak.h", + "src/minikin/HbFontCache.cpp", + "src/minikin/HbFontCache.h", + "src/minikin/Hyphenator.cpp", + "src/minikin/Hyphenator.h", + "src/minikin/Layout.cpp", + "src/minikin/Layout.h", + "src/minikin/LayoutUtils.cpp", + "src/minikin/LayoutUtils.h", + "src/minikin/LineBreaker.cpp", + "src/minikin/LineBreaker.h", + "src/minikin/Measurement.cpp", + "src/minikin/Measurement.h", + "src/minikin/MinikinFont.cpp", + "src/minikin/MinikinFont.h", + "src/minikin/MinikinInternal.cpp", + "src/minikin/MinikinInternal.h", + "src/minikin/SparseBitSet.cpp", + "src/minikin/SparseBitSet.h", + "src/minikin/WordBreaker.cpp", + "src/minikin/WordBreaker.h", + "src/txt/font_collection.cc", + "src/txt/font_collection.h", + "src/txt/font_skia.cc", + "src/txt/font_skia.h", + "src/txt/font_style.h", + "src/txt/font_weight.h", + "src/txt/paint_record.cc", + "src/txt/paint_record.h", + "src/txt/paragraph.cc", + "src/txt/paragraph.h", + "src/txt/paragraph_builder.cc", + "src/txt/paragraph_builder.h", + "src/txt/paragraph_style.cc", + "src/txt/paragraph_style.h", + "src/txt/styled_runs.cc", + "src/txt/styled_runs.h", + "src/txt/text_align.h", + "src/txt/text_baseline.h", + "src/txt/text_decoration.cc", + "src/txt/text_decoration.h", + "src/txt/text_style.cc", + "src/txt/text_style.h", + "src/utils/JenkinsHash.cpp", + "src/utils/JenkinsHash.h", + "src/utils/LruCache.h", + "src/utils/TypeHelpers.h", ] public_configs = [ ":txt_config" ] - deps = [ - "//lib/txt/libs/minikin", + public_deps = [ + "//lib/ftl", + "//third_party/harfbuzz", + "//third_party/icu", "//third_party/skia", ] + + deps = [ + "//third_party/skia:effects", + ] +} + +txt_common_executable_deps = [ + "//dart/runtime:libdart_jit", # For logging. + "//flutter/fml", # For ICU initialization. +] + +executable("txt_unittests") { + testonly = true + + sources = [ + "tests/font_collection_unittests.cc", + "tests/paragraph_unittests.cc", + "tests/render_test.cc", + "tests/render_test.h", + "tests/txt_run_all_unittests.cc", + "tests/utils.cc", + "tests/utils.h", + ] + + deps = [ + ":txt", + "//third_party/gtest", + ] + txt_common_executable_deps +} + +executable("txt_benchmarks") { + testonly = true + + sources = [ + "benchmarks/font_collection_benchmarks.cc", + "benchmarks/paint_record_benchmarks.cc", + "benchmarks/paragraph_benchmarks.cc", + "benchmarks/paragraph_builder_benchmarks.cc", + "benchmarks/styled_runs_benchmarks.cc", + "benchmarks/txt_run_all_benchmarks.cc", + "benchmarks/utils.cc", + "benchmarks/utils.h", + ] + + deps = [ + ":txt", + "//third_party/benchmark", + ] + txt_common_executable_deps } diff --git a/engine/src/flutter/third_party/txt/app/Android.bp b/engine/src/flutter/third_party/txt/app/Android.bp deleted file mode 100644 index e8085c1f3e..0000000000 --- a/engine/src/flutter/third_party/txt/app/Android.bp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (C) 2015 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// see how_to_run.txt for instructions on running these tests - -cc_binary_host { - name: "hyphtool", - - static_libs: ["libminikin"], - - // Shared libraries which are dependencies of minikin; these are not automatically - // pulled in by the build system (and thus sadly must be repeated). - shared_libs: [ - "liblog", - "libicuuc", - ], - - srcs: ["HyphTool.cpp"], -} diff --git a/engine/src/flutter/third_party/txt/app/HyphTool.cpp b/engine/src/flutter/third_party/txt/app/HyphTool.cpp deleted file mode 100644 index 3c1d2f96d6..0000000000 --- a/engine/src/flutter/third_party/txt/app/HyphTool.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include -#include - -#include "unicode/locid.h" - -#include -#include - -using minikin::HyphenationType; -using minikin::Hyphenator; - -Hyphenator* loadHybFile(const char* fn, int minPrefix, int minSuffix) { - struct stat statbuf; - int status = stat(fn, &statbuf); - if (status < 0) { - fprintf(stderr, "error opening %s\n", fn); - return nullptr; - } - size_t size = statbuf.st_size; - FILE* f = fopen(fn, "rb"); - if (f == NULL) { - fprintf(stderr, "error opening %s\n", fn); - return nullptr; - } - uint8_t* buf = new uint8_t[size]; - size_t read_size = fread(buf, 1, size, f); - fclose(f); - if (read_size < size) { - fprintf(stderr, "error reading %s\n", fn); - delete[] buf; - return nullptr; - } - return Hyphenator::loadBinary(buf, minPrefix, minSuffix); -} - -int main(int argc, char** argv) { - Hyphenator* hyph = loadHybFile("/tmp/en.hyb", 2, 3); // should also be configurable - std::vector result; - std::vector word; - if (argc < 2) { - fprintf(stderr, "usage: hyphtool word\n"); - return 1; - } - char* asciiword = argv[1]; - size_t len = strlen(asciiword); - for (size_t i = 0; i < len; i++) { - uint32_t c = asciiword[i]; - if (c == '-') { - c = 0x00AD; - } - // ASCII (or possibly ISO Latin 1), but kinda painful to do utf conversion :( - word.push_back(c); - } - hyph->hyphenate(&result, word.data(), word.size(), icu::Locale::getUS()); - for (size_t i = 0; i < len; i++) { - if (result[i] != HyphenationType::DONT_BREAK) { - printf("-"); - } - printf("%c", word[i]); - } - printf("\n"); - return 0; -} diff --git a/engine/src/flutter/third_party/txt/benchmarks/BUILD.gn b/engine/src/flutter/third_party/txt/benchmarks/BUILD.gn deleted file mode 100644 index 7c5c6c17b0..0000000000 --- a/engine/src/flutter/third_party/txt/benchmarks/BUILD.gn +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2017 Google, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -executable("benchmarks") { - output_name = "txt_benchmarks" - testonly = true - - include_dirs = [ - "//lib/txt/src", - "//lib/txt/include", - "//third_party/icu/source", - ] - - sources = [ - "font_collection_benchmarks.cc", - "paint_record_benchmarks.cc", - "paragraph_benchmarks.cc", - "paragraph_builder_benchmarks.cc", - "styled_runs_benchmarks.cc", - "txt_run_all_benchmarks.cc", - "utils.cc", - "utils.h", - ] - - deps = [ - "//dart/runtime:libdart_jit", # Logging - "//flutter/fml", - "//lib/txt/shims", - "//lib/txt", - "//third_party/benchmark", - "//third_party/skia", - "//third_party/harfbuzz", - "//lib/txt/libs/minikin", - ] - -} diff --git a/engine/src/flutter/third_party/txt/benchmarks/font_collection_benchmarks.cc b/engine/src/flutter/third_party/txt/benchmarks/font_collection_benchmarks.cc index 74737a8f70..78377b3a6c 100644 --- a/engine/src/flutter/third_party/txt/benchmarks/font_collection_benchmarks.cc +++ b/engine/src/flutter/third_party/txt/benchmarks/font_collection_benchmarks.cc @@ -18,9 +18,9 @@ #include "lib/ftl/command_line.h" #include "lib/ftl/logging.h" -#include "lib/txt/src/font_collection.h" #include "third_party/skia/include/ports/SkFontMgr.h" #include "third_party/skia/include/ports/SkFontMgr_directory.h" +#include "txt/font_collection.h" #include "utils.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/benchmarks/paint_record_benchmarks.cc b/engine/src/flutter/third_party/txt/benchmarks/paint_record_benchmarks.cc index 835ee5d571..54746e8df1 100644 --- a/engine/src/flutter/third_party/txt/benchmarks/paint_record_benchmarks.cc +++ b/engine/src/flutter/third_party/txt/benchmarks/paint_record_benchmarks.cc @@ -18,8 +18,8 @@ #include "lib/ftl/command_line.h" #include "lib/ftl/logging.h" -#include "lib/txt/src/paint_record.h" -#include "lib/txt/src/text_style.h" +#include "txt/paint_record.h" +#include "txt/text_style.h" #include "utils.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/benchmarks/paragraph_benchmarks.cc b/engine/src/flutter/third_party/txt/benchmarks/paragraph_benchmarks.cc index 389c6e5824..5b84728347 100644 --- a/engine/src/flutter/third_party/txt/benchmarks/paragraph_benchmarks.cc +++ b/engine/src/flutter/third_party/txt/benchmarks/paragraph_benchmarks.cc @@ -19,18 +19,18 @@ #include #include "lib/ftl/command_line.h" #include "lib/ftl/logging.h" -#include "lib/txt/libs/minikin/LayoutUtils.h" -#include "lib/txt/src/font_collection.h" -#include "lib/txt/src/font_skia.h" -#include "lib/txt/src/font_style.h" -#include "lib/txt/src/font_weight.h" -#include "lib/txt/src/paragraph.h" -#include "lib/txt/src/paragraph_builder.h" -#include "lib/txt/src/text_align.h" +#include "minikin/LayoutUtils.h" #include "third_party/icu/source/common/unicode/unistr.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColor.h" +#include "txt/font_collection.h" +#include "txt/font_skia.h" +#include "txt/font_style.h" +#include "txt/font_weight.h" +#include "txt/paragraph.h" +#include "txt/paragraph_builder.h" +#include "txt/text_align.h" #include "utils.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/benchmarks/paragraph_builder_benchmarks.cc b/engine/src/flutter/third_party/txt/benchmarks/paragraph_builder_benchmarks.cc index c589dfd9ae..94b7f39cf8 100644 --- a/engine/src/flutter/third_party/txt/benchmarks/paragraph_builder_benchmarks.cc +++ b/engine/src/flutter/third_party/txt/benchmarks/paragraph_builder_benchmarks.cc @@ -17,14 +17,14 @@ #include "third_party/benchmark/include/benchmark/benchmark_api.h" #include "lib/ftl/logging.h" -#include "lib/txt/src/font_collection.h" -#include "lib/txt/src/font_style.h" -#include "lib/txt/src/font_weight.h" -#include "lib/txt/src/paragraph.h" -#include "lib/txt/src/paragraph_builder.h" -#include "lib/txt/src/text_align.h" #include "third_party/icu/source/common/unicode/unistr.h" #include "third_party/skia/include/core/SkColor.h" +#include "txt/font_collection.h" +#include "txt/font_style.h" +#include "txt/font_weight.h" +#include "txt/paragraph.h" +#include "txt/paragraph_builder.h" +#include "txt/text_align.h" #include "utils.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/benchmarks/styled_runs_benchmarks.cc b/engine/src/flutter/third_party/txt/benchmarks/styled_runs_benchmarks.cc index b0531c2da0..b2f4655863 100644 --- a/engine/src/flutter/third_party/txt/benchmarks/styled_runs_benchmarks.cc +++ b/engine/src/flutter/third_party/txt/benchmarks/styled_runs_benchmarks.cc @@ -18,8 +18,8 @@ #include "lib/ftl/command_line.h" #include "lib/ftl/logging.h" -#include "lib/txt/src/styled_runs.h" -#include "lib/txt/src/text_style.h" +#include "txt/styled_runs.h" +#include "txt/text_style.h" #include "utils.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/benchmarks/utils.cc b/engine/src/flutter/third_party/txt/benchmarks/utils.cc index 6ec90c2a5c..ff7fe1ec25 100644 --- a/engine/src/flutter/third_party/txt/benchmarks/utils.cc +++ b/engine/src/flutter/third_party/txt/benchmarks/utils.cc @@ -17,7 +17,7 @@ #include #include "lib/ftl/command_line.h" -#include "lib/txt/tests/txt/utils.h" +#include "utils.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/doc/hyb_file_format.md b/engine/src/flutter/third_party/txt/doc/hyb_file_format.md deleted file mode 100644 index 3065a6f5cc..0000000000 --- a/engine/src/flutter/third_party/txt/doc/hyb_file_format.md +++ /dev/null @@ -1,135 +0,0 @@ -# Hyb (hyphenation pattern binary) file format - -The hyb file format is how hyphenation patterns are stored in the system image. - -Goals include: - -* Concise (system image space is at a premium) -* Usable when mmap'ed, so it doesn't take significant physical RAM -* Fast to compute -* Simple - -It is _not_ intended as an interchange format, so there is no attempt to make the format -extensible or facilitate backward and forward compatibility. - -Further, at some point we will probably pack patterns for multiple languages into a single -physical file, to reduce number of open mmap'ed files. This document doesn't cover that. - -## Theoretical basis - -At heart, the file contains packed tries with suffix compression, actually quite similar -to the implementation in TeX. - -The file contains three sections. The first section represents the "alphabet," including -case folding. It is effectively a map from Unicode code point to a small integer. - -The second section contains the trie in packed form. It is an array of 3-tuples, packed -into a 32 bit integer. Each (suffix-compressed) trie node has a unique index within this -array, and the pattern field in the tuple is the pattern for that node. Further, each edge -in the trie has an entry in the array, and the character and link fields in the tuple -represent the label and destination of the edge. The packing strategy is as in -[Word Hy-phen-a-tion by Com-put-er](http://www.tug.org/docs/liang/liang-thesis.pdf) by -Franklin Mark Liang. - -The trie representation is similar but not identical to the "double-array trie". -The fundamental operation of lookup of the edge from `s` to `t` with label `c` is -to compare `c == character[s + c]`, and if so, `t = link[s + c]`. - -The third section contains the pattern strings. This section is in two parts: first, -an array with a 3-tuple for each pattern (length, number of trailing 0's, and offset -into the string pool); and second, the string pool. Each pattern is encoded as a byte -(packing 2 per byte would be possible but the space savings would not be signficant). - -As much as possible of the file is represented as 32 bit integers, as that is especially -efficent to access. All are little-endian (this could be revised if the code ever needs -to be ported to big-endian systems). - -## Header - -``` -uint32_t magic == 0x62ad7968 -uint32_t version = 0 -uint32_t alphabet_offset (in bytes) -uint32_t trie_offset (in bytes) -uint32_t pattern_offset (in bytes) -uint32_t file_size (in bytes) -``` - -Offsets are from the front of the file, and in bytes. - -## Alphabet - -The alphabet table comes in two versions. The first is well suited to dense Unicode -ranges and is limited to 256. The second is more general, but lookups will be slower. - -### Alphabet, direct version - -``` -uint32_t version = 0 -uint32_t min_codepoint -uint32_t max_codepoint (exclusive) -uint8_t[] data -``` - -The size of the data array is max_codepoint - min_codepoint. 0 represents an unmapped -character. Note that, in the current implementation, automatic hyphenation is disabled -for any word containing an unmapped character. - -In general, pad bytes follow this table, aligning the next table to a 4-byte boundary. - -### Alphabet, general version - -``` -uint32_t version = 1 -uint32_t n_entries -uint32_t[n_entries] data -``` - -Each element in the data table is `(codepoint << 11) | value`. Note that this is -restricted to 11 bits (2048 possible values). The largest known current value is 483 -(for Sanskrit). - -The entries are sorted by codepoint, to facilitate binary search. Another reasonable -implementation for consumers of the data would be to build a hash table at load time. - -## Trie - -``` -uint32_t version = 0 -uint32_t char_mask -uint32_t link_shift -uint32_t link_mask -uint32_t pattern_shift -uint32_t n_entries -uint32_t[n_entries] data -``` - -Each element in the data table is `(pattern << pattern_shift) | (link << link_shift) | char`. - -All known pattern tables fit in 32 bits total. If this is exceeded, there is a fairly -straightforward tweak, where each node occupies a slot by itself (as opposed to sharing -it with edge slots), which would require very minimal changes to the implementation (TODO -present in more detail). - -## Pattern - -``` -uint32_t version = 0 -uint32_t n_entries -uint32_t pattern_offset (in bytes) -uint32_t pattern_size (in bytes) -uint32_t[n_entries] data -uint8_t[] pattern_buf -``` - -Each element in data table is `(len << 26) | (shift << 20) | offset`, where an offset of 0 -points to the first byte of pattern_buf. - -Generally pattern_offset is `16 + 4 * n_entries`. - -For example, 'a4m5ato' would be represented as `[4, 5, 0, 0, 0]`, then len = 2, shift = 3, and -offset points to [4, 5] in the pattern buffer. - -Future extension: additional data representing nonstandard hyphenation. See -[Automatic non-standard hyphenation in OpenOffice.org](https://www.tug.org/TUGboat/tb27-1/tb86nemeth.pdf) -for more information about that issue. diff --git a/engine/src/flutter/third_party/txt/examples/BUILD.gn b/engine/src/flutter/third_party/txt/examples/BUILD.gn deleted file mode 100644 index b0452feb4c..0000000000 --- a/engine/src/flutter/third_party/txt/examples/BUILD.gn +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -executable("txt_example") { - sources = [ - "main.cc", - ] - - deps = [ - "//dart/runtime:libdart_jit", - "//flutter/fml", - "//lib/txt/libs/minikin", - "//lib/txt", - "//third_party/icu:icuuc", - "//third_party/skia", - ] -} diff --git a/engine/src/flutter/third_party/txt/examples/main.cc b/engine/src/flutter/third_party/txt/examples/main.cc deleted file mode 100644 index a4b52da6cb..0000000000 --- a/engine/src/flutter/third_party/txt/examples/main.cc +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include -#include -#include - -#include "flutter/fml/icu_util.h" -#include "lib/txt/src/paragraph_builder.h" - -namespace txt { - -int runTest() { - const char* utf8_text = - "fine world that we live in is called Earth. It's pretty nice, as far as " - "I can tell. Rock, rock on. " - "\xe0\xa4\xa8\xe0\xa4\xae\xe0\xa4\xb8\xe0\xa5\x8d\xe0\xa4\xa4\xe0\xa5" - "\x87"; - icu::UnicodeString icu_text = icu::UnicodeString::fromUTF8(utf8_text); - std::u16string u16_text(icu_text.getBuffer(), - icu_text.getBuffer() + icu_text.length()); - - ParagraphStyle paragraph_style; - ParagraphBuilder builder(paragraph_style); - TextStyle style; - style.color = SK_ColorBLUE; - style.font_size = 32.0; - builder.PushStyle(style); - builder.AddText(u16_text); - style.color = SK_ColorYELLOW; - builder.PushStyle(style); - builder.AddText(u16_text); - builder.Pop(); - builder.AddText(u16_text); - builder.Pop(); - auto paragraph = builder.Build(); - - int width = 800; - int height = 600; - paragraph->Layout(width); - - SkAutoGraphics ag; - SkBitmap bitmap; - bitmap.allocN32Pixels(width, height); - SkCanvas canvas(bitmap); - paragraph->Paint(&canvas, 10.0, 200.0); - - SkFILEWStream file("foo.png"); - - return SkEncodeImage(&file, bitmap, SkEncodedImageFormat::kPNG, 100) - ? EXIT_SUCCESS - : EXIT_FAILURE; -} - -} // namespace txt - -int main(int argc, const char** argv) { - fml::icu::InitializeICU(); - return txt::runTest(); -} diff --git a/engine/src/flutter/third_party/txt/libs/minikin/Android.bp b/engine/src/flutter/third_party/txt/libs/minikin/Android.bp deleted file mode 100644 index 71a693ec2c..0000000000 --- a/engine/src/flutter/third_party/txt/libs/minikin/Android.bp +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (C) 2013 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -cc_library_headers { - name: "libminikin-headers-for-tests", - export_include_dirs: ["."], - shared_libs: ["libharfbuzz_ng"], - export_shared_lib_headers: ["libharfbuzz_ng"], -} - -cc_library { - name: "libminikin", - host_supported: true, - srcs: [ - "Hyphenator.cpp", - ], - target: { - android: { - srcs: [ - "CmapCoverage.cpp", - "Emoji.cpp", - "FontCollection.cpp", - "FontFamily.cpp", - "FontLanguage.cpp", - "FontLanguageListCache.cpp", - "FontUtils.cpp", - "GraphemeBreak.cpp", - "HbFontCache.cpp", - "Layout.cpp", - "LayoutUtils.cpp", - "LineBreaker.cpp", - "Measurement.cpp", - "MinikinInternal.cpp", - "MinikinFont.cpp", - "SparseBitSet.cpp", - "WordBreaker.cpp", - ], - shared_libs: [ - "libharfbuzz_ng", - "libft2", - "libz", - "libutils", - ], - // TODO: clean up Minikin so it doesn't need the freetype include - export_shared_lib_headers: ["libft2"], - }, - }, - cppflags: [ - "-Werror", - "-Wall", - "-Wextra", - ], - product_variables: { - debuggable: { - // Enable race detection on eng and userdebug build. - cppflags: ["-DENABLE_RACE_DETECTION"], - }, - }, - shared_libs: [ - "liblog", - "libicuuc", - ], - header_libs: ["libminikin_headers"], - export_header_lib_headers: ["libminikin_headers"], - export_shared_lib_headers: ["libicuuc"], - - clang: true, - sanitize: { - misc_undefined: [ - "signed-integer-overflow", - // b/26432628. - //"unsigned-integer-overflow", - ], - }, -} diff --git a/engine/src/flutter/third_party/txt/libs/minikin/BUILD.gn b/engine/src/flutter/third_party/txt/libs/minikin/BUILD.gn deleted file mode 100644 index f622712d22..0000000000 --- a/engine/src/flutter/third_party/txt/libs/minikin/BUILD.gn +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -config("minikin_config") { - include_dirs = [ "../../include" ] -} - -source_set("minikin") { - defines = [ "WIP_NEEDS_ICU_UPDATE" ] - - sources = [ - "CmapCoverage.cpp", - "Emoji.cpp", - "FontCollection.cpp", - "FontFamily.cpp", - "FontLanguage.cpp", - "FontLanguage.h", - "FontLanguageListCache.cpp", - "FontLanguageListCache.h", - "FontUtils.cpp", - "FontUtils.h", - "GraphemeBreak.cpp", - "HbFontCache.cpp", - "HbFontCache.h", - "Hyphenator.cpp", - "Layout.cpp", - "LayoutUtils.cpp", - "LayoutUtils.h", - "LineBreaker.cpp", - "Measurement.cpp", - "MinikinFont.cpp", - "MinikinInternal.cpp", - "MinikinInternal.h", - "SparseBitSet.cpp", - "WordBreaker.cpp", - ] - - public_configs = [ ":minikin_config" ] - - public_deps = [ - "//lib/txt/shims", - "//third_party/freetype2", - "//third_party/harfbuzz", - "//third_party/icu:icuuc", - ] - - deps = [ - "//third_party/zlib", - ] -} diff --git a/engine/src/flutter/third_party/txt/shims/BUILD.gn b/engine/src/flutter/third_party/txt/shims/BUILD.gn deleted file mode 100644 index 7e1e1f7e0c..0000000000 --- a/engine/src/flutter/third_party/txt/shims/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -config("shims_config") { - include_dirs = [ "." ] -} - -source_set("shims") { - sources = [ - "log/log.h", - "log/log.cc", - "utils/JenkinsHash.cpp", - "utils/JenkinsHash.h", - "utils/LruCache.h", - "utils/TypeHelpers.h", - ] - - public_configs = [ ":shims_config" ] - - public_deps = [ - "//lib/ftl", - ] -} diff --git a/engine/src/flutter/third_party/txt/src/BUILD.gn b/engine/src/flutter/third_party/txt/src/BUILD.gn deleted file mode 100644 index 024820767e..0000000000 --- a/engine/src/flutter/third_party/txt/src/BUILD.gn +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -source_set("src") { - -} diff --git a/engine/src/flutter/third_party/txt/shims/log/log.cc b/engine/src/flutter/third_party/txt/src/log/log.cc similarity index 100% rename from engine/src/flutter/third_party/txt/shims/log/log.cc rename to engine/src/flutter/third_party/txt/src/log/log.cc diff --git a/engine/src/flutter/third_party/txt/shims/log/log.h b/engine/src/flutter/third_party/txt/src/log/log.h similarity index 100% rename from engine/src/flutter/third_party/txt/shims/log/log.h rename to engine/src/flutter/third_party/txt/src/log/log.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/CmapCoverage.cpp b/engine/src/flutter/third_party/txt/src/minikin/CmapCoverage.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/CmapCoverage.cpp rename to engine/src/flutter/third_party/txt/src/minikin/CmapCoverage.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/CmapCoverage.h b/engine/src/flutter/third_party/txt/src/minikin/CmapCoverage.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/CmapCoverage.h rename to engine/src/flutter/third_party/txt/src/minikin/CmapCoverage.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/Emoji.cpp b/engine/src/flutter/third_party/txt/src/minikin/Emoji.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/Emoji.cpp rename to engine/src/flutter/third_party/txt/src/minikin/Emoji.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/Emoji.h b/engine/src/flutter/third_party/txt/src/minikin/Emoji.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/Emoji.h rename to engine/src/flutter/third_party/txt/src/minikin/Emoji.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/FontCollection.cpp b/engine/src/flutter/third_party/txt/src/minikin/FontCollection.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/FontCollection.cpp rename to engine/src/flutter/third_party/txt/src/minikin/FontCollection.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/FontCollection.h b/engine/src/flutter/third_party/txt/src/minikin/FontCollection.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/FontCollection.h rename to engine/src/flutter/third_party/txt/src/minikin/FontCollection.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/FontFamily.cpp b/engine/src/flutter/third_party/txt/src/minikin/FontFamily.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/FontFamily.cpp rename to engine/src/flutter/third_party/txt/src/minikin/FontFamily.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/FontFamily.h b/engine/src/flutter/third_party/txt/src/minikin/FontFamily.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/FontFamily.h rename to engine/src/flutter/third_party/txt/src/minikin/FontFamily.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/FontLanguage.cpp b/engine/src/flutter/third_party/txt/src/minikin/FontLanguage.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/FontLanguage.cpp rename to engine/src/flutter/third_party/txt/src/minikin/FontLanguage.cpp diff --git a/engine/src/flutter/third_party/txt/libs/minikin/FontLanguage.h b/engine/src/flutter/third_party/txt/src/minikin/FontLanguage.h similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/FontLanguage.h rename to engine/src/flutter/third_party/txt/src/minikin/FontLanguage.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/FontLanguageListCache.cpp b/engine/src/flutter/third_party/txt/src/minikin/FontLanguageListCache.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/FontLanguageListCache.cpp rename to engine/src/flutter/third_party/txt/src/minikin/FontLanguageListCache.cpp diff --git a/engine/src/flutter/third_party/txt/libs/minikin/FontLanguageListCache.h b/engine/src/flutter/third_party/txt/src/minikin/FontLanguageListCache.h similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/FontLanguageListCache.h rename to engine/src/flutter/third_party/txt/src/minikin/FontLanguageListCache.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/FontUtils.cpp b/engine/src/flutter/third_party/txt/src/minikin/FontUtils.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/FontUtils.cpp rename to engine/src/flutter/third_party/txt/src/minikin/FontUtils.cpp diff --git a/engine/src/flutter/third_party/txt/libs/minikin/FontUtils.h b/engine/src/flutter/third_party/txt/src/minikin/FontUtils.h similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/FontUtils.h rename to engine/src/flutter/third_party/txt/src/minikin/FontUtils.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/GraphemeBreak.cpp b/engine/src/flutter/third_party/txt/src/minikin/GraphemeBreak.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/GraphemeBreak.cpp rename to engine/src/flutter/third_party/txt/src/minikin/GraphemeBreak.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/GraphemeBreak.h b/engine/src/flutter/third_party/txt/src/minikin/GraphemeBreak.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/GraphemeBreak.h rename to engine/src/flutter/third_party/txt/src/minikin/GraphemeBreak.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/HbFontCache.cpp b/engine/src/flutter/third_party/txt/src/minikin/HbFontCache.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/HbFontCache.cpp rename to engine/src/flutter/third_party/txt/src/minikin/HbFontCache.cpp diff --git a/engine/src/flutter/third_party/txt/libs/minikin/HbFontCache.h b/engine/src/flutter/third_party/txt/src/minikin/HbFontCache.h similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/HbFontCache.h rename to engine/src/flutter/third_party/txt/src/minikin/HbFontCache.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/Hyphenator.cpp b/engine/src/flutter/third_party/txt/src/minikin/Hyphenator.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/Hyphenator.cpp rename to engine/src/flutter/third_party/txt/src/minikin/Hyphenator.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/Hyphenator.h b/engine/src/flutter/third_party/txt/src/minikin/Hyphenator.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/Hyphenator.h rename to engine/src/flutter/third_party/txt/src/minikin/Hyphenator.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/Layout.cpp b/engine/src/flutter/third_party/txt/src/minikin/Layout.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/Layout.cpp rename to engine/src/flutter/third_party/txt/src/minikin/Layout.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/Layout.h b/engine/src/flutter/third_party/txt/src/minikin/Layout.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/Layout.h rename to engine/src/flutter/third_party/txt/src/minikin/Layout.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/LayoutUtils.cpp b/engine/src/flutter/third_party/txt/src/minikin/LayoutUtils.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/LayoutUtils.cpp rename to engine/src/flutter/third_party/txt/src/minikin/LayoutUtils.cpp diff --git a/engine/src/flutter/third_party/txt/libs/minikin/LayoutUtils.h b/engine/src/flutter/third_party/txt/src/minikin/LayoutUtils.h similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/LayoutUtils.h rename to engine/src/flutter/third_party/txt/src/minikin/LayoutUtils.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/LineBreaker.cpp b/engine/src/flutter/third_party/txt/src/minikin/LineBreaker.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/LineBreaker.cpp rename to engine/src/flutter/third_party/txt/src/minikin/LineBreaker.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/LineBreaker.h b/engine/src/flutter/third_party/txt/src/minikin/LineBreaker.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/LineBreaker.h rename to engine/src/flutter/third_party/txt/src/minikin/LineBreaker.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/Measurement.cpp b/engine/src/flutter/third_party/txt/src/minikin/Measurement.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/Measurement.cpp rename to engine/src/flutter/third_party/txt/src/minikin/Measurement.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/Measurement.h b/engine/src/flutter/third_party/txt/src/minikin/Measurement.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/Measurement.h rename to engine/src/flutter/third_party/txt/src/minikin/Measurement.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/MinikinFont.cpp b/engine/src/flutter/third_party/txt/src/minikin/MinikinFont.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/MinikinFont.cpp rename to engine/src/flutter/third_party/txt/src/minikin/MinikinFont.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/MinikinFont.h b/engine/src/flutter/third_party/txt/src/minikin/MinikinFont.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/MinikinFont.h rename to engine/src/flutter/third_party/txt/src/minikin/MinikinFont.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/MinikinInternal.cpp b/engine/src/flutter/third_party/txt/src/minikin/MinikinInternal.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/MinikinInternal.cpp rename to engine/src/flutter/third_party/txt/src/minikin/MinikinInternal.cpp diff --git a/engine/src/flutter/third_party/txt/libs/minikin/MinikinInternal.h b/engine/src/flutter/third_party/txt/src/minikin/MinikinInternal.h similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/MinikinInternal.h rename to engine/src/flutter/third_party/txt/src/minikin/MinikinInternal.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/SparseBitSet.cpp b/engine/src/flutter/third_party/txt/src/minikin/SparseBitSet.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/SparseBitSet.cpp rename to engine/src/flutter/third_party/txt/src/minikin/SparseBitSet.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/SparseBitSet.h b/engine/src/flutter/third_party/txt/src/minikin/SparseBitSet.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/SparseBitSet.h rename to engine/src/flutter/third_party/txt/src/minikin/SparseBitSet.h diff --git a/engine/src/flutter/third_party/txt/libs/minikin/WordBreaker.cpp b/engine/src/flutter/third_party/txt/src/minikin/WordBreaker.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/libs/minikin/WordBreaker.cpp rename to engine/src/flutter/third_party/txt/src/minikin/WordBreaker.cpp diff --git a/engine/src/flutter/third_party/txt/include/minikin/WordBreaker.h b/engine/src/flutter/third_party/txt/src/minikin/WordBreaker.h similarity index 100% rename from engine/src/flutter/third_party/txt/include/minikin/WordBreaker.h rename to engine/src/flutter/third_party/txt/src/minikin/WordBreaker.h diff --git a/engine/src/flutter/third_party/txt/src/font_collection.cc b/engine/src/flutter/third_party/txt/src/txt/font_collection.cc similarity index 99% rename from engine/src/flutter/third_party/txt/src/font_collection.cc rename to engine/src/flutter/third_party/txt/src/txt/font_collection.cc index 33e45537a7..c6ee8283ff 100644 --- a/engine/src/flutter/third_party/txt/src/font_collection.cc +++ b/engine/src/flutter/third_party/txt/src/txt/font_collection.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "lib/txt/src/font_collection.h" +#include "font_collection.h" #include #include @@ -24,8 +24,8 @@ #include #include +#include "font_skia.h" #include "lib/ftl/logging.h" -#include "lib/txt/src/font_skia.h" #include "third_party/skia/include/core/SkString.h" #include "third_party/skia/include/ports/SkFontMgr.h" #include "third_party/skia/include/ports/SkFontMgr_android.h" diff --git a/engine/src/flutter/third_party/txt/src/font_collection.h b/engine/src/flutter/third_party/txt/src/txt/font_collection.h similarity index 100% rename from engine/src/flutter/third_party/txt/src/font_collection.h rename to engine/src/flutter/third_party/txt/src/txt/font_collection.h diff --git a/engine/src/flutter/third_party/txt/src/font_skia.cc b/engine/src/flutter/third_party/txt/src/txt/font_skia.cc similarity index 98% rename from engine/src/flutter/third_party/txt/src/font_skia.cc rename to engine/src/flutter/third_party/txt/src/txt/font_skia.cc index c6b3bc8d8f..5290bdbe42 100644 --- a/engine/src/flutter/third_party/txt/src/font_skia.cc +++ b/engine/src/flutter/third_party/txt/src/txt/font_skia.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "lib/txt/src/font_skia.h" +#include "font_skia.h" #include diff --git a/engine/src/flutter/third_party/txt/src/font_skia.h b/engine/src/flutter/third_party/txt/src/txt/font_skia.h similarity index 100% rename from engine/src/flutter/third_party/txt/src/font_skia.h rename to engine/src/flutter/third_party/txt/src/txt/font_skia.h diff --git a/engine/src/flutter/third_party/txt/src/font_style.h b/engine/src/flutter/third_party/txt/src/txt/font_style.h similarity index 100% rename from engine/src/flutter/third_party/txt/src/font_style.h rename to engine/src/flutter/third_party/txt/src/txt/font_style.h diff --git a/engine/src/flutter/third_party/txt/src/font_weight.h b/engine/src/flutter/third_party/txt/src/txt/font_weight.h similarity index 100% rename from engine/src/flutter/third_party/txt/src/font_weight.h rename to engine/src/flutter/third_party/txt/src/txt/font_weight.h diff --git a/engine/src/flutter/third_party/txt/src/paint_record.cc b/engine/src/flutter/third_party/txt/src/txt/paint_record.cc similarity index 98% rename from engine/src/flutter/third_party/txt/src/paint_record.cc rename to engine/src/flutter/third_party/txt/src/txt/paint_record.cc index 3291d6ec99..454767e31d 100644 --- a/engine/src/flutter/third_party/txt/src/paint_record.cc +++ b/engine/src/flutter/third_party/txt/src/txt/paint_record.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "lib/txt/src/paint_record.h" +#include "paint_record.h" #include "lib/ftl/logging.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/src/paint_record.h b/engine/src/flutter/third_party/txt/src/txt/paint_record.h similarity index 98% rename from engine/src/flutter/third_party/txt/src/paint_record.h rename to engine/src/flutter/third_party/txt/src/txt/paint_record.h index 09e1b46523..b77e7fd30c 100644 --- a/engine/src/flutter/third_party/txt/src/paint_record.h +++ b/engine/src/flutter/third_party/txt/src/txt/paint_record.h @@ -19,7 +19,7 @@ #include "lib/ftl/logging.h" #include "lib/ftl/macros.h" -#include "lib/txt/src/text_style.h" +#include "text_style.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkTextBlob.h" diff --git a/engine/src/flutter/third_party/txt/src/paragraph.cc b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc similarity index 99% rename from engine/src/flutter/third_party/txt/src/paragraph.cc rename to engine/src/flutter/third_party/txt/src/txt/paragraph.cc index d7031df9fc..25d1f05eb3 100644 --- a/engine/src/flutter/third_party/txt/src/paragraph.cc +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "lib/txt/src/paragraph.h" +#include "paragraph.h" #include #include @@ -24,13 +24,13 @@ #include #include +#include "font_collection.h" +#include "font_skia.h" #include "lib/ftl/logging.h" -#include "lib/txt/include/minikin/MinikinFont.h" -#include "lib/txt/libs/minikin/HbFontCache.h" -#include "lib/txt/libs/minikin/LayoutUtils.h" -#include "lib/txt/src/font_collection.h" -#include "lib/txt/src/font_skia.h" +#include "minikin/HbFontCache.h" +#include "minikin/LayoutUtils.h" #include "minikin/LineBreaker.h" +#include "minikin/MinikinFont.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkTextBlob.h" diff --git a/engine/src/flutter/third_party/txt/src/paragraph.h b/engine/src/flutter/third_party/txt/src/txt/paragraph.h similarity index 98% rename from engine/src/flutter/third_party/txt/src/paragraph.h rename to engine/src/flutter/third_party/txt/src/txt/paragraph.h index 8b4936bac7..526417e948 100644 --- a/engine/src/flutter/third_party/txt/src/paragraph.h +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph.h @@ -20,12 +20,12 @@ #include #include +#include "font_collection.h" #include "lib/ftl/macros.h" -#include "lib/txt/src/font_collection.h" -#include "lib/txt/src/paint_record.h" -#include "lib/txt/src/paragraph_style.h" -#include "lib/txt/src/styled_runs.h" #include "minikin/LineBreaker.h" +#include "paint_record.h" +#include "paragraph_style.h" +#include "styled_runs.h" #include "third_party/gtest/include/gtest/gtest_prod.h" #include "third_party/skia/include/core/SkPoint.h" #include "third_party/skia/include/core/SkRect.h" diff --git a/engine/src/flutter/third_party/txt/src/paragraph_builder.cc b/engine/src/flutter/third_party/txt/src/txt/paragraph_builder.cc similarity index 97% rename from engine/src/flutter/third_party/txt/src/paragraph_builder.cc rename to engine/src/flutter/third_party/txt/src/txt/paragraph_builder.cc index 964a202211..b3f1e0df0d 100644 --- a/engine/src/flutter/third_party/txt/src/paragraph_builder.cc +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph_builder.cc @@ -17,8 +17,8 @@ #include -#include "lib/txt/src/paragraph_builder.h" -#include "lib/txt/src/paragraph_style.h" +#include "paragraph_builder.h" +#include "paragraph_style.h" #include "third_party/icu/source/common/unicode/unistr.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/src/paragraph_builder.h b/engine/src/flutter/third_party/txt/src/txt/paragraph_builder.h similarity index 93% rename from engine/src/flutter/third_party/txt/src/paragraph_builder.h rename to engine/src/flutter/third_party/txt/src/txt/paragraph_builder.h index 8290850683..fddb3cb642 100644 --- a/engine/src/flutter/third_party/txt/src/paragraph_builder.h +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph_builder.h @@ -20,12 +20,12 @@ #include #include +#include "font_collection.h" #include "lib/ftl/macros.h" -#include "lib/txt/src/font_collection.h" -#include "lib/txt/src/paragraph.h" -#include "lib/txt/src/paragraph_style.h" -#include "lib/txt/src/styled_runs.h" -#include "lib/txt/src/text_style.h" +#include "paragraph.h" +#include "paragraph_style.h" +#include "styled_runs.h" +#include "text_style.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/src/paragraph_style.cc b/engine/src/flutter/third_party/txt/src/txt/paragraph_style.cc similarity index 89% rename from engine/src/flutter/third_party/txt/src/paragraph_style.cc rename to engine/src/flutter/third_party/txt/src/txt/paragraph_style.cc index a55c3a37b2..03d072679d 100644 --- a/engine/src/flutter/third_party/txt/src/paragraph_style.cc +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph_style.cc @@ -14,4 +14,10 @@ * limitations under the License. */ -#include "lib/txt/src/paragraph_style.h" +#include "paragraph_style.h" + +namespace txt { + +// + +} // namespace txt diff --git a/engine/src/flutter/third_party/txt/src/paragraph_style.h b/engine/src/flutter/third_party/txt/src/txt/paragraph_style.h similarity index 90% rename from engine/src/flutter/third_party/txt/src/paragraph_style.h rename to engine/src/flutter/third_party/txt/src/txt/paragraph_style.h index 9c299c594b..634e05b9a8 100644 --- a/engine/src/flutter/third_party/txt/src/paragraph_style.h +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph_style.h @@ -20,10 +20,10 @@ #include #include -#include "lib/txt/include/minikin/LineBreaker.h" -#include "lib/txt/src/font_style.h" -#include "lib/txt/src/font_weight.h" -#include "lib/txt/src/text_align.h" +#include "font_style.h" +#include "font_weight.h" +#include "minikin/LineBreaker.h" +#include "text_align.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/src/styled_runs.cc b/engine/src/flutter/third_party/txt/src/txt/styled_runs.cc similarity index 98% rename from engine/src/flutter/third_party/txt/src/styled_runs.cc rename to engine/src/flutter/third_party/txt/src/txt/styled_runs.cc index 67e7ec1eb2..4bc38beee2 100644 --- a/engine/src/flutter/third_party/txt/src/styled_runs.cc +++ b/engine/src/flutter/third_party/txt/src/txt/styled_runs.cc @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "lib/txt/src/styled_runs.h" +#include "styled_runs.h" #include "lib/ftl/logging.h" diff --git a/engine/src/flutter/third_party/txt/src/styled_runs.h b/engine/src/flutter/third_party/txt/src/txt/styled_runs.h similarity index 98% rename from engine/src/flutter/third_party/txt/src/styled_runs.h rename to engine/src/flutter/third_party/txt/src/txt/styled_runs.h index 94931989fd..d6984defa5 100644 --- a/engine/src/flutter/third_party/txt/src/styled_runs.h +++ b/engine/src/flutter/third_party/txt/src/txt/styled_runs.h @@ -20,7 +20,7 @@ #include #include -#include "lib/txt/src/text_style.h" +#include "text_style.h" #include "third_party/gtest/include/gtest/gtest_prod.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/src/text_align.h b/engine/src/flutter/third_party/txt/src/txt/text_align.h similarity index 100% rename from engine/src/flutter/third_party/txt/src/text_align.h rename to engine/src/flutter/third_party/txt/src/txt/text_align.h diff --git a/engine/src/flutter/third_party/txt/src/text_baseline.h b/engine/src/flutter/third_party/txt/src/txt/text_baseline.h similarity index 100% rename from engine/src/flutter/third_party/txt/src/text_baseline.h rename to engine/src/flutter/third_party/txt/src/txt/text_baseline.h diff --git a/engine/src/flutter/third_party/txt/src/text_decoration.cc b/engine/src/flutter/third_party/txt/src/txt/text_decoration.cc similarity index 89% rename from engine/src/flutter/third_party/txt/src/text_decoration.cc rename to engine/src/flutter/third_party/txt/src/txt/text_decoration.cc index 28804c144f..95b8a8b8e8 100644 --- a/engine/src/flutter/third_party/txt/src/text_decoration.cc +++ b/engine/src/flutter/third_party/txt/src/txt/text_decoration.cc @@ -17,6 +17,10 @@ #include #include -#include "lib/txt/src/text_decoration.h" +#include "text_decoration.h" -namespace txt {} // namespace txt +namespace txt { + +// + +} // namespace txt diff --git a/engine/src/flutter/third_party/txt/src/text_decoration.h b/engine/src/flutter/third_party/txt/src/txt/text_decoration.h similarity index 95% rename from engine/src/flutter/third_party/txt/src/text_decoration.h rename to engine/src/flutter/third_party/txt/src/txt/text_decoration.h index 055cf4b579..b77af0e52c 100644 --- a/engine/src/flutter/third_party/txt/src/text_decoration.h +++ b/engine/src/flutter/third_party/txt/src/txt/text_decoration.h @@ -32,4 +32,4 @@ enum TextDecorationStyle { kSolid, kDouble, kDotted, kDashed, kWavy }; } // namespace txt -#endif // LIB_TXT_SRC_TEXT_DECORATION_H_ \ No newline at end of file +#endif // LIB_TXT_SRC_TEXT_DECORATION_H_ diff --git a/engine/src/flutter/third_party/txt/src/text_style.cc b/engine/src/flutter/third_party/txt/src/txt/text_style.cc similarity index 92% rename from engine/src/flutter/third_party/txt/src/text_style.cc rename to engine/src/flutter/third_party/txt/src/txt/text_style.cc index c902dcd1ac..d8d18f9678 100644 --- a/engine/src/flutter/third_party/txt/src/text_style.cc +++ b/engine/src/flutter/third_party/txt/src/txt/text_style.cc @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "lib/txt/src/text_style.h" -#include "lib/txt/src/font_style.h" -#include "lib/txt/src/font_weight.h" +#include "text_style.h" +#include "font_style.h" +#include "font_weight.h" #include "third_party/skia/include/core/SkColor.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/src/text_style.h b/engine/src/flutter/third_party/txt/src/txt/text_style.h similarity index 91% rename from engine/src/flutter/third_party/txt/src/text_style.h rename to engine/src/flutter/third_party/txt/src/txt/text_style.h index 74c112d60a..39fdd700fc 100644 --- a/engine/src/flutter/third_party/txt/src/text_style.h +++ b/engine/src/flutter/third_party/txt/src/txt/text_style.h @@ -19,10 +19,10 @@ #include -#include "lib/txt/src/font_style.h" -#include "lib/txt/src/font_weight.h" -#include "lib/txt/src/text_baseline.h" -#include "lib/txt/src/text_decoration.h" +#include "font_style.h" +#include "font_weight.h" +#include "text_baseline.h" +#include "text_decoration.h" #include "third_party/skia/include/core/SkColor.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/shims/utils/JenkinsHash.cpp b/engine/src/flutter/third_party/txt/src/utils/JenkinsHash.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/shims/utils/JenkinsHash.cpp rename to engine/src/flutter/third_party/txt/src/utils/JenkinsHash.cpp diff --git a/engine/src/flutter/third_party/txt/shims/utils/JenkinsHash.h b/engine/src/flutter/third_party/txt/src/utils/JenkinsHash.h similarity index 100% rename from engine/src/flutter/third_party/txt/shims/utils/JenkinsHash.h rename to engine/src/flutter/third_party/txt/src/utils/JenkinsHash.h diff --git a/engine/src/flutter/third_party/txt/shims/utils/LruCache.h b/engine/src/flutter/third_party/txt/src/utils/LruCache.h similarity index 100% rename from engine/src/flutter/third_party/txt/shims/utils/LruCache.h rename to engine/src/flutter/third_party/txt/src/utils/LruCache.h diff --git a/engine/src/flutter/third_party/txt/shims/utils/TypeHelpers.h b/engine/src/flutter/third_party/txt/src/utils/TypeHelpers.h similarity index 100% rename from engine/src/flutter/third_party/txt/shims/utils/TypeHelpers.h rename to engine/src/flutter/third_party/txt/src/utils/TypeHelpers.h diff --git a/engine/src/flutter/third_party/txt/tests/Android.bp b/engine/src/flutter/third_party/txt/tests/Android.bp deleted file mode 100644 index ddc5012511..0000000000 --- a/engine/src/flutter/third_party/txt/tests/Android.bp +++ /dev/null @@ -1,33 +0,0 @@ -filegroup { - name: "minikin-test-data", - srcs: [ - "data/Bold.ttf", - "data/BoldItalic.ttf", - "data/ColorEmojiFont.ttf", - "data/ColorTextMixedEmojiFont.ttf", - "data/Emoji.ttf", - "data/Italic.ttf", - "data/Ja.ttf", - "data/Ko.ttf", - "data/MultiAxis.ttf", - "data/NoCmapFormat14.ttf", - "data/NoGlyphFont.ttf", - "data/Regular.ttf", - "data/TextEmojiFont.ttf", - "data/UnicodeBMPOnly.ttf", - "data/UnicodeBMPOnly2.ttf", - "data/UnicodeUCS4.ttf", - "data/VariationSelectorTest-Regular.ttf", - "data/ZhHans.ttf", - "data/ZhHant.ttf", - "data/emoji.xml", - "data/itemize.xml", - ], -} - -subdirs = [ - "perftests", - "stresstest", - "unittest", - "util", -] diff --git a/engine/src/flutter/third_party/txt/tests/BUILD.gn b/engine/src/flutter/third_party/txt/tests/BUILD.gn deleted file mode 100644 index 98defad50b..0000000000 --- a/engine/src/flutter/third_party/txt/tests/BUILD.gn +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2017 Google, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -group("tests") { - testonly = true - - deps = [ - "txt", - "unittest", - ] -} \ No newline at end of file diff --git a/engine/src/flutter/third_party/txt/tests/txt/font_collection_unittests.cc b/engine/src/flutter/third_party/txt/tests/font_collection_unittests.cc similarity index 98% rename from engine/src/flutter/third_party/txt/tests/txt/font_collection_unittests.cc rename to engine/src/flutter/third_party/txt/tests/font_collection_unittests.cc index 7f98cccb30..969181fbc6 100644 --- a/engine/src/flutter/third_party/txt/tests/txt/font_collection_unittests.cc +++ b/engine/src/flutter/third_party/txt/tests/font_collection_unittests.cc @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "font_collection.h" #include "gtest/gtest.h" #include "lib/ftl/command_line.h" #include "lib/ftl/logging.h" -#include "lib/txt/tests/txt/utils.h" +#include "txt/font_collection.h" +#include "utils.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/tests/perftests/FontCollection.cpp b/engine/src/flutter/third_party/txt/tests/old/perftests/FontCollection.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/perftests/FontCollection.cpp rename to engine/src/flutter/third_party/txt/tests/old/perftests/FontCollection.cpp diff --git a/engine/src/flutter/third_party/txt/tests/perftests/FontFamily.cpp b/engine/src/flutter/third_party/txt/tests/old/perftests/FontFamily.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/perftests/FontFamily.cpp rename to engine/src/flutter/third_party/txt/tests/old/perftests/FontFamily.cpp diff --git a/engine/src/flutter/third_party/txt/tests/perftests/FontLanguage.cpp b/engine/src/flutter/third_party/txt/tests/old/perftests/FontLanguage.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/perftests/FontLanguage.cpp rename to engine/src/flutter/third_party/txt/tests/old/perftests/FontLanguage.cpp diff --git a/engine/src/flutter/third_party/txt/tests/perftests/GraphemeBreak.cpp b/engine/src/flutter/third_party/txt/tests/old/perftests/GraphemeBreak.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/perftests/GraphemeBreak.cpp rename to engine/src/flutter/third_party/txt/tests/old/perftests/GraphemeBreak.cpp diff --git a/engine/src/flutter/third_party/txt/tests/perftests/Hyphenator.cpp b/engine/src/flutter/third_party/txt/tests/old/perftests/Hyphenator.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/perftests/Hyphenator.cpp rename to engine/src/flutter/third_party/txt/tests/old/perftests/Hyphenator.cpp diff --git a/engine/src/flutter/third_party/txt/tests/perftests/WordBreaker.cpp b/engine/src/flutter/third_party/txt/tests/old/perftests/WordBreaker.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/perftests/WordBreaker.cpp rename to engine/src/flutter/third_party/txt/tests/old/perftests/WordBreaker.cpp diff --git a/engine/src/flutter/third_party/txt/tests/perftests/main.cpp b/engine/src/flutter/third_party/txt/tests/old/perftests/main.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/perftests/main.cpp rename to engine/src/flutter/third_party/txt/tests/old/perftests/main.cpp diff --git a/engine/src/flutter/third_party/txt/tests/stresstest/MultithreadTest.cpp b/engine/src/flutter/third_party/txt/tests/old/stresstest/MultithreadTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/stresstest/MultithreadTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/stresstest/MultithreadTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/CmapCoverageTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/CmapCoverageTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/CmapCoverageTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/CmapCoverageTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/EmojiTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/EmojiTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/EmojiTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/EmojiTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/FontCollectionItemizeTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/FontCollectionItemizeTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/FontCollectionItemizeTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/FontCollectionItemizeTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/FontCollectionTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/FontCollectionTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/FontCollectionTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/FontCollectionTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/FontFamilyTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/FontFamilyTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/FontFamilyTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/FontFamilyTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/FontLanguageListCacheTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/FontLanguageListCacheTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/FontLanguageListCacheTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/FontLanguageListCacheTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/GraphemeBreakTests.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/GraphemeBreakTests.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/GraphemeBreakTests.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/GraphemeBreakTests.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/HbFontCacheTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/HbFontCacheTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/HbFontCacheTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/HbFontCacheTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/HyphenatorTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/HyphenatorTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/HyphenatorTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/HyphenatorTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/ICUTestBase.h b/engine/src/flutter/third_party/txt/tests/old/unittest/ICUTestBase.h similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/ICUTestBase.h rename to engine/src/flutter/third_party/txt/tests/old/unittest/ICUTestBase.h diff --git a/engine/src/flutter/third_party/txt/tests/unittest/LayoutTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/LayoutTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/LayoutTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/LayoutTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/LayoutUtilsTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/LayoutUtilsTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/LayoutUtilsTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/LayoutUtilsTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/MeasurementTests.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/MeasurementTests.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/MeasurementTests.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/MeasurementTests.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/SparseBitSetTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/SparseBitSetTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/SparseBitSetTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/SparseBitSetTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/UnicodeUtilsTest.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/UnicodeUtilsTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/UnicodeUtilsTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/UnicodeUtilsTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/unittest/WordBreakerTests.cpp b/engine/src/flutter/third_party/txt/tests/old/unittest/WordBreakerTests.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/unittest/WordBreakerTests.cpp rename to engine/src/flutter/third_party/txt/tests/old/unittest/WordBreakerTests.cpp diff --git a/engine/src/flutter/third_party/txt/tests/util/FileUtils.cpp b/engine/src/flutter/third_party/txt/tests/old/util/FileUtils.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/util/FileUtils.cpp rename to engine/src/flutter/third_party/txt/tests/old/util/FileUtils.cpp diff --git a/engine/src/flutter/third_party/txt/tests/util/FileUtils.h b/engine/src/flutter/third_party/txt/tests/old/util/FileUtils.h similarity index 100% rename from engine/src/flutter/third_party/txt/tests/util/FileUtils.h rename to engine/src/flutter/third_party/txt/tests/old/util/FileUtils.h diff --git a/engine/src/flutter/third_party/txt/tests/util/FontTestUtils.cpp b/engine/src/flutter/third_party/txt/tests/old/util/FontTestUtils.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/util/FontTestUtils.cpp rename to engine/src/flutter/third_party/txt/tests/old/util/FontTestUtils.cpp diff --git a/engine/src/flutter/third_party/txt/tests/util/FontTestUtils.h b/engine/src/flutter/third_party/txt/tests/old/util/FontTestUtils.h similarity index 100% rename from engine/src/flutter/third_party/txt/tests/util/FontTestUtils.h rename to engine/src/flutter/third_party/txt/tests/old/util/FontTestUtils.h diff --git a/engine/src/flutter/third_party/txt/tests/util/MinikinFontForTest.cpp b/engine/src/flutter/third_party/txt/tests/old/util/MinikinFontForTest.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/util/MinikinFontForTest.cpp rename to engine/src/flutter/third_party/txt/tests/old/util/MinikinFontForTest.cpp diff --git a/engine/src/flutter/third_party/txt/tests/util/MinikinFontForTest.h b/engine/src/flutter/third_party/txt/tests/old/util/MinikinFontForTest.h similarity index 100% rename from engine/src/flutter/third_party/txt/tests/util/MinikinFontForTest.h rename to engine/src/flutter/third_party/txt/tests/old/util/MinikinFontForTest.h diff --git a/engine/src/flutter/third_party/txt/tests/util/UnicodeUtils.cpp b/engine/src/flutter/third_party/txt/tests/old/util/UnicodeUtils.cpp similarity index 100% rename from engine/src/flutter/third_party/txt/tests/util/UnicodeUtils.cpp rename to engine/src/flutter/third_party/txt/tests/old/util/UnicodeUtils.cpp diff --git a/engine/src/flutter/third_party/txt/tests/util/UnicodeUtils.h b/engine/src/flutter/third_party/txt/tests/old/util/UnicodeUtils.h similarity index 100% rename from engine/src/flutter/third_party/txt/tests/util/UnicodeUtils.h rename to engine/src/flutter/third_party/txt/tests/old/util/UnicodeUtils.h diff --git a/engine/src/flutter/third_party/txt/tests/txt/paragraph_unittests.cc b/engine/src/flutter/third_party/txt/tests/paragraph_unittests.cc similarity index 99% rename from engine/src/flutter/third_party/txt/tests/txt/paragraph_unittests.cc rename to engine/src/flutter/third_party/txt/tests/paragraph_unittests.cc index 6120f5c1f3..83998811db 100644 --- a/engine/src/flutter/third_party/txt/tests/txt/paragraph_unittests.cc +++ b/engine/src/flutter/third_party/txt/tests/paragraph_unittests.cc @@ -15,15 +15,15 @@ */ #include "lib/ftl/logging.h" -#include "lib/txt/src/font_style.h" -#include "lib/txt/src/font_weight.h" -#include "lib/txt/src/paragraph.h" -#include "lib/txt/src/text_align.h" -#include "lib/txt/tests/txt/utils.h" -#include "paragraph_builder.h" #include "render_test.h" #include "third_party/icu/source/common/unicode/unistr.h" #include "third_party/skia/include/core/SkColor.h" +#include "txt/font_style.h" +#include "txt/font_weight.h" +#include "txt/paragraph.h" +#include "txt/paragraph_builder.h" +#include "txt/text_align.h" +#include "utils.h" namespace txt { diff --git a/engine/src/flutter/third_party/txt/tests/perftests/Android.bp b/engine/src/flutter/third_party/txt/tests/perftests/Android.bp deleted file mode 100644 index f8847ac4cb..0000000000 --- a/engine/src/flutter/third_party/txt/tests/perftests/Android.bp +++ /dev/null @@ -1,49 +0,0 @@ -// -// Copyright (C) 2016 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -cc_benchmark { - name: "minikin_perftests", - test_suites: ["device-tests"], - cppflags: [ - "-Werror", - "-Wall", - "-Wextra", - ], - srcs: [ - "FontCollection.cpp", - "FontFamily.cpp", - "FontLanguage.cpp", - "GraphemeBreak.cpp", - "Hyphenator.cpp", - "WordBreaker.cpp", - "main.cpp", - ], - - header_libs: ["libminikin-headers-for-tests"], - - static_libs: [ - "libminikin-tests-util", - "libminikin", - "libxml2", - ], - - shared_libs: [ - "libharfbuzz_ng", - "libicuuc", - "liblog", - "libskia", - ], -} diff --git a/engine/src/flutter/third_party/txt/tests/perftests/AndroidTest.xml b/engine/src/flutter/third_party/txt/tests/perftests/AndroidTest.xml deleted file mode 100644 index dcbdcf11ce..0000000000 --- a/engine/src/flutter/third_party/txt/tests/perftests/AndroidTest.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - diff --git a/engine/src/flutter/third_party/txt/tests/perftests/how_to_run.txt b/engine/src/flutter/third_party/txt/tests/perftests/how_to_run.txt deleted file mode 100644 index f55a8ac4ef..0000000000 --- a/engine/src/flutter/third_party/txt/tests/perftests/how_to_run.txt +++ /dev/null @@ -1,3 +0,0 @@ -mmm -j8 frameworks/minikin/tests/perftests && -adb sync data && -adb shell /data/benchmarktest/minikin_perftests/minikin_perftests diff --git a/engine/src/flutter/third_party/txt/tests/txt/render_test.cc b/engine/src/flutter/third_party/txt/tests/render_test.cc similarity index 100% rename from engine/src/flutter/third_party/txt/tests/txt/render_test.cc rename to engine/src/flutter/third_party/txt/tests/render_test.cc diff --git a/engine/src/flutter/third_party/txt/tests/txt/render_test.h b/engine/src/flutter/third_party/txt/tests/render_test.h similarity index 100% rename from engine/src/flutter/third_party/txt/tests/txt/render_test.h rename to engine/src/flutter/third_party/txt/tests/render_test.h diff --git a/engine/src/flutter/third_party/txt/tests/stresstest/Android.bp b/engine/src/flutter/third_party/txt/tests/stresstest/Android.bp deleted file mode 100644 index 96a23dcfb7..0000000000 --- a/engine/src/flutter/third_party/txt/tests/stresstest/Android.bp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2017 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// see how_to_run.txt for instructions on running these tests - -cc_test { - name: "minikin_stress_tests", - - header_libs: ["libminikin-headers-for-tests"], - - static_libs: [ - "libminikin-tests-util", - "libminikin", - "libxml2", - ], - - // Shared libraries which are dependencies of minikin; these are not automatically - // pulled in by the build system (and thus sadly must be repeated). - shared_libs: [ - "libskia", - "libft2", - "libharfbuzz_ng", - "libicuuc", - "liblog", - "libutils", - "libz", - ], - - srcs: [ - "MultithreadTest.cpp", - ], - - cppflags: [ - "-Werror", - "-Wall", - "-Wextra", - ], -} diff --git a/engine/src/flutter/third_party/txt/tests/stresstest/how_to_run.txt b/engine/src/flutter/third_party/txt/tests/stresstest/how_to_run.txt deleted file mode 100644 index ba4dbdf1f7..0000000000 --- a/engine/src/flutter/third_party/txt/tests/stresstest/how_to_run.txt +++ /dev/null @@ -1,3 +0,0 @@ -mmm -j8 frameworks/minikin/tests/stresstest && -adb sync data && -adb shell /data/nativetest/minikin_tests/minikin_stress_tests diff --git a/engine/src/flutter/third_party/txt/tests/txt/BUILD.gn b/engine/src/flutter/third_party/txt/tests/txt/BUILD.gn deleted file mode 100644 index dad5c408f3..0000000000 --- a/engine/src/flutter/third_party/txt/tests/txt/BUILD.gn +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2017 Google, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -executable("txt") { - output_name = "txt_unittests" - - include_dirs = [ - "//lib/txt/src", - "//lib/txt/include", - "//third_party/icu/source/common", - ] - - sources = [ - "font_collection_unittests.cc", - "paragraph_unittests.cc", - "render_test.cc", - "render_test.h", - "txt_run_all_unittests.cc", - "utils.cc", - "utils.h", - ] - - deps = [ - "//dart/runtime:libdart_jit", # Logging - "//flutter/fml", - "//lib/txt/shims", - "//lib/txt", - "//third_party/gtest", - "//third_party/harfbuzz", - "//third_party/skia", - ] -} diff --git a/engine/src/flutter/third_party/txt/tests/txt/txt_run_all_unittests.cc b/engine/src/flutter/third_party/txt/tests/txt_run_all_unittests.cc similarity index 97% rename from engine/src/flutter/third_party/txt/tests/txt/txt_run_all_unittests.cc rename to engine/src/flutter/third_party/txt/tests/txt_run_all_unittests.cc index d5c62a171f..583a95c767 100644 --- a/engine/src/flutter/third_party/txt/tests/txt/txt_run_all_unittests.cc +++ b/engine/src/flutter/third_party/txt/tests/txt_run_all_unittests.cc @@ -18,7 +18,7 @@ #include "gtest/gtest.h" #include "lib/ftl/command_line.h" #include "lib/ftl/logging.h" -#include "lib/txt/tests/txt/utils.h" +#include "utils.h" #include "third_party/skia/include/core/SkGraphics.h" #include diff --git a/engine/src/flutter/third_party/txt/tests/unittest/Android.bp b/engine/src/flutter/third_party/txt/tests/unittest/Android.bp deleted file mode 100644 index 2353d4cc76..0000000000 --- a/engine/src/flutter/third_party/txt/tests/unittest/Android.bp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2015 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// see how_to_run.txt for instructions on running these tests - -cc_test { - name: "minikin_tests", - test_suites: ["device-tests"], - data: [":minikin-test-data"], - - header_libs: ["libminikin-headers-for-tests"], - - static_libs: [ - "libminikin-tests-util", - "libminikin", - "libxml2", - ], - - // Shared libraries which are dependencies of minikin; these are not automatically - // pulled in by the build system (and thus sadly must be repeated). - shared_libs: [ - "libskia", - "libft2", - "libharfbuzz_ng", - "libicuuc", - "liblog", - "libutils", - "libz", - ], - - srcs: [ - "CmapCoverageTest.cpp", - "EmojiTest.cpp", - "FontCollectionTest.cpp", - "FontCollectionItemizeTest.cpp", - "FontFamilyTest.cpp", - "FontLanguageListCacheTest.cpp", - "HbFontCacheTest.cpp", - "HyphenatorTest.cpp", - "GraphemeBreakTests.cpp", - "LayoutTest.cpp", - "LayoutUtilsTest.cpp", - "MeasurementTests.cpp", - "SparseBitSetTest.cpp", - "UnicodeUtilsTest.cpp", - "WordBreakerTests.cpp", - ], - - cppflags: [ - "-Werror", - "-Wall", - "-Wextra", - ], - - multilib: { - lib32: { - cppflags: ["-DkTestFontDir=\"/data/nativetest/minikin_tests/data/\""], - }, - lib64: { - cppflags: ["-DkTestFontDir=\"/data/nativetest64/minikin_tests/data/\""], - }, - }, -} diff --git a/engine/src/flutter/third_party/txt/tests/unittest/AndroidTest.xml b/engine/src/flutter/third_party/txt/tests/unittest/AndroidTest.xml deleted file mode 100644 index a0731014f1..0000000000 --- a/engine/src/flutter/third_party/txt/tests/unittest/AndroidTest.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/engine/src/flutter/third_party/txt/tests/unittest/BUILD.gn b/engine/src/flutter/third_party/txt/tests/unittest/BUILD.gn deleted file mode 100644 index 3355b6880e..0000000000 --- a/engine/src/flutter/third_party/txt/tests/unittest/BUILD.gn +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2017 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -executable("unittest") { - output_name = "minikin_unittests" - - testonly = true - - sources = [ - # "WordBreakerTests.cpp", - "//lib/ftl/test/run_all_unittests.cc", - "CmapCoverageTest.cpp", - "EmojiTest.cpp", - - # TODO(abarth): Re-enable once we have wired up SkFontMgr. - # "FontCollectionItemizeTest.cpp", - # "FontCollectionTest.cpp", - # "FontFamilyTest.cpp", - # "FontLanguageListCacheTest.cpp", - "GraphemeBreakTests.cpp", - - # "HbFontCacheTest.cpp", - # "HyphenatorTest.cpp", - "ICUTestBase.h", - - # "LayoutTest.cpp", - "LayoutUtilsTest.cpp", - "MeasurementTests.cpp", - "SparseBitSetTest.cpp", - "UnicodeUtilsTest.cpp", - ] - - defines = [ "kTestFontDir=\"/data/nativetest/minikin_tests/data/\"" ] - - deps = [ - "//lib/txt/libs/minikin", - "//lib/txt/tests/util", - "//third_party/gtest", - ] -} diff --git a/engine/src/flutter/third_party/txt/tests/unittest/how_to_run.txt b/engine/src/flutter/third_party/txt/tests/unittest/how_to_run.txt deleted file mode 100644 index 20aa5ab31e..0000000000 --- a/engine/src/flutter/third_party/txt/tests/unittest/how_to_run.txt +++ /dev/null @@ -1,3 +0,0 @@ -mmm -j8 frameworks/minikin/tests/unittest && -adb sync data && -adb shell /data/nativetest/minikin_tests/minikin_tests diff --git a/engine/src/flutter/third_party/txt/tests/util/Android.bp b/engine/src/flutter/third_party/txt/tests/util/Android.bp deleted file mode 100644 index 50a2cd722f..0000000000 --- a/engine/src/flutter/third_party/txt/tests/util/Android.bp +++ /dev/null @@ -1,13 +0,0 @@ -cc_library_static { - name: "libminikin-tests-util", - srcs: [ - "FileUtils.cpp", - "FontTestUtils.cpp", - "MinikinFontForTest.cpp", - "UnicodeUtils.cpp", - ], - export_include_dirs: ["."], - shared_libs: ["libxml2"], - static_libs: ["libminikin"], - header_libs: ["libminikin-headers-for-tests"], -} diff --git a/engine/src/flutter/third_party/txt/tests/util/BUILD.gn b/engine/src/flutter/third_party/txt/tests/util/BUILD.gn deleted file mode 100644 index cbb0335015..0000000000 --- a/engine/src/flutter/third_party/txt/tests/util/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2017 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -config("util_config") { - include_dirs = [ "." ] -} - -source_set("util") { - sources = [ - "FileUtils.cpp", - "FileUtils.h", - "UnicodeUtils.cpp", - "UnicodeUtils.h", - ] - - public_configs = [ ":util_config" ] - - public_deps = [ - "//lib/txt/libs/minikin", - ] -} diff --git a/engine/src/flutter/third_party/txt/tests/txt/utils.cc b/engine/src/flutter/third_party/txt/tests/utils.cc similarity index 94% rename from engine/src/flutter/third_party/txt/tests/txt/utils.cc rename to engine/src/flutter/third_party/txt/tests/utils.cc index 0bee521a3f..ff7fe1ec25 100644 --- a/engine/src/flutter/third_party/txt/tests/txt/utils.cc +++ b/engine/src/flutter/third_party/txt/tests/utils.cc @@ -17,7 +17,7 @@ #include #include "lib/ftl/command_line.h" -#include "lib/txt/tests/txt/utils.h" +#include "utils.h" namespace txt { @@ -40,4 +40,4 @@ void SetCommandLine(ftl::CommandLine cmd) { gCommandLine = std::move(cmd); } -} // namespace txt \ No newline at end of file +} // namespace txt diff --git a/engine/src/flutter/third_party/txt/tests/txt/utils.h b/engine/src/flutter/third_party/txt/tests/utils.h similarity index 100% rename from engine/src/flutter/third_party/txt/tests/txt/utils.h rename to engine/src/flutter/third_party/txt/tests/utils.h diff --git a/engine/src/flutter/third_party/txt/tools/mk_hyb_file.py b/engine/src/flutter/third_party/txt/tools/mk_hyb_file.py deleted file mode 100755 index 545e9b7b93..0000000000 --- a/engine/src/flutter/third_party/txt/tools/mk_hyb_file.py +++ /dev/null @@ -1,584 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2015 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the 'License'); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an 'AS IS' BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Convert hyphen files in standard TeX format (a trio of pat, chr, and hyp) -into binary format. See doc/hyb_file_format.md for more information. - -Usage: mk_hyb_file.py [-v] hyph-foo.pat.txt hyph-foo.hyb - -Optional -v parameter turns on verbose debugging. - -""" - -from __future__ import print_function - -import io -import sys -import struct -import math -import getopt - - -VERBOSE = False - -# U+00DF is LATIN SMALL LETTER SHARP S -# U+1E9E is LATIN CAPITAL LETTER SHARP S -SHARP_S_TO_DOUBLE = u'\u00dfSS' -SHARP_S_TO_CAPITAL = u'\u00df\u1e9e' - -if sys.version_info[0] >= 3: - def unichr(x): - return chr(x) - - -# number of bits required to represent numbers up to n inclusive -def num_bits(n): - return 1 + int(math.log(n, 2)) if n > 0 else 0 - - -class Node: - - def __init__(self): - self.succ = {} - self.res = None - self.fsm_pat = None - self.fail = None - - -# List of free slots, implemented as doubly linked list -class Freelist: - - def __init__(self): - self.first = None - self.last = None - self.pred = [] - self.succ = [] - - def grow(self): - this = len(self.pred) - self.pred.append(self.last) - self.succ.append(None) - if self.last is None: - self.first = this - else: - self.succ[self.last] = this - self.last = this - - def next(self, cursor): - if cursor == 0: - cursor = self.first - if cursor is None: - self.grow() - result = self.last - else: - result = cursor - return result, self.succ[result] - - def is_free(self, ix): - while ix >= len(self.pred): - self.grow() - return self.pred[ix] != -1 - - def use(self, ix): - if self.pred[ix] is None: - self.first = self.succ[ix] - else: - self.succ[self.pred[ix]] = self.succ[ix] - if self.succ[ix] is None: - self.last = self.pred[ix] - else: - self.pred[self.succ[ix]] = self.pred[ix] - if self.pred[ix] == -1: - assert self.pred[ix] != -1, 'double free!' - self.pred[ix] = -1 - - -def combine(a, b): - if a is None: return b - if b is None: return a - if len(b) < len(a): a, b = b, a - res = b[:len(b) - len(a)] - for i in range(len(a)): - res.append(max(a[i], b[i + len(b) - len(a)])) - return res - - -def trim(pattern): - for ix in range(len(pattern)): - if pattern[ix] != 0: - return pattern[ix:] - - -def pat_to_binary(pattern): - return b''.join(struct.pack('B', x) for x in pattern) - - -class Hyph: - - def __init__(self): - self.root = Node() - self.root.str = '' - self.node_list = [self.root] - - # Add a pattern (word fragment with numeric codes, such as ".ad4der") - def add_pat(self, pat): - lastWasLetter = False - haveSeenNumber = False - result = [] - word = '' - for c in pat: - if c.isdigit(): - result.append(int(c)) - lastWasLetter = False - haveSeenNumber = True - else: - word += c - if lastWasLetter and haveSeenNumber: - result.append(0) - lastWasLetter = True - if lastWasLetter: - result.append(0) - - self.add_word_res(word, result) - - # Add an exception (word with hyphens, such as "ta-ble") - def add_exception(self, hyph_word): - res = [] - word = ['.'] - need_10 = False - for c in hyph_word: - if c == '-': - res.append(11) - need_10 = False - else: - if need_10: - res.append(10) - word.append(c) - need_10 = True - word.append('.') - res.append(0) - res.append(0) - if VERBOSE: - print(word, res) - self.add_word_res(''.join(word), res) - - def add_word_res(self, word, result): - if VERBOSE: - print(word, result) - - t = self.root - s = '' - for c in word: - s += c - if c not in t.succ: - new_node = Node() - new_node.str = s - self.node_list.append(new_node) - t.succ[c] = new_node - t = t.succ[c] - t.res = result - - def pack(self, node_list, ch_map, use_node=False): - size = 0 - self.node_map = {} - nodes = Freelist() - edges = Freelist() - edge_start = 1 if use_node else 0 - for node in node_list: - succ = sorted([ch_map[c] + edge_start for c in node.succ.keys()]) - if len(succ): - cursor = 0 - while True: - edge_ix, cursor = edges.next(cursor) - ix = edge_ix - succ[0] - if (ix >= 0 and nodes.is_free(ix) and - all(edges.is_free(ix + s) for s in succ) and - ((not use_node) or edges.is_free(ix))): - break - elif use_node: - ix, _ = edges.next(0) - nodes.is_free(ix) # actually don't need nodes at all when use_node, - # but keep it happy - else: - ix, _ = nodes.next(0) - node.ix = ix - self.node_map[ix] = node - nodes.use(ix) - size = max(size, ix) - if use_node: - edges.use(ix) - for s in succ: - edges.use(ix + s) - size += max(ch_map.values()) + 1 - return size - - # return list of nodes in bfs order - def bfs(self, ch_map): - result = [self.root] - ix = 0 - while ix < len(result): - node = result[ix] - node.bfs_ix = ix - mapped = {} - for c, next in node.succ.items(): - assert ch_map[c] not in mapped, 'duplicate edge ' + node.str + ' ' + hex(ord(c)) - mapped[ch_map[c]] = next - for i in sorted(mapped.keys()): - result.append(mapped[i]) - ix += 1 - self.bfs_order = result - return result - - # suffix compression - convert the trie into an acyclic digraph, merging nodes when - # the subtries are identical - def dedup(self): - uniques = [] - dupmap = {} - dedup_ix = [0] * len(self.bfs_order) - for ix in reversed(range(len(self.bfs_order))): - # construct string representation of node - node = self.bfs_order[ix] - if node.res is None: - s = '' - else: - s = ''.join(str(c) for c in node.res) - for c in sorted(node.succ.keys()): - succ = node.succ[c] - s += ' ' + c + str(dedup_ix[succ.bfs_ix]) - if s in dupmap: - dedup_ix[ix] = dupmap[s] - else: - uniques.append(node) - dedup_ix[ix] = ix - dupmap[s] = dedup_ix[ix] - uniques.reverse() - print(len(uniques), 'unique nodes,', len(self.bfs_order), 'total') - return dedup_ix, uniques - - -# load the ".pat" file, which contains patterns such as a1b2c3 -def load(fn): - hyph = Hyph() - with io.open(fn, encoding='UTF-8') as f: - for l in f: - pat = l.strip() - hyph.add_pat(pat) - return hyph - - -# load the ".chr" file, which contains the alphabet and case pairs, eg "aA", "bB" etc. -def load_chr(fn): - ch_map = {'.': 0} - with io.open(fn, encoding='UTF-8') as f: - for i, l in enumerate(f): - l = l.strip() - if len(l) > 2: - if l == SHARP_S_TO_DOUBLE: - # replace with lowercasing from capital letter sharp s - l = SHARP_S_TO_CAPITAL - else: - # lowercase maps to multi-character uppercase sequence, ignore uppercase for now - l = l[:1] - else: - assert len(l) == 2, 'expected 2 chars in chr' - for c in l: - ch_map[c] = i + 1 - return ch_map - - -# load exceptions with explicit hyphens -def load_hyp(hyph, fn): - with io.open(fn, encoding='UTF-8') as f: - for l in f: - hyph.add_exception(l.strip()) - - -def generate_header(alphabet, trie, pattern): - alphabet_off = 6 * 4 - trie_off = alphabet_off + len(alphabet) - pattern_off = trie_off + len(trie) - file_size = pattern_off + len(pattern) - data = [0x62ad7968, 0, alphabet_off, trie_off, pattern_off, file_size] - return struct.pack('<6I', *data) - - -def generate_alphabet(ch_map): - ch_map = ch_map.copy() - del ch_map['.'] - min_ch = ord(min(ch_map)) - max_ch = ord(max(ch_map)) - if max_ch - min_ch < 1024 and max(ch_map.values()) < 256: - # generate format 0 - data = [0] * (max_ch - min_ch + 1) - for c, val in ch_map.items(): - data[ord(c) - min_ch] = val - result = [struct.pack('<3I', 0, min_ch, max_ch + 1)] - for b in data: - result.append(struct.pack('> 26 - pat_shift = (entry >> 20) & 0x1f - offset = pattern_offset + (entry & 0xfffff) - return pattern_data[offset: offset + pat_len] + b'\0' * pat_shift - - -def traverse_trie(ix, s, trie_data, ch_map, pattern_data, patterns, exceptions): - (char_mask, link_shift, link_mask, pattern_shift) = struct.unpack('<4I', trie_data[4:20]) - node_entry = struct.unpack('> pattern_shift - if pattern: - result = [] - is_exception = False - pat = get_pattern(pattern_data, pattern) - for i in range(len(s) + 1): - pat_off = i - 1 + len(pat) - len(s) - if pat_off < 0: - code = 0 - else: - code = struct.unpack('B', pat[pat_off : pat_off + 1])[0] - if 1 <= code <= 9: - result.append('%d' % code) - elif code == 10: - is_exception = True - elif code == 11: - result.append('-') - is_exception = True - else: - assert code == 0, 'unexpected code' - if i < len(s): - result.append(s[i]) - pat_str = ''.join(result) - #print(`pat_str`, `pat`) - if is_exception: - assert pat_str[0] == '.', "expected leading '.'" - assert pat_str[-1] == '.', "expected trailing '.'" - exceptions.append(pat_str[1:-1]) # strip leading and trailing '.' - else: - patterns.append(pat_str) - for ch in ch_map: - edge_entry = struct.unpack('> link_shift - if link != 0 and ch == (edge_entry & char_mask): - sch = s + ch_map[ch] - traverse_trie(link, sch, trie_data, ch_map, pattern_data, patterns, exceptions) - - -# Verify the generated binary file by reconstructing the textual representations -# from the binary hyb file, then checking that they're identical (mod the order of -# lines within the file, which is irrelevant). This function makes assumptions that -# are stronger than absolutely necessary (in particular, that the patterns are in -# lowercase as defined by python islower). -def verify_hyb_file(hyb_fn, pat_fn, chr_fn, hyp_fn): - with open(hyb_fn, 'rb') as f: - hyb_data = f.read() - header = hyb_data[0: 6 * 4] - (magic, version, alphabet_off, trie_off, pattern_off, file_size) = struct.unpack('<6I', header) - alphabet_data = hyb_data[alphabet_off:trie_off] - trie_data = hyb_data[trie_off:pattern_off] - pattern_data = hyb_data[pattern_off:file_size] - - # reconstruct alphabet table - alphabet_version = struct.unpack('> 11)] = entry & 0x7ff - - ch_map, reconstructed_chr = map_to_chr(alphabet_map) - - # EXCEPTION for Armenian (hy), we don't really deal with the uppercase form of U+0587 - if u'\u0587' in reconstructed_chr: - reconstructed_chr.remove(u'\u0587') - reconstructed_chr.append(u'\u0587\u0535\u0552') - - assert verify_file_sorted(reconstructed_chr, chr_fn), 'alphabet table not verified' - - # reconstruct trie - patterns = [] - exceptions = [] - traverse_trie(0, '', trie_data, ch_map, pattern_data, patterns, exceptions) - - # EXCEPTION for Bulgarian (bg), which contains an ineffectual line of <0, U+044C, 0> - if u'\u044c' in patterns: - patterns.remove(u'\u044c') - patterns.append(u'0\u044c0') - - assert verify_file_sorted(patterns, pat_fn), 'pattern table not verified' - assert verify_file_sorted(exceptions, hyp_fn), 'exception table not verified' - - -def main(): - global VERBOSE - try: - opts, args = getopt.getopt(sys.argv[1:], 'v') - except getopt.GetoptError as err: - print(str(err)) - sys.exit(1) - for o, _ in opts: - if o == '-v': - VERBOSE = True - pat_fn, out_fn = args - hyph = load(pat_fn) - if pat_fn.endswith('.pat.txt'): - chr_fn = pat_fn[:-8] + '.chr.txt' - ch_map = load_chr(chr_fn) - hyp_fn = pat_fn[:-8] + '.hyp.txt' - load_hyp(hyph, hyp_fn) - generate_hyb_file(hyph, ch_map, out_fn) - verify_hyb_file(out_fn, pat_fn, chr_fn, hyp_fn) - -if __name__ == '__main__': - main()