mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
text: refactoring
This commit is contained in:
parent
c45e9d0c00
commit
85fdf90d4d
@ -66,14 +66,14 @@ func (f *testFace) Glyph(dot fixed.Point26_6, r rune) (dr image.Rectangle, mask
|
|||||||
a := image.NewAlpha(dr)
|
a := image.NewAlpha(dr)
|
||||||
switch r {
|
switch r {
|
||||||
case 'a':
|
case 'a':
|
||||||
for j := 0; j < testFaceSize; j++ {
|
for j := dr.Min.Y; j < dr.Max.Y; j++ {
|
||||||
for i := 0; i < testFaceSize; i++ {
|
for i := dr.Min.X; i < dr.Max.X; i++ {
|
||||||
a.SetAlpha(i, j, color.Alpha{A: 0x80})
|
a.SetAlpha(i, j, color.Alpha{A: 0x80})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 'b':
|
case 'b':
|
||||||
for j := 0; j < testFaceSize; j++ {
|
for j := dr.Min.Y; j < dr.Max.Y; j++ {
|
||||||
for i := 0; i < testFaceSize; i++ {
|
for i := dr.Min.X; i < dr.Max.X; i++ {
|
||||||
a.SetAlpha(i, j, color.Alpha{A: 0xff})
|
a.SetAlpha(i, j, color.Alpha{A: 0xff})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,15 +109,16 @@ func (f *testFace) Close() error {
|
|||||||
func (f *testFace) Metrics() font.Metrics {
|
func (f *testFace) Metrics() font.Metrics {
|
||||||
return font.Metrics{
|
return font.Metrics{
|
||||||
Height: fixed.I(testFaceSize),
|
Height: fixed.I(testFaceSize),
|
||||||
Ascent: fixed.I(testFaceSize),
|
Ascent: 0,
|
||||||
Descent: 0,
|
Descent: fixed.I(testFaceSize),
|
||||||
XHeight: 0,
|
XHeight: 0,
|
||||||
CapHeight: fixed.I(testFaceSize),
|
CapHeight: fixed.I(testFaceSize),
|
||||||
CaretSlope: image.Pt(0, 1),
|
CaretSlope: image.Pt(0, 1),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTextOverlap(t *testing.T) {
|
// Issue #1378
|
||||||
|
func TestNegativeKern(t *testing.T) {
|
||||||
f := &testFace{}
|
f := &testFace{}
|
||||||
dst := ebiten.NewImage(testFaceSize*2, testFaceSize)
|
dst := ebiten.NewImage(testFaceSize*2, testFaceSize)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user