Skip to content

Commit

Permalink
switch to vector text rendering in more cases
Browse files Browse the repository at this point in the history
fixed text rendering test case
  • Loading branch information
tfriedel6 committed May 28, 2020
1 parent f36e11b commit 5eb5dc3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Binary file modified testdata/Text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions text.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,17 @@ func (cv *Canvas) FillText(str string, x, y float64) {
scale := (scaleX + scaleY) * 0.5
fontSize := fixed.Int26_6(math.Round(float64(cv.state.fontSize) * scale))

// if the font size is large or rotated or skewed in some way, use the
// triangulated font rendering
if fontSize > fixed.I(25) {
cv.fillText2(str, x, y)
return
}
mat := cv.state.transform
if mat[1] != 0 || mat[2] != 0 || mat[0] != mat[3] {
cv.fillText2(str, x, y)
return
}

frc := cv.getFRContext(cv.state.font, fontSize)
fnt := cv.state.font.font
Expand Down

0 comments on commit 5eb5dc3

Please sign in to comment.