ScaledSpriteFont
ScaledSpriteFont is a SpriteFontBase that renders another font ("base font") at a different scale. It does not rasterize any glyphs itself — it simply wraps an existing font and scales all drawing operations by a fixed Scale factor.
How it works
When created, ScaledSpriteFont wraps a baseFont and a scale:
var scaledFont = new ScaledSpriteFont(baseFont, scale);
All text rendering operations delegate to the base font, adjusting parameters so the visual result matches the requested size:
- Scale — the overall scale is multiplied by
Scalewhen drawing glyphs. - Origin, character spacing, and line spacing — divided by
Scale(i.e. multiplied by the inverse scale) before being passed to the base font, so the measured properties stay consistent with the displayed size. - Kerning — the base font's kerning is multiplied by
Scale. - Text bounds — computed from the base font at the inverse scale, then scaled up by
Scale.