private void Initialize(FontMaster masterFont, FontSizes fontMultiple)
{
FontImage = masterFont.Image;
MaxGlyphIndex = masterFont.Rows * masterFont.Columns - 1;
switch (fontMultiple)
{
case FontSizes.Quarter:
Size = new Point((int)(masterFont.GlyphWidth * 0.25), (int)(masterFont.GlyphHeight * 0.25));
break;
case FontSizes.Half:
Size = new Point((int)(masterFont.GlyphWidth * 0.5), (int)(masterFont.GlyphHeight * 0.5));
break;
case FontSizes.One:
Size = new Point(masterFont.GlyphWidth, masterFont.GlyphHeight);
break;
case FontSizes.Two:
Size = new Point(masterFont.GlyphWidth * 2, masterFont.GlyphHeight * 2);
break;
case FontSizes.Three:
Size = new Point(masterFont.GlyphWidth * 3, masterFont.GlyphHeight * 3);
break;
case FontSizes.Four:
Size = new Point(masterFont.GlyphWidth * 4, masterFont.GlyphHeight * 4);
break;
default:
break;
}
if (Size.X == 0 || Size.Y == 0)
throw new ArgumentException($"This font cannot use size {fontMultiple.ToString()}, at least one axis is 0.", "fontMultiple");
SizeMultiple = fontMultiple;
Name = masterFont.Name;
GlyphIndexRects = masterFont.GlyphIndexRects;
SolidGlyphIndex = masterFont.SolidGlyphIndex;
Rows = masterFont.Rows;
Columns = masterFont.Columns;
}