diff options
author | Grigori Goronzy <greg@blackbox> | 2011-07-11 13:00:08 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@blackbox> | 2011-07-11 13:05:52 +0200 |
commit | db6ccb3634db5ccbce1a2fdaa383085242d52c82 (patch) | |
tree | 33cf84b60230d8a6f2188af87581580cad3d8102 /libass/ass_font.c | |
parent | 778c5cebe439598bf3a6f0277ed7516928f0ff00 (diff) | |
download | libass-db6ccb3634db5ccbce1a2fdaa383085242d52c82.tar.bz2 libass-db6ccb3634db5ccbce1a2fdaa383085242d52c82.tar.xz |
HarfBuzz shaping support
Split up text into runs with the same direction, font face and font
size, shape these runs with HarfBuzz and reorder accordingly.
This noticeably improves Arabic shaping and should make shaping for many
other scripts work. HarfBuzz also does kerning for Latin text.
Diffstat (limited to 'libass/ass_font.c')
-rw-r--r-- | libass/ass_font.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/libass/ass_font.c b/libass/ass_font.c index af1f350..14790b4 100644 --- a/libass/ass_font.c +++ b/libass/ass_font.c @@ -433,24 +433,32 @@ int ass_font_get_index(void *fcpriv, ASS_Font *font, uint32_t symbol, int i; FT_Face face = 0; - *face_index = 0; - *face_index = 0; + *glyph_index = 0; - if (symbol < 0x20) + if (symbol < 0x20) { + *face_index = 0; return 0; + } // Handle NBSP like a regular space when rendering the glyph if (symbol == 0xa0) symbol = ' '; - if (font->n_faces == 0) + if (font->n_faces == 0) { + *face_index = 0; return 0; + } - for (i = 0; i < font->n_faces; ++i) { + // try with the requested face + if (*face_index < font->n_faces) { + face = font->faces[i]; + index = FT_Get_Char_Index(face, symbol); + } + + // not found in requested face, try all others + for (i = 0; i < font->n_faces && index == 0; ++i) { face = font->faces[i]; index = FT_Get_Char_Index(face, symbol); - if (index) { + if (index) *face_index = i; - break; - } } #ifdef CONFIG_FONTCONFIG |