TrueTypeFont
Ecng.Drawing
Minimal managed TrueType 'glyf' outline reader and quadratic rasterizer. Accepts .ttf fonts with Unicode cmap format 4/12 and simple/composite outlines. No platform text engine or managed font package is used.
コンストラクター
TrueTypeFont
public TrueTypeFont(byte[] file)
trueTypeFont = TrueTypeFont(file)
Reads the tables of a font file. The bytes are kept and read from as glyphs are asked for.
メソッド
FromFile
public static TrueTypeFont FromFile(string path)
result = TrueTypeFont.FromFile(path)
Opens the font of a file.
OfFamily
public static TrueTypeFont OfFamily(FontCatalog installed, string family)
result = TrueTypeFont.OfFamily(installed, family)
Opens the font the installed ones offer for a family, and the built-in font if they offer none.
TryRender
public bool TryRender(int width, int height, string text, float size, int margin, byte opacity, TextMask mask)
result = trueTypeFont.TryRender(width, height, text, size, margin, opacity, mask)
Renders a line of text for the bottom right corner of a canvas, as large as asked or as fits.
- width
- Width of the canvas in pixels.
- height
- Height of the canvas in pixels.
- text
- The line.
- size
- The size asked for, in points.
- margin
- The margin asked for, in pixels.
- opacity
- How opaque the text is, 0..255.
- mask
- The line as it is to be drawn.
戻り値: if the canvas has no room for the line, or no pixel of the line would show.