/* Features ordered the same as the entries in shaping_table rows, * followed by rlig. Don't change. * * We currently support one subtable per lookup, and one lookup * per feature. But we allow duplicate features, so we use that!
*/ staticconst hb_tag_t arabic_fallback_features[] =
{
HB_TAG('i','n','i','t'),
HB_TAG('m','e','d','i'),
HB_TAG('f','i','n','a'),
HB_TAG('i','s','o','l'),
HB_TAG('r','l','i','g'),
HB_TAG('r','l','i','g'),
HB_TAG('r','l','i','g'),
};
/* Bubble-sort or something equally good!
* May not be good-enough for presidential candidate interviews, but good-enough for us... */
hb_stable_sort (&glyphs[0], num_glyphs,
(int(*)(const OT::HBUINT16*, const OT::HBUINT16 *)) OT::HBGlyphID16::cmp,
&substitutes[0]);
/* Each glyph takes four bytes max, and there's some overhead. */ char buf[(SHAPING_TABLE_LAST - SHAPING_TABLE_FIRST + 1) * 4 + 128];
hb_serialize_context_t c (buf, sizeof (buf));
OT::SubstLookup *lookup = c.start_serialize<OT::SubstLookup> (); bool ret = lookup->serialize_single (&c,
OT::LookupFlag::IgnoreMarks,
hb_sorted_array (glyphs, num_glyphs),
hb_array (substitutes, num_glyphs));
c.end_serialize ();
/* We know that all our ligatures have the same number of components. */
OT::HBGlyphID16 ligature_list[ARRAY_LENGTH_CONST (first_glyphs) * ARRAY_LENGTH_CONST(ligature_table[0].ligatures)]; unsignedint component_count_list[ARRAY_LENGTH_CONST (ligature_list)];
OT::HBGlyphID16 component_list[ARRAY_LENGTH_CONST (ligature_list) *
ARRAY_LENGTH_CONST (ligature_table[0].ligatures[0].components)]; unsignedint num_ligatures = 0; unsignedint num_components = 0;
/* Now that the first-glyphs are sorted, walk again, populate ligatures. */ for (unsignedint i = 0; i < num_first_glyphs; i++)
{ unsignedint first_glyph_idx = first_glyphs_indirection[i];
/* Try synthesizing GSUB table using Unicode Arabic Presentation Forms,
* in case the font has cmap entries for the presentation-forms characters. */ if (arabic_fallback_plan_init_unicode (fallback_plan, plan, font)) return fallback_plan;
/* See if this looks like a Windows-1256-encoded font. If it does, use a
* hand-coded GSUB table. */ if (arabic_fallback_plan_init_win1256 (fallback_plan, plan, font)) return fallback_plan;
for (unsignedint i = 0; i < fallback_plan->num_lookups; i++) if (fallback_plan->lookup_array[i])
{
hb_free (fallback_plan->accel_array[i]); if (fallback_plan->free_lookups)
hb_free (fallback_plan->lookup_array[i]);
}
hb_free (fallback_plan);
}
staticvoid
arabic_fallback_plan_shape (arabic_fallback_plan_t *fallback_plan,
hb_font_t *font,
hb_buffer_t *buffer)
{
OT::hb_ot_apply_context_t c (0, font, buffer, hb_blob_get_empty ()); for (unsignedint i = 0; i < fallback_plan->num_lookups; i++) if (fallback_plan->lookup_array[i]) {
c.set_lookup_mask (fallback_plan->mask_array[i]); if (fallback_plan->accel_array[i])
hb_ot_layout_substitute_lookup (&c,
*fallback_plan->lookup_array[i],
*fallback_plan->accel_array[i]);
}
}
#endif/* HB_OT_SHAPER_ARABIC_FALLBACK_HH */
Messung V0.5
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.