Otherwise, the glyph only has a bitmap image. True if the glyph has a vector outline, in which case it is safe to call outline_decompose(). Could potentially return codes in other character sets if the font doesn't have a Unicode character mapping, but most modern fonts do.
#ARRANGE FREETYPE FONT GLYPHS CODE#
The character code (in Unicode) of the glyph. For a detailed description of the format see It is not an efficient format, but can be read by many image manipulation programs. The PGM image returned is in the 'binary' format, with one byte per pixel. The optional render-mode is passed directly to the bitmap() method. It renders the bitmap and constructs it into a PGM (portable grey-map) image file, which it returns as a string. bitmap_pgm()Ī simple wrapper around the bitmap() method. This method, particularly the use of the left and top offsets for correct positioning of the bitmap, is demonstrated in the example program. The left and top distances in pixels are returned as well, in the same way as for the bitmap() method. The image is in the 'gray' format, with a depth of 8 bits. Renders the bitmap as normal and returns it as an Image::Magick object, which can then be composited onto a larger bitmapped image, or manipulated using any of the features available in Image::Magick. bitmap_magick()Ī simple wrapper around the bitmap() method.
Only available with Freetype version 2.1.3 or newer. Render in colour for an LCD display, with three times as many rows down the image as normal.
Render in colour for an LCD display, with three times as many pixels across the image as normal. Only available with Freetype version 2.1.4 or newer. FT_RENDER_MODE_LIGHTĬhanges the hinting algorithm to make the glyph image closer to it's real shape, but probably more fuzzy. My $height = optional render_mode argument can be any one of the following: FT_RENDER_MODE_NORMAL The size of the bitmap can be obtained as follows: my ($bitmap, $left, $top) = $glyph->bitmap Antialiasing is performed by default, but can be turned off by passing the FT_RENDER_MODE_MONO option. If antialiasing is used then shades of grey between 0 and 255 may occur. A value of 0 indicates background (outside the glyph outline), and 255 represents a point inside the outline. Each item is a string of bytes, with one byte representing one pixel of the image, starting from the left. Each item in the array represents a line of the bitmap, starting from the top. The bitmap value is a reference to an array. Three values are returned: the bitmap itself, the number of pixels from the origin to where the left of the area the bitmap describes, and the number of pixels from the origin to the top of the area of the bitmap (positive being up). If it is from a vector font, then the outline is rendered into a bitmap at the face's current size. If the glyph is from a bitmap font, the bitmap image is returned. Unless otherwise stated, all methods will die if there is an error, and the metrics are scaled to the size of the font face. Render a bitmap image of the glyph (if it's from a vector font) or extract the existing bitmap (if it's from a bitmap font), using the bitmap() method.Įxtract a precise description of the lines and curves that make up the glyph's outline, using the outline_decompose() method.įor a detailed description of the meaning of glyph metrics, and the structure of vectorial outlines, see METHODS Get metadata about the glyph, such as the size of its image and other metrics.
#ARRANGE FREETYPE FONT GLYPHS HOW TO#
See Font::FreeType::Face for how to obtain a glyph object, in particular the glyph_from_char_code() and glyph_from_char() methods. This class represents an individual glyph (character image) loaded from a font. # Render into an array of strings, one byte per pixel. My $glyph = $face->glyph_from_char_code(65) Font::FreeType::Glyph - glyphs from font typefaces loaded from Font::FreeType SYNOPSIS use Font::FreeType