Run-splitting must discover the font face to be used for each character. For this we use FontLibrary::face_for_char which iterates through all applicable faces, using Face::glyph_index on each, returning the FaceId of the first matching face (but discarding the GlyphId which is rediscovered during shaping).
There are a few possible optimisations here (but 2 and 3 conflict):
Batch look-ups. prepare_runs calls face_for_char_or_first for each char; it may be faster to iterate through chars for each subtable (see https://github.com/RazrFalcon/ttf-parser/issues/76). The same could be done in shape_simple.
Add a Face::contains_glyph method to ttf-parser (using the glyph_index method as a starting point, this should not be hard, but requires additional testing).
Cache both FaceId and GlyphId for use when shaping. This should be usable for shape_simple though probably not for Rustybuzz or Harfbuzz backends, so not particularly useful.
Related: #53
Importance: probably low since https://github.com/RazrFalcon/ttf-parser/pull/68
Run-splitting must discover the font face to be used for each character. For this we use
FontLibrary::face_for_char
which iterates through all applicable faces, usingFace::glyph_index
on each, returning theFaceId
of the first matching face (but discarding theGlyphId
which is rediscovered during shaping).There are a few possible optimisations here (but 2 and 3 conflict):
prepare_runs
callsface_for_char_or_first
for each char; it may be faster to iterate through chars for each subtable (see https://github.com/RazrFalcon/ttf-parser/issues/76). The same could be done inshape_simple
.Face::contains_glyph
method tottf-parser
(using theglyph_index
method as a starting point, this should not be hard, but requires additional testing).FaceId
andGlyphId
for use when shaping. This should be usable forshape_simple
though probably not for Rustybuzz or Harfbuzz backends, so not particularly useful.