From 02704c960a9be2620264d7b99499c640e03da6b6 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Sat, 19 Aug 2023 23:37:35 -0400 Subject: [PATCH] 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 Reviewed-by: Nigel Tao (INACTIVE; USE @golang.org INSTEAD) Reviewed-by: Nigel Tao Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI --- shiny/text/caret.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/shiny/text/caret.go b/shiny/text/caret.go index 24daa9625..7017db080 100644 --- a/shiny/text/caret.go +++ b/shiny/text/caret.go @@ -602,10 +602,7 @@ func layout(f *Frame, l int32) { 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)