switch to vector text rendering in more cases
fixed text rendering test case
This commit is contained in:
parent
f36e11bdff
commit
5eb5dc34e1
2 changed files with 7 additions and 0 deletions
BIN
testdata/Text.png
vendored
BIN
testdata/Text.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 825 B |
7
text.go
7
text.go
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue