how to draw font with bold and italic in freetype

3.3k views Asked by At

I did print unicode text in my program using FTGL. I want to turn on italic and bold options.

How can I do it?

How can I know a font file has italic?

Does the font file have option about italic or bold?

Can I just check font name like this:

arial-italic.ttf

With arial unicode ms, and the other I set the flag, but it's not working

face->style_flags = FT_STYLE_FLAG_ITALIC;

How can I control it?

I've read the freetype homepage article, but still I don't know.

1

There are 1 answers

0
Ramon Guerrero On BEST ANSWER

You need an actual ttf or otf file to represent italic, bold, and strikeout ect. Arial is actually comprised of multiple files, as are most fonts, for each style. To represent italic in FreeType, just pass the ariali.ttf file to FT_New_Face and you will be able to render in italics. A good idea would be to create a FontManager that manages font faces and fonts, so that you can create multiple types of fonts with different styles and sizes without having to recreate them again. Hope this helps!