Blacklist GDEF table of timesi.ttf and timesbi.ttf on Win 7

See discussion:
https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
This commit is contained in:
Behdad Esfahbod 2016-02-25 11:11:15 +09:00
parent c335fd7986
commit e23cf902e9
1 changed files with 25 additions and 0 deletions

View File

@ -60,6 +60,31 @@ _hb_ot_layout_create (hb_face_t *face)
layout->gpos_blob = OT::Sanitizer<OT::GPOS>::sanitize (face->reference_table (HB_OT_TAG_GPOS));
layout->gpos = OT::Sanitizer<OT::GPOS>::lock_instance (layout->gpos_blob);
{
/*
* The ugly business of blacklisting individual fonts' tables happen here!
* See this thread for why we finally had to bend in and do this:
* https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
*/
unsigned int gdef_len = hb_blob_get_length (layout->gdef_blob);
unsigned int gsub_len = hb_blob_get_length (layout->gsub_blob);
unsigned int gpos_len = hb_blob_get_length (layout->gpos_blob);
if (0
|| (442 == gdef_len && 42038 == gpos_len && 2874 == gsub_len) /* Windows 7 timesi.ttf */
|| (430 == gdef_len && 40662 == gpos_len && 2874 == gsub_len) /* Windows 7 timesbi.ttf */
)
{
/* In certain versions of Times New Roman Italic and Bold Italic,
* ASCII double quotation mark U+0022, mapped to glyph 5, has wrong
* glyph class 3 (mark) in GDEF. Nuke the GDEF to avoid zero-width
* double-quote. See:
* https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
*/
if (3 == layout->gdef->get_glyph_class (5))
layout->gdef = &OT::Null(OT::GDEF);
}
}
layout->gsub_lookup_count = layout->gsub->get_lookup_count ();
layout->gpos_lookup_count = layout->gpos->get_lookup_count ();