Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-ot-layout.cc

Issue 1874153002: Roll HarfBuzz to 1.2.6 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright © 1998-2004 David Turner and Werner Lemberg 2 * Copyright © 1998-2004 David Turner and Werner Lemberg
3 * Copyright © 2006 Behdad Esfahbod 3 * Copyright © 2006 Behdad Esfahbod
4 * Copyright © 2007,2008,2009 Red Hat, Inc. 4 * Copyright © 2007,2008,2009 Red Hat, Inc.
5 * Copyright © 2012,2013 Google, Inc. 5 * Copyright © 2012,2013 Google, Inc.
6 * 6 *
7 * This is part of HarfBuzz, a text shaping library. 7 * This is part of HarfBuzz, a text shaping library.
8 * 8 *
9 * Permission is hereby granted, without written agreement and without 9 * Permission is hereby granted, without written agreement and without
10 * license or royalty fees, to use, copy, modify, and distribute this 10 * license or royalty fees, to use, copy, modify, and distribute this
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 layout->gdef_blob = OT::Sanitizer<OT::GDEF>::sanitize (face->reference_table ( HB_OT_TAG_GDEF)); 54 layout->gdef_blob = OT::Sanitizer<OT::GDEF>::sanitize (face->reference_table ( HB_OT_TAG_GDEF));
55 layout->gdef = OT::Sanitizer<OT::GDEF>::lock_instance (layout->gdef_blob); 55 layout->gdef = OT::Sanitizer<OT::GDEF>::lock_instance (layout->gdef_blob);
56 56
57 layout->gsub_blob = OT::Sanitizer<OT::GSUB>::sanitize (face->reference_table ( HB_OT_TAG_GSUB)); 57 layout->gsub_blob = OT::Sanitizer<OT::GSUB>::sanitize (face->reference_table ( HB_OT_TAG_GSUB));
58 layout->gsub = OT::Sanitizer<OT::GSUB>::lock_instance (layout->gsub_blob); 58 layout->gsub = OT::Sanitizer<OT::GSUB>::lock_instance (layout->gsub_blob);
59 59
60 layout->gpos_blob = OT::Sanitizer<OT::GPOS>::sanitize (face->reference_table ( HB_OT_TAG_GPOS)); 60 layout->gpos_blob = OT::Sanitizer<OT::GPOS>::sanitize (face->reference_table ( HB_OT_TAG_GPOS));
61 layout->gpos = OT::Sanitizer<OT::GPOS>::lock_instance (layout->gpos_blob); 61 layout->gpos = OT::Sanitizer<OT::GPOS>::lock_instance (layout->gpos_blob);
62 62
63 {
64 /*
65 * The ugly business of blacklisting individual fonts' tables happen here!
66 * See this thread for why we finally had to bend in and do this:
67 * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
68 */
69 unsigned int gdef_len = hb_blob_get_length (layout->gdef_blob);
70 unsigned int gsub_len = hb_blob_get_length (layout->gsub_blob);
71 unsigned int gpos_len = hb_blob_get_length (layout->gpos_blob);
72 if (0
73 || (442 == gdef_len && 42038 == gpos_len && 2874 == gsub_len) /* Windows 7 timesi.ttf */
74 || (430 == gdef_len && 40662 == gpos_len && 2874 == gsub_len) /* Windows 7 timesbi.ttf */
75 || (442 == gdef_len && 39116 == gpos_len && 2874 == gsub_len) /* Windows ? ?? timesi.ttf */
76 || (430 == gdef_len && 39374 == gpos_len && 2874 == gsub_len) /* Windows ? ?? timesbi.ttf */
77 || (490 == gdef_len && 41638 == gpos_len && 3046 == gsub_len) /* OS X 10.1 1.3 Times New Roman Italic.ttf */
78 || (478 == gdef_len && 41902 == gpos_len && 3046 == gsub_len) /* OS X 10.1 1.3 Times New Roman Bold Italic.ttf */
79 )
80 {
81 /* In certain versions of Times New Roman Italic and Bold Italic,
82 * ASCII double quotation mark U+0022, mapped to glyph 5, has wrong
83 * glyph class 3 (mark) in GDEF. Nuke the GDEF to avoid zero-width
84 * double-quote. See:
85 * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.ht ml
86 */
87 if (3 == layout->gdef->get_glyph_class (5))
88 layout->gdef = &OT::Null(OT::GDEF);
89 }
90 }
91
63 layout->gsub_lookup_count = layout->gsub->get_lookup_count (); 92 layout->gsub_lookup_count = layout->gsub->get_lookup_count ();
64 layout->gpos_lookup_count = layout->gpos->get_lookup_count (); 93 layout->gpos_lookup_count = layout->gpos->get_lookup_count ();
65 94
66 layout->gsub_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (layout->gs ub->get_lookup_count (), sizeof (hb_ot_layout_lookup_accelerator_t)); 95 layout->gsub_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (layout->gs ub->get_lookup_count (), sizeof (hb_ot_layout_lookup_accelerator_t));
67 layout->gpos_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (layout->gp os->get_lookup_count (), sizeof (hb_ot_layout_lookup_accelerator_t)); 96 layout->gpos_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (layout->gp os->get_lookup_count (), sizeof (hb_ot_layout_lookup_accelerator_t));
68 97
69 if (unlikely ((layout->gsub_lookup_count && !layout->gsub_accels) || 98 if (unlikely ((layout->gsub_lookup_count && !layout->gsub_accels) ||
70 (layout->gpos_lookup_count && !layout->gpos_accels))) 99 (layout->gpos_lookup_count && !layout->gpos_accels)))
71 { 100 {
72 _hb_ot_layout_destroy (layout); 101 _hb_ot_layout_destroy (layout);
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 apply (proxy, plan, font, buffer); 1130 apply (proxy, plan, font, buffer);
1102 } 1131 }
1103 1132
1104 HB_INTERNAL void 1133 HB_INTERNAL void
1105 hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c, 1134 hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c,
1106 const OT::SubstLookup &lookup, 1135 const OT::SubstLookup &lookup,
1107 const hb_ot_layout_lookup_accelerator_t &accel) 1136 const hb_ot_layout_lookup_accelerator_t &accel)
1108 { 1137 {
1109 apply_string<GSUBProxy> (c, lookup, accel); 1138 apply_string<GSUBProxy> (c, lookup, accel);
1110 } 1139 }
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ot-hmtx-table.hh ('k') | third_party/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698