If variation selector is not consumed by cmap, pass it on to GSUB
This changes the semantics of get_glyph() callback and expect that callbacks return false if the requested variant is not available, and then we will call them back with variation_selector=0 and will retain the glyph for the selector in the glyph stream. Apparently most Mongolian fonts implement the Mongolian Variation Selectors using GSUB, not cmap. https://bugs.freedesktop.org/show_bug.cgi?id=65258 Note that this doesn't fix the Mongolian shaping yet, because the way that's implemented is that the, say, 'init' feature ligates the letter and the variation-selector. However, since currently the variation selector doesn't have the 'init' mask on, it will not be matched...
This commit is contained in:
parent
c7a8491720
commit
79d1007a50
@ -73,8 +73,7 @@ hb_ft_get_glyph (hb_font_t *font HB_UNUSED,
|
||||
#ifdef HAVE_FT_FACE_GETCHARVARIANTINDEX
|
||||
if (unlikely (variation_selector)) {
|
||||
*glyph = FT_Face_GetCharVariantIndex (ft_face, unicode, variation_selector);
|
||||
if (*glyph)
|
||||
return true;
|
||||
return *glyph != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -217,8 +217,18 @@ handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c, uns
|
||||
for (; buffer->idx < end - 1;) {
|
||||
if (unlikely (buffer->unicode->is_variation_selector (buffer->cur(+1).codepoint))) {
|
||||
/* The next two lines are some ugly lines... But work. */
|
||||
c->font->get_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index());
|
||||
buffer->replace_glyphs (2, 1, &buffer->cur().codepoint);
|
||||
if (c->font->get_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index()))
|
||||
{
|
||||
buffer->replace_glyphs (2, 1, &buffer->cur().codepoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Just pass on the two characters separately, let GSUB do its magic. */
|
||||
set_glyph (buffer->cur(), c->font);
|
||||
buffer->next_glyph ();
|
||||
set_glyph (buffer->cur(), c->font);
|
||||
buffer->next_glyph ();
|
||||
}
|
||||
/* Skip any further variation selectors. */
|
||||
while (buffer->idx < end && unlikely (buffer->unicode->is_variation_selector (buffer->cur().codepoint)))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user