--- old/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.cc 2017-11-30 10:46:59.789458440 -0800 +++ new/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout.cc 2017-11-30 10:46:59.601458445 -0800 @@ -34,22 +34,21 @@ #include "hb-ot-layout-gdef-table.hh" #include "hb-ot-layout-gsub-table.hh" #include "hb-ot-layout-gpos-table.hh" -#include "hb-ot-layout-jstf-table.hh" +#include "hb-ot-layout-jstf-table.hh" // Just so we compile it; unused otherwise. +#include "hb-ot-name-table.hh" // Just so we compile it; unused otherwise. #include "hb-ot-map-private.hh" -#include -#include +const void * const OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; -HB_SHAPER_DATA_ENSURE_DECLARE(ot, face) hb_ot_layout_t * _hb_ot_layout_create (hb_face_t *face) { hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t)); if (unlikely (!layout)) - return NULL; + return nullptr; layout->gdef_blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_GDEF)); layout->gdef = OT::Sanitizer::lock_instance (layout->gdef_blob); @@ -60,9 +59,9 @@ layout->gpos_blob = OT::Sanitizer::sanitize (face->reference_table (HB_OT_TAG_GPOS)); layout->gpos = OT::Sanitizer::lock_instance (layout->gpos_blob); - /* The MATH table is rarely used, so only try and load it in _get_math. */ - layout->math_blob = NULL; - layout->math = NULL; + layout->math.init (face); + layout->fvar.init (face); + layout->avar.init (face); { /* @@ -106,14 +105,28 @@ || (928 == gdef_len && 59332 == gpos_len && 23298 == gsub_len) /* sha1sum:6d400781948517c3c0441ba42acb309584b73033 tahomabd.ttf from Windows 8.1 */ || (940 == gdef_len && 60732 == gpos_len && 23310 == gsub_len) + /* tahoma.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + || (964 == gdef_len && 60072 == gpos_len && 23836 == gsub_len) + /* tahomabd.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + || (976 == gdef_len && 61456 == gpos_len && 23832 == gsub_len) /* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846 tahoma.ttf from Windows 10 */ || (994 == gdef_len && 60336 == gpos_len && 24474 == gsub_len) /* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343 tahomabd.ttf from Windows 10 */ || (1006 == gdef_len && 61740 == gpos_len && 24470 == gsub_len) + /* tahoma.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + || (1006 == gdef_len && 61346 == gpos_len && 24576 == gsub_len) + /* tahomabd.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */ + || (1018 == gdef_len && 62828 == gpos_len && 24572 == gsub_len) + /* sha1sum:b9c84d820c49850d3d27ec498be93955b82772b5 tahoma.ttf from Windows 10 AU */ + || (1006 == gdef_len && 61352 == gpos_len && 24576 == gsub_len) + /* sha1sum:2bdfaab28174bdadd2f3d4200a30a7ae31db79d2 tahomabd.ttf from Windows 10 AU */ + || (1018 == gdef_len && 62834 == gpos_len && 24572 == gsub_len) /* sha1sum:b0d36cf5a2fbe746a3dd277bffc6756a820807a7 Tahoma.ttf from Mac OS X 10.9 */ || (832 == gdef_len && 47162 == gpos_len && 7324 == gsub_len) /* sha1sum:12fc4538e84d461771b30c18b5eb6bd434e30fba Tahoma Bold.ttf from Mac OS X 10.9 */ || (844 == gdef_len && 45474 == gpos_len && 7302 == gsub_len) + /* sha1sum:eb8afadd28e9cf963e886b23a30b44ab4fd83acc himalaya.ttf from Windows 7 */ + || (180 == gdef_len && 7254 == gpos_len && 13054 == gsub_len) /* sha1sum:73da7f025b238a3f737aa1fde22577a6370f77b0 himalaya.ttf from Windows 8 */ || (192 == gdef_len && 7254 == gpos_len && 12638 == gsub_len) /* sha1sum:6e80fd1c0b059bbee49272401583160dc1e6a427 himalaya.ttf from Windows 8.1 */ @@ -124,6 +137,14 @@ /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */ /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */ || (188 == gdef_len && 3426 == gpos_len && 264 == gsub_len) + /* d125afa82a77a6475ac0e74e7c207914af84b37a padauk-2.80/Padauk.ttf RHEL 7.2 */ + || (1058 == gdef_len && 11818 == gpos_len && 47032 == gsub_len) + /* 0f7b80437227b90a577cc078c0216160ae61b031 padauk-2.80/Padauk-Bold.ttf RHEL 7.2*/ + || (1046 == gdef_len && 12600 == gpos_len && 47030 == gsub_len) + /* d3dde9aa0a6b7f8f6a89ef1002e9aaa11b882290 padauk-2.80/Padauk.ttf Ubuntu 16.04 */ + || (1058 == gdef_len && 16770 == gpos_len && 71796 == gsub_len) + /* 5f3c98ccccae8a953be2d122c1b3a77fd805093f padauk-2.80/Padauk-Bold.ttf Ubuntu 16.04 */ + || (1046 == gdef_len && 17862 == gpos_len && 71790 == gsub_len) /* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */ || (1046 == gdef_len && 17112 == gpos_len && 71788 == gsub_len) /* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */ @@ -132,6 +153,9 @@ || (1330 == gdef_len && 57938 == gpos_len && 109904 == gsub_len) /* 91fcc10cf15e012d27571e075b3b4dfe31754a8a padauk-3.0/Padauk-bookbold.ttf */ || (1330 == gdef_len && 58972 == gpos_len && 109904 == gsub_len) + /* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85 Padauk.ttf + * "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */ + || (1004 == gdef_len && 14836 == gpos_len && 59092 == gsub_len) ) { /* Many versions of Tahoma have bad GDEF tables that incorrectly classify some spacing marks @@ -156,7 +180,7 @@ (layout->gpos_lookup_count && !layout->gpos_accels))) { _hb_ot_layout_destroy (layout); - return NULL; + return nullptr; } for (unsigned int i = 0; i < layout->gsub_lookup_count; i++) @@ -181,7 +205,10 @@ hb_blob_destroy (layout->gdef_blob); hb_blob_destroy (layout->gsub_blob); hb_blob_destroy (layout->gpos_blob); - hb_blob_destroy (layout->math_blob); + + layout->math.fini (); + layout->fvar.fini (); + layout->avar.fini (); free (layout); } @@ -256,7 +283,7 @@ hb_codepoint_t glyph, unsigned int start_offset, unsigned int *caret_count /* IN/OUT */, - int *caret_array /* OUT */) + hb_position_t *caret_array /* OUT */) { return _get_gdef (font->face).get_lig_carets (font, direction, glyph, start_offset, caret_count, caret_array); } @@ -298,7 +325,7 @@ hb_tag_t script_tag, unsigned int *script_index) { - ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX); + static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX), ""); const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); if (g.find_script_index (script_tag, script_index)) @@ -329,7 +356,7 @@ unsigned int *script_index, hb_tag_t *chosen_script) { - ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX); + static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX), ""); const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); while (*script_tags) @@ -388,7 +415,7 @@ hb_tag_t feature_tag, unsigned int *feature_index) { - ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX); + static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX), ""); const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); unsigned int num_features = g.get_feature_count (); @@ -425,7 +452,7 @@ hb_tag_t language_tag, unsigned int *language_index) { - ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX); + static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX), ""); const OT::Script &s = get_gsubgpos_table (face, table_tag).get_script (script_index); if (s.find_lang_sys_index (language_tag, language_index)) @@ -451,7 +478,7 @@ script_index, language_index, feature_index, - NULL); + nullptr); } /** @@ -504,7 +531,7 @@ const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); const OT::LangSys &l = g.get_script (script_index).get_lang_sys (language_index); - ASSERT_STATIC (sizeof (unsigned int) == sizeof (hb_tag_t)); + static_assert ((sizeof (unsigned int) == sizeof (hb_tag_t)), ""); unsigned int ret = l.get_feature_indexes (start_offset, feature_count, (unsigned int *) feature_tags); if (feature_tags) { @@ -525,7 +552,7 @@ hb_tag_t feature_tag, unsigned int *feature_index) { - ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX); + static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX), ""); const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); const OT::LangSys &l = g.get_script (script_index).get_lang_sys (language_index); @@ -629,7 +656,7 @@ script_index, language_index, &required_feature_index, - NULL)) + nullptr)) _hb_ot_layout_collect_lookups_lookups (face, table_tag, required_feature_index, @@ -698,7 +725,7 @@ unsigned int count = hb_ot_layout_script_get_language_tags (face, table_tag, script_index, - 0, NULL, NULL); + 0, nullptr, nullptr); for (unsigned int language_index = 0; language_index < count; language_index++) _hb_ot_layout_collect_lookups_features (face, table_tag, @@ -745,7 +772,7 @@ /* All scripts */ unsigned int count = hb_ot_layout_table_get_script_tags (face, table_tag, - 0, NULL, NULL); + 0, nullptr, nullptr); for (unsigned int script_index = 0; script_index < count; script_index++) _hb_ot_layout_collect_lookups_languages (face, table_tag, @@ -782,10 +809,10 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, hb_tag_t table_tag, unsigned int lookup_index, - hb_set_t *glyphs_before, /* OUT. May be NULL */ - hb_set_t *glyphs_input, /* OUT. May be NULL */ - hb_set_t *glyphs_after, /* OUT. May be NULL */ - hb_set_t *glyphs_output /* OUT. May be NULL */) + hb_set_t *glyphs_before, /* OUT. May be nullptr */ + hb_set_t *glyphs_input, /* OUT. May be nullptr */ + hb_set_t *glyphs_after, /* OUT. May be nullptr */ + hb_set_t *glyphs_output /* OUT. May be nullptr */) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; @@ -836,7 +863,7 @@ unsigned int *lookup_count /* IN/OUT */, unsigned int *lookup_indexes /* OUT */) { - ASSERT_STATIC (OT::FeatureVariations::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_VARIATIONS_INDEX); + static_assert ((OT::FeatureVariations::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_VARIATIONS_INDEX), ""); const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); const OT::Feature &f = g.get_feature_variation (feature_index, variations_index); @@ -944,11 +971,11 @@ **/ hb_bool_t hb_ot_layout_get_size_params (hb_face_t *face, - unsigned int *design_size, /* OUT. May be NULL */ - unsigned int *subfamily_id, /* OUT. May be NULL */ - unsigned int *subfamily_name_id, /* OUT. May be NULL */ - unsigned int *range_start, /* OUT. May be NULL */ - unsigned int *range_end /* OUT. May be NULL */) + unsigned int *design_size, /* OUT. May be nullptr */ + unsigned int *subfamily_id, /* OUT. May be nullptr */ + unsigned int *subfamily_name_id, /* OUT. May be nullptr */ + unsigned int *range_start, /* OUT. May be nullptr */ + unsigned int *range_end /* OUT. May be nullptr */) { const OT::GPOS &gpos = _get_gpos (face); const hb_tag_t tag = HB_TAG ('s','i','z','e'); @@ -1196,6 +1223,7 @@ c.set_lookup_index (lookup_index); c.set_lookup_mask (lookups[table_index][i].mask); c.set_auto_zwj (lookups[table_index][i].auto_zwj); + c.set_auto_zwnj (lookups[table_index][i].auto_zwnj); apply_string (&c, proxy.table.get_lookup (lookup_index), proxy.accels[lookup_index]);