import { type Font } from "https://deno.land/x/canvas@v1.4.1/mod.ts";
See SkFont.h for more on this class.
Methods
Retrieves the bounds for each glyph in glyphs. If paint is not null, its stroking, PathEffect, and MaskFilter fields are respected. These are returned as flattened rectangles. For each glyph, there will be 4 floats for left, top, right, bottom (relative to 0, 0) for that glyph.
Retrieves the glyph ids for each code point in the provided string. This call is passed to the typeface of this font. Note that glyph IDs are typeface-dependent; different faces may have different ids for the same code point.
Retrieves the advanceX measurements for each glyph. If paint is not null, its stroking, PathEffect, and MaskFilter fields are respected. One width per glyph is returned in the returned array.
Computes any intersections of a thick "line" and a run of positionsed glyphs. The thick line is represented as a top and bottom coordinate (positive for below the baseline, negative for above). If there are no intersections (e.g. if this is intended as an underline, and there are no "collisions") then the returned array will be empty. If there are intersections, the array will contain pairs of X coordinates [start, end] for each segment that intersected with a glyph.
Requests, but does not require, that edge pixels draw opaque or with partial transparency.
Requests, but does not require, linearly scalable font and glyph metrics.
For outline fonts 'true' means font and glyph metrics should ignore hinting and rounding. Note that some bitmap formats may not be able to scale linearly and will ignore this flag.
Sets the typeface to use with this font. null means to clear the typeface and use the default one.