FreeType is a fully open-source, scalable, customizable, and portable font engine that provides a unified interface for TrueType font-driven access to various font format files,
Including dot matrix characters, TrueType, OpenType, type1, and so on.
When it comes to FreeType's usage, the document that comes with it has already been clearly described. Here is a summary:
First, we need to understand the implementation process of vector text:
1) given a text, whether it is the Shenma encoding method (ASCII, GBK, Unicode, big5), you can determine its encoding Value
2) locate "glyph" in the font file based on the encoding Value"
3) set the font size
4) use some functions to scale the vertices in the glyph to the font size.
5) convert to bitmap Lattice
6) display on LCD
Follow these steps and refer to the document to determine the code writing steps. // note: the code is taken from the example provided in this document.
1) initialization
Error = ft_init_freetype (& library);/* initialize library */
2) load the font face/* The font. Which of the following has a good translation? Ask for advice */
Error = ft_new_face (library, argv [1], 0, & face);/* Create face object */
3) set the font size
Error = ft_set_char_size (face, 50 × 64, 0,100, 0);/* Set character size */
Ft_set_pixel_sizes (face, 24, 0 );
4) transform (move/rotate)
Ft_set_transform (face, & matrix, & pen );
5) Load glyph/* According to the encoding value. This process is complex. However, if the FreeType code is well written, all functions can be done */
Error = ft_load_char (face, text [N], ft_load_render );
6) convert to a bitmap
Draw_bitmap (& slot-> bitmap,Slot-> bitmap_left,Target_height-Slot-> bitmap_top );
7) print
Show_image ();
In one breath, nice
FreeType usage Summary