public static BMFont FontFromSize(Text.FontSize font) { switch (font) { case Text.FontSize._12pt: return(BMFont.LoadFont("fonts/font12.fnt")); case Text.FontSize._14pt: return(BMFont.LoadFont("fonts/font14.fnt")); case Text.FontSize._16pt: return(BMFont.LoadFont("fonts/font16.fnt")); case Text.FontSize._24pt: return(BMFont.LoadFont("fonts/font24.fnt")); case Text.FontSize._32pt: return(BMFont.LoadFont("fonts/font32.fnt")); case Text.FontSize._48pt: return(BMFont.LoadFont("fonts/font48.fnt")); default: return(BMFont.LoadFont("fonts/font12.fnt")); } }
public void UpdateFontSize(Text.FontSize font) { this.bitmapFont = Text.FontFromSize(font); if (string.IsNullOrEmpty(this.String)) { return; } if (this.VAO != null) { this.bitmapFont.CreateString(this.VAO, this.String, this.Color, this.Justification, 1f); } else { this.VAO = this.bitmapFont.CreateString(this.Program, this.String, this.Color, this.Justification, 1f); this.VAO.DisposeChildren = true; } this.TextSize = new Point(this.bitmapFont.GetWidth(this.text), this.bitmapFont.Height); }
public Text(Text.FontSize font, string text, Vector3 color, BMFont.Justification justification = BMFont.Justification.Left) : this(Shaders.FontShader, Text.FontFromSize(font), text, color, justification) { }