Enum TrueTypeTarget
Which rasterizer the TrueType interpreter answers for: what GETINFO tells the font and how instructions are softened.
public enum TrueTypeTarget
Fields
FreeType = 2A FreeType-like target: version 40 with ClearType and subpixel positioning.
Gdi = 1GDI ClearType, as measured: version 42 with ClearType, compatible widths and symmetric rendering (GETINFO 0x46C2A).
GdiPlus = 0GDI+ with ClearTypeGridFit, as measured on Windows: rasterizer version 42 with ClearType (GETINFO 0x2C2A).
Examples
// The font's own TrueType instructions, run for GDI+, with its hinted advances: glyphs on whole pixels, spacing as Windows
// lays out ClearType text. Together with GDI+'s filter, sampling and gamma (1 + TextContrast/10 = 1.4), this is the closest
// Egami gets to System.Drawing's ClearTypeGridFit.
var label = new Font(face, 16)
{
Hinting = FontHinting.Full,
HintingTarget = TrueTypeTarget.GdiPlus,
Metrics = FontMetrics.GridFitted,
Edging = FontEdging.Lcd,
};
var gdiPlus = new CanvasOptions
{
PixelGeometry = PixelGeometry.RgbHorizontal,
LcdFilter = LcdFilter.Gdi,
LcdSampling = LcdSampling.Gdi,
TextGamma = 1.4f,
};
using (RasterCanvas<Rgb8> canvas = button.CreateCanvas(gdiPlus))
{
// Measuring uses the same hinted advances, so centring is exact.
float width = label.MeasureText("Start the course").Advance;
canvas.DrawText("Start the course", new Vector2(MathF.Round((200 - width) / 2), 26), label, Rgba8.White);
}