Linux, FreeBSD, and other open-source operating systems generally use FreeType to display text. Some software in windows, such as Foxit, also have FreeType. The font_engine_freetype_int16 font_engine_freetype_int16 text engine of idea uses FreeType to obtain the model. In Windows, We must compile FreeType before using font_engine_freetype_int16:
- Download FreeType2 from www.freetype.org and unzip the latest freetype-2.3.9.
- Take vc2005 express as an example to directly compile FreeType. sln in/builds/Win32/vc2005. (But this version of FreeType. SLN is better. Open it in a text editor and change "10.00" next to "Microsoft Visual Studio solution file, format version 10.00" to "9.00)
- For other compilers, such as C ++ builder, directly install/docs/install. add the files listed in any to the project (however, it is really troublesome to add these files to the east and west. You can click here to download the FreeType2 library compilation project of C ++ builder ).
- Add the compiled library file (in/objs/Win32, pay attention to the compiled version) to the project, and set the include path to FreeType-2.3.9/include.
Using FreeType's source code:Typedef Syntax: font_engine_freetype_int16 fe_type; Typedef fe_type: path_adaptor_type vs_type; Fe_type Fe; If (! Fe. load_font ("C: // windows // fonts // simhei. TTF", 0, usage: glyph_ren_outline) return; Fe. Height (36.0 ); Fe. flip_y (true ); Fe. hinting (true ); Wchar_t * s = l "C ++ programming "; STD: vector <weight: int8u> data; Vs_type; Usage: conv_curve <vs_type> ccvs (); Int x = 20, y = 100; For (; * s; s ++) { If (! Fe. prepare_glyph (* s) continue; Data. Resize (Fe. data_size ()); Fe. write_glyph_to (& Data [0]); Vs. INIT (& Data [0], Data. Size (), x, y ); X + = Fe. advance_x (); Y + = Fe. advance_y (); RAS. add_path (ccvs ); Expiration: render_scanlines_aa_solid (Ras, SL, renb, placement: rgba (, 1 )); } |