text: remove SingleLine from LayoutOptions

Low level text layout should not deal with filtering newlines.

Updates gio#61

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-11-09 20:00:09 +01:00
parent 778b7e6398
commit 682d2810d3
3 changed files with 6 additions and 13 deletions
+1 -7
View File
@@ -81,12 +81,6 @@ 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:])
nl := c == '\n'
if opts.SingleLine && nl {
nl = false
c = ' '
s = 1
}
a, ok := f.GlyphAdvance(buf, ppem, c)
if !ok {
prev.idx += s
@@ -99,7 +93,7 @@ func layoutText(buf *sfnt.Buffer, ppem fixed.Int26_6, str string, f *opentype, o
x: prev.x + prev.adv,
valid: true,
}
if nl {
if c == '\n' {
// The newline is zero width; use the previous
// character for line measurements.
prev.advs = append(prev.advs, 0)