mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
parent
8352be9369
commit
c7843a4e2b
@ -96,15 +96,23 @@ func float64ToFixed26_6(x float64) fixed.Int26_6 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func glyphVariationCount(face Face) int {
|
func glyphVariationCount(face Face) int {
|
||||||
m := face.Metrics()
|
var s float64
|
||||||
if (m.HAscent != 0 || m.HDescent != 0) && m.HAscent+m.HDescent < 16 {
|
if m := face.Metrics(); face.direction().isHorizontal() {
|
||||||
|
s = m.HAscent + m.HDescent
|
||||||
|
} else {
|
||||||
|
s = m.VAscent + m.VDescent
|
||||||
|
}
|
||||||
|
// The threshold is decided based on the rendering result of the examples (e.g. examples/text, examples/ui).
|
||||||
|
if s < 20 {
|
||||||
return 8
|
return 8
|
||||||
}
|
}
|
||||||
if (m.VAscent != 0 || m.VDescent != 0) && m.VAscent+m.VDescent < 16 {
|
if s < 40 {
|
||||||
return 8
|
|
||||||
}
|
|
||||||
// TODO: For big faces, a smaller value might be enough.
|
|
||||||
return 4
|
return 4
|
||||||
|
}
|
||||||
|
if s < 80 {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func adjustGranularity(x fixed.Int26_6, face Face) fixed.Int26_6 {
|
func adjustGranularity(x fixed.Int26_6, face Face) fixed.Int26_6 {
|
||||||
|
Loading…
Reference in New Issue
Block a user