From f3f079df324f8eeda9452ff826399d60069daa5d Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 20 Nov 2019 20:15:31 +0100 Subject: [PATCH] font/opentype: treat invalid characters less specially Signed-off-by: Elias Naur --- font/opentype/opentype.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/font/opentype/opentype.go b/font/opentype/opentype.go index c8ca18b2..7552a66d 100644 --- a/font/opentype/opentype.go +++ b/font/opentype/opentype.go @@ -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