Struct stb_truetype_bugfix_19072017::FontInfo [] [src]

pub struct FontInfo<Data: Deref<Target = [u8]>> { /* fields omitted */ }

Methods

impl<Data: Deref<Target = [u8]>> FontInfo<Data>
[src]

Given an offset into the file that defines a font, this function builds the necessary cached info for the rest of the system.

If you're going to perform multiple operations on the same character and you want a speed-up, call this function with the character you're going to process, then use glyph-based functions instead of the codepoint-based functions.

Returns the series of vertices encoding the shape of the glyph for this codepoint.

The shape is a series of countours. Each one starts with a moveto, then consists of a series of mixed lineto and curveto segments. A lineto draws a line from previous endpoint to its x,y; a curveto draws a quadratic bezier from previous endpoint to its x,y, using cx,cy as the bezier control point.

Like get_codepoint_box, but takes a glyph index. Use this if you have cached the glyph index for a codepoint.

Gets the bounding box of the visible part of the glyph, in unscaled coordinates

returns true if nothing is drawn for this glyph

Like get_codepoint_shape, but takes a glyph index instead. Use this if you have cached the glyph index for a codepoint.

like get_codepoint_h_metrics, but takes a glyph index instead. Use this if you have cached the glyph index for a codepoint.

like get_codepoint_kern_advance, but takes glyph indices instead. Use this if you have cached the glyph indices for the codepoints.

an additional amount to add to the 'advance' value between cp1 and cp2

left_side_bearing is the offset from the current horizontal position to the left edge of the character advance_width is the offset from the current horizontal position to the next horizontal position these are expressed in unscaled coordinates

ascent is the coordinate above the baseline the font extends; descent is the coordinate below the baseline the font extends (i.e. it is typically negative) line_gap is the spacing between one row's descent and the next row's ascent... so you should advance the vertical position by ascent - descent + line_gap these are expressed in unscaled coordinates, so you must multiply by the scale factor for a given size

the bounding box around all possible characters

computes a scale factor to produce a font whose "height" is 'pixels' tall. Height is measured as the distance from the highest ascender to the lowest descender; in other words, it's equivalent to calling GetFontVMetrics and computing: scale = pixels / (ascent - descent) so if you prefer to measure height by the ascent only, use a similar calculation.

computes a scale factor to produce a font whose EM size is mapped to pixels tall. This is probably what traditional APIs compute, but I'm not positive.

like get_codepoint_bitmap_box_subpixel, but takes a glyph index instead of a codepoint.

like get_codepoint_bitmap_box, but takes a glyph index instead of a codepoint.

same as get_codepoint_bitmap_box, but you can specify a subpixel shift for the character

get the bounding box of the bitmap centered around the glyph origin; so the bitmap width is x1-x0, height is y1-y0, and location to place the bitmap top left is (left_side_bearing*scale, y0). (Note that the bitmap uses y-increases-down, but the shape uses y-increases-up, so CodepointBitmapBox and CodepointBox are inverted.)

Trait Implementations

impl<Data: Clone + Deref<Target = [u8]>> Clone for FontInfo<Data>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more