mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
font/opentype: treat invalid characters less specially
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -79,18 +79,14 @@ func layoutText(buf *sfnt.Buffer, ppem fixed.Int26_6, str string, f *opentype, o
|
||||
}
|
||||
for prev.idx < len(str) {
|
||||
c, s := utf8.DecodeRuneInString(str[prev.idx:])
|
||||
a, ok := f.GlyphAdvance(buf, ppem, c)
|
||||
if !ok {
|
||||
prev.idx += s
|
||||
continue
|
||||
}
|
||||
a, valid := f.GlyphAdvance(buf, ppem, c)
|
||||
next := state{
|
||||
r: c,
|
||||
advs: prev.advs,
|
||||
idx: prev.idx + s,
|
||||
x: prev.x + prev.adv,
|
||||
adv: a,
|
||||
valid: true,
|
||||
valid: valid,
|
||||
}
|
||||
if c == '\n' {
|
||||
// The newline is zero width; use the previous
|
||||
|
||||
Reference in New Issue
Block a user