src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-complex-arabic-fallback.hh
equal
deleted
inserted
replaced
71 |
71 |
72 num_glyphs++; |
72 num_glyphs++; |
73 } |
73 } |
74 |
74 |
75 if (!num_glyphs) |
75 if (!num_glyphs) |
76 return NULL; |
76 return nullptr; |
77 |
77 |
78 /* Bubble-sort or something equally good! |
78 /* Bubble-sort or something equally good! |
79 * May not be good-enough for presidential candidate interviews, but good-enough for us... */ |
79 * May not be good-enough for presidential candidate interviews, but good-enough for us... */ |
80 hb_stable_sort (&glyphs[0], num_glyphs, OT::GlyphID::cmp, &substitutes[0]); |
80 hb_stable_sort (&glyphs[0], num_glyphs, OT::GlyphID::cmp, &substitutes[0]); |
81 |
81 |
92 substitutes_supplier, |
92 substitutes_supplier, |
93 num_glyphs); |
93 num_glyphs); |
94 c.end_serialize (); |
94 c.end_serialize (); |
95 /* TODO sanitize the results? */ |
95 /* TODO sanitize the results? */ |
96 |
96 |
97 return ret ? c.copy<OT::SubstLookup> () : NULL; |
97 return ret ? c.copy<OT::SubstLookup> () : nullptr; |
98 } |
98 } |
99 |
99 |
100 static OT::SubstLookup * |
100 static OT::SubstLookup * |
101 arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UNUSED, |
101 arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UNUSED, |
102 hb_font_t *font) |
102 hb_font_t *font) |
151 num_ligatures++; |
151 num_ligatures++; |
152 } |
152 } |
153 } |
153 } |
154 |
154 |
155 if (!num_ligatures) |
155 if (!num_ligatures) |
156 return NULL; |
156 return nullptr; |
157 |
157 |
158 OT::Supplier<OT::GlyphID> first_glyphs_supplier (first_glyphs, num_first_glyphs); |
158 OT::Supplier<OT::GlyphID> first_glyphs_supplier (first_glyphs, num_first_glyphs); |
159 OT::Supplier<unsigned int > ligature_per_first_glyph_count_supplier (ligature_per_first_glyph_count_list, num_first_glyphs); |
159 OT::Supplier<unsigned int > ligature_per_first_glyph_count_supplier (ligature_per_first_glyph_count_list, num_first_glyphs); |
160 OT::Supplier<OT::GlyphID> ligatures_supplier (ligature_list, num_ligatures); |
160 OT::Supplier<OT::GlyphID> ligatures_supplier (ligature_list, num_ligatures); |
161 OT::Supplier<unsigned int > component_count_supplier (component_count_list, num_ligatures); |
161 OT::Supplier<unsigned int > component_count_supplier (component_count_list, num_ligatures); |
175 component_supplier); |
175 component_supplier); |
176 |
176 |
177 c.end_serialize (); |
177 c.end_serialize (); |
178 /* TODO sanitize the results? */ |
178 /* TODO sanitize the results? */ |
179 |
179 |
180 return ret ? c.copy<OT::SubstLookup> () : NULL; |
180 return ret ? c.copy<OT::SubstLookup> () : nullptr; |
181 } |
181 } |
182 |
182 |
183 static OT::SubstLookup * |
183 static OT::SubstLookup * |
184 arabic_fallback_synthesize_lookup (const hb_ot_shape_plan_t *plan, |
184 arabic_fallback_synthesize_lookup (const hb_ot_shape_plan_t *plan, |
185 hb_font_t *font, |
185 hb_font_t *font, |
235 hb_font_get_glyph (font, 0x064Au, 0, &g) && g == 237 /* YEH */ && |
235 hb_font_get_glyph (font, 0x064Au, 0, &g) && g == 237 /* YEH */ && |
236 hb_font_get_glyph (font, 0x0652u, 0, &g) && g == 250 /* SUKUN */)) |
236 hb_font_get_glyph (font, 0x0652u, 0, &g) && g == 250 /* SUKUN */)) |
237 return false; |
237 return false; |
238 |
238 |
239 const Manifest &manifest = reinterpret_cast<const Manifest&> (arabic_win1256_gsub_lookups.manifest); |
239 const Manifest &manifest = reinterpret_cast<const Manifest&> (arabic_win1256_gsub_lookups.manifest); |
240 ASSERT_STATIC (sizeof (arabic_win1256_gsub_lookups.manifestData) / sizeof (ManifestLookup) |
240 static_assert (sizeof (arabic_win1256_gsub_lookups.manifestData) / sizeof (ManifestLookup) |
241 <= ARABIC_FALLBACK_MAX_LOOKUPS); |
241 <= ARABIC_FALLBACK_MAX_LOOKUPS, ""); |
242 /* TODO sanitize the table? */ |
242 /* TODO sanitize the table? */ |
243 |
243 |
244 unsigned j = 0; |
244 unsigned j = 0; |
245 unsigned int count = manifest.len; |
245 unsigned int count = manifest.len; |
246 for (unsigned int i = 0; i < count; i++) |
246 for (unsigned int i = 0; i < count; i++) |
269 static bool |
269 static bool |
270 arabic_fallback_plan_init_unicode (arabic_fallback_plan_t *fallback_plan, |
270 arabic_fallback_plan_init_unicode (arabic_fallback_plan_t *fallback_plan, |
271 const hb_ot_shape_plan_t *plan, |
271 const hb_ot_shape_plan_t *plan, |
272 hb_font_t *font) |
272 hb_font_t *font) |
273 { |
273 { |
274 ASSERT_STATIC (ARRAY_LENGTH_CONST(arabic_fallback_features) <= ARABIC_FALLBACK_MAX_LOOKUPS); |
274 static_assert ((ARRAY_LENGTH_CONST(arabic_fallback_features) <= ARABIC_FALLBACK_MAX_LOOKUPS), ""); |
275 unsigned int j = 0; |
275 unsigned int j = 0; |
276 for (unsigned int i = 0; i < ARRAY_LENGTH(arabic_fallback_features) ; i++) |
276 for (unsigned int i = 0; i < ARRAY_LENGTH(arabic_fallback_features) ; i++) |
277 { |
277 { |
278 fallback_plan->mask_array[j] = plan->map.get_1_mask (arabic_fallback_features[i]); |
278 fallback_plan->mask_array[j] = plan->map.get_1_mask (arabic_fallback_features[i]); |
279 if (fallback_plan->mask_array[j]) |
279 if (fallback_plan->mask_array[j]) |