BitmapFont default pixel height bug fixed.

This commit is contained in:
Harrison Deng 2020-07-11 18:20:31 -05:00
parent 4a836cef75
commit 2a007cfb70

View File

@ -62,7 +62,6 @@ namespace SlatedGameToolkit.Framework.Graphics.Text
for (int i = 0; i < this.textures.Length; i++) { for (int i = 0; i < this.textures.Length; i++) {
this.textures[i] = new FontTexture(info, context, glyphIndices, textureSizes); this.textures[i] = new FontTexture(info, context, glyphIndices, textureSizes);
} }
PixelHeight = 64;
int spaceAdvance, leftSideBearing; int spaceAdvance, leftSideBearing;
StbTrueType.stbtt_GetCodepointHMetrics(info, ' ', &spaceAdvance, &leftSideBearing); StbTrueType.stbtt_GetCodepointHMetrics(info, ' ', &spaceAdvance, &leftSideBearing);
this.spaceAdvance = spaceAdvance; this.spaceAdvance = spaceAdvance;
@ -76,6 +75,7 @@ namespace SlatedGameToolkit.Framework.Graphics.Text
context.GetViewport(out vX, out vY, out vWidth, out vHeight); context.GetViewport(out vX, out vY, out vWidth, out vHeight);
this.PixelsPerUnitWidth = vWidth; this.PixelsPerUnitWidth = vWidth;
this.PixelsPerUnitHeight = vHeight; this.PixelsPerUnitHeight = vHeight;
PixelHeight = 64;
} }
public BitmapFont(string path, GLContext glContext = null, int cacheSize = 1024, int textures = 2, uint textureSizes = 512) : this(File.ReadAllBytes(path), glContext, cacheSize, textures, textureSizes) { public BitmapFont(string path, GLContext glContext = null, int cacheSize = 1024, int textures = 2, uint textureSizes = 512) : this(File.ReadAllBytes(path), glContext, cacheSize, textures, textureSizes) {