public static int MeasureString(LCDBitmapFont font, string txt, int spacing = 1) { int width = 0; for (int i = 0; i < txt.Length; i++) { string chr = txt.Substring(i, 1); LCDBitmap charbmp = font.Characters[chr]; width += charbmp.Width + spacing; } return width; }
public void DrawString(int px, int py, LCDBitmapFont font, string txt, int spacing = 1) { int posx = px; for (int i = 0; i < txt.Length; i++) { string chr = txt.Substring(i, 1); LCDBitmap charbmp = font.Characters[chr]; DrawLCDBitmap(charbmp, 0, 0, posx, py, charbmp.Width, charbmp.Height); posx += charbmp.Width + spacing; } }