Raw
NAME
module Font::FreeType::Raw - bindings to the freetype library
SYNOPSIS
# E.g. build an array of advance widths by glyph ID
use Font::FreeType::Face;
use Font::FreeType::Raw;
use Font::FreeType::Raw::Defs;
sub face-unicode-map(Font::FreeType::Face $face) {
my uint16 @advance[$face.num-glyphs];
my FT_Face $struct = $face.raw; # get the raw native face object
my FT_UInt $glyph-idx;
my FT_ULong $char-code = $struct.FT_Get_First_Char( $glyph-idx);
while $glyph-idx {
# FT_Load_Glyph updates $struct.glyph, so is not thread safe
$face.protect: {
$struct.FT_Load_Glyph( $gid, FT_LOAD_NO_SCALE );
@advance[$glyph-idx] = $struct.glyph.metrics.hori-advance;
}
$char-code = $struct.FT_Get_Next_Char( $char-code, $glyph-idx);
}
}
DESCRIPTION
This class contains structure definitions and bindings for the FreeType library.
Containing classes, by convention, have a `raw()` accessor, which can be used, if needed, to gain access to native objects from this class:
Class | raw() binding | Description |
---|
Font::FreeType | FT_Library | A handle to a freetype library instance |
Font::FreeType::Face | FT_Face | A Handle to a typographic face object |
Font::FreeType::Glyph | FT_GlyphSlot | A handle to a glyph container |
Font::FreeType::GlyphImage | FT_Glyph | A specific glyph bitmap or outline object |
Font::FreeType::BitMap | FT_Bitmap | A rendered bitmap for a glyph |
Font::FreeType::Outline | FT_Outline | A scalable glyph outline |