Should fix centering issues with trailing emojis

This commit is contained in:
Hamcha 2018-11-16 17:13:49 +01:00
parent 9dbc14edd6
commit 41b8d7304e
Signed by: hamcha
GPG key ID: A40413D21021EAEE

View file

@ -278,6 +278,8 @@ func (gc *GraphicContext) GetStringBounds(s string) (left, top, right, bottom fl
for fragment := range gc.Emojis.Iterate(s) { for fragment := range gc.Emojis.Iterate(s) {
if fragment.IsEmoji { if fragment.IsEmoji {
cursor += fUnitsToFloat64(fixed.Int26_6(gc.Current.Scale)) * 1.15 cursor += fUnitsToFloat64(fixed.Int26_6(gc.Current.Scale)) * 1.15
left = math.Min(left, cursor)
right = math.Max(right, cursor)
continue continue
} }
index := f.Index(fragment.Rune) index := f.Index(fragment.Rune)