tests and fixes #123, SIGSEGV on text.NewAtlas if glyph absent
This commit is contained in:
parent
7cff3ce3ae
commit
85bced7801
|
@ -60,8 +60,9 @@ func NewAtlas(face font.Face, runeSets ...[]rune) *Atlas {
|
||||||
))
|
))
|
||||||
|
|
||||||
for r, fg := range fixedMapping {
|
for r, fg := range fixedMapping {
|
||||||
dr, mask, maskp, _, _ := face.Glyph(fg.dot, r)
|
if dr, mask, maskp, _, ok := face.Glyph(fg.dot, r); ok {
|
||||||
draw.Draw(atlasImg, dr, mask, maskp, draw.Src)
|
draw.Draw(atlasImg, dr, mask, maskp, draw.Src)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bounds := pixel.R(
|
bounds := pixel.R(
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/faiface/pixel/text"
|
"github.com/faiface/pixel/text"
|
||||||
|
"golang.org/x/image/font/inconsolata"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAtlas7x13(t *testing.T) {
|
func TestAtlas7x13(t *testing.T) {
|
||||||
|
@ -22,3 +23,7 @@ func TestAtlas7x13(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAtlasInconsolata(t *testing.T) {
|
||||||
|
text.NewAtlas(inconsolata.Regular8x16, text.ASCII)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue