diff --git a/glyphs/font_atlas.go b/glyphs/font_atlas.go index a872f97..3ffb001 100755 --- a/glyphs/font_atlas.go +++ b/glyphs/font_atlas.go @@ -152,7 +152,7 @@ func NewFontAtlasFromFont(f *truetype.Font, face font.Face, pointSize uint) (*Fo Img: image.NewRGBA(image.Rect(0, 0, atlasSizeX, atlasSizeY)), Glyphs: make(map[rune]FontAtlasGlyph, len(glyphs)), - SpaceAdvance: float32(spaceAdv.Ceil()), + SpaceAdvance: I26_6ToF32(spaceAdv), LineHeight: float32(lineHeight.Ceil()), } @@ -165,8 +165,7 @@ func NewFontAtlasFromFont(f *truetype.Font, face font.Face, pointSize uint) (*Fo } //Put glyphs on atlas - drawer.Dot = fixed.P(int(atlas.SpaceAdvance), 0) - drawer.Dot.X += charPaddingXFixed + drawer.Dot.X = spaceAdv + charPaddingXFixed drawer.Dot.Y = lineHeight const drawBoundingBoxes bool = false diff --git a/main.go b/main.go index 47e83e2..604fbaf 100755 --- a/main.go +++ b/main.go @@ -249,8 +249,8 @@ func (p *program) drawGrid() { //columns adv := p.GlyphRend.Atlas.SpaceAdvance - for i := int32(0); i < p.GlyphRend.ScreenWidth; i += int32(adv) { - p.rend.Draw(p.gridMesh, gglm.NewTrMatId().Translate(gglm.NewVec3(float32(i)+0.5, sizeY/2, 0)).Scale(gglm.NewVec3(1, sizeY, 1)), p.gridMat) + for i := 0; i < int(p.GlyphRend.ScreenWidth); i++ { + p.rend.Draw(p.gridMesh, gglm.NewTrMatId().Translate(gglm.NewVec3(adv*float32(i), sizeY/2, 0)).Scale(gglm.NewVec3(1, sizeY, 1)), p.gridMat) } //rows