shiny/text: drop panic when GlyphAdvance returns !ok
As the commit message of CL 474376 notes, the "TODO: is falling back
on the U+FFFD glyph the responsibility of the Drawer or the Face?"
was resolved. There's no need to panic anymore.
Updates golang/go#58252.
Change-Id: Ic4bcc3dfb8a463e7abcfccdbcf826644327f1aec
Reviewed-on: https://go-review.googlesource.com/c/exp/+/552616
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Nigel Tao (INACTIVE; USE @golang.org INSTEAD) <nigeltao@google.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/shiny/text/caret.go b/shiny/text/caret.go
index 24daa96..7017db0 100644
--- a/shiny/text/caret.go
+++ b/shiny/text/caret.go
@@ -602,10 +602,7 @@
if r == ' ' {
breakPoint = reader.bAndK()
}
- a, ok := f.face.GlyphAdvance(r)
- if !ok {
- panic("TODO: is falling back on the U+FFFD glyph the responsibility of the caller or the Face?")
- }
+ a, _ := f.face.GlyphAdvance(r)
advance += a
if r != ' ' && advance > f.maxWidth && breakPoint.b != 0 {
breakLine(f, l, breakPoint.b, breakPoint.k)