static int substituteWithVerticalGlyphs(const SimpleFontData* fontData, uint16_t* glyphs, unsigned bufferLength) { HB_FaceRec_* hbFace = fontData->platformData().harfbuzzFace()->face(); if (!hbFace->gsub) { // if there is no GSUB table, treat it as not covered return 0Xffff; } HB_Buffer buffer; hb_buffer_new(&buffer); for (unsigned i = 0; i < bufferLength; ++i) hb_buffer_add_glyph(buffer, glyphs[i], 0, i); HB_UShort scriptIndex; HB_UShort featureIndex; HB_GSUB_Select_Script(hbFace->gsub, HB_MAKE_TAG('D', 'F', 'L', 'T'), &scriptIndex); HB_GSUB_Select_Feature(hbFace->gsub, HB_MAKE_TAG('v', 'e', 'r', 't'), scriptIndex, 0xffff, &featureIndex); HB_GSUB_Add_Feature(hbFace->gsub, featureIndex, 1); HB_GSUB_Select_Feature(hbFace->gsub, HB_MAKE_TAG('v', 'r', 't', '2'), scriptIndex, 0xffff, &featureIndex); HB_GSUB_Add_Feature(hbFace->gsub, featureIndex, 1); int error = HB_GSUB_Apply_String(hbFace->gsub, buffer); if (!error) { for (unsigned i = 0; i < bufferLength; ++i) glyphs[i] = static_cast<Glyph>(buffer->out_string[i].gindex); } return error; }
/** * pango_ot_buffer_add_glyph * @buffer: a #PangoOTBuffer * @glyph: the glyph index to add, like a #PangoGlyph * @properties: the glyph properties * @cluster: the cluster that this glyph belongs to * * Appends a glyph to a #PangoOTBuffer, with @properties identifying which * features should be applied on this glyph. See pango_ruleset_add_feature(). * * Since: 1.4 **/ void pango_ot_buffer_add_glyph (PangoOTBuffer *buffer, guint glyph, guint properties, guint cluster) { hb_buffer_add_glyph (buffer->buffer, glyph, properties, cluster); }