mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
font/opentype: [API] replace old font type with harfbuzz
This commit replaces the previous opentype.Font with an implementation that uses the new text shaper. In order to keep the implementation simple, support for opentype font collections was dropped. It should be possible to re-add this support after some changes to the text shaper's line wrapping algorithm. To expand on the above, doing proper font fallback with harfbuzz will require splitting the input text on font glyph support boundaries, changing the input from a simple shaping.Input to []shaping.Input with each input matched against the font that supports its language. The line wrapping then needs to be able to properly consume that slice. Since the line wrapping algorithm is really complex, I'm hoping to defer that modification until this simple version is accepted. References: https://todo.sr.ht/~eliasnaur/gio/146 Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
@@ -78,7 +78,7 @@ func CollectionHB() []text.FontFace {
|
||||
}
|
||||
|
||||
func registerHB(fnt text.Font, ttf []byte) {
|
||||
face, err := opentype.ParseHarfbuzz(ttf)
|
||||
face, err := opentype.Parse(ttf)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("failed to parse font: %v", err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user