简体   繁体   English

如何在freetype中绘制粗体和斜体字体

[英]how to draw font with bold and italic in freetype

I did print unicode text in my program using FTGL. 我使用FTGL在程序中打印了unicode文本。 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 arial- italic .ttf

With arial unicode ms, and the other I set the flag, but it's not working 使用arial unicode ms,另一个我设置标志,但它不起作用

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. 我已经阅读了freetype主页文章,但我仍然不知道。

You need an actual ttf or otf file to represent italic, bold, and strikeout ect. 您需要一个实际的ttf或otf文件来表示斜体,粗体和删除线等。 Arial is actually comprised of multiple files, as are most fonts, for each style. 对于每种样式,Arial实际上由多个文件组成,大多数字体也是如此。 To represent italic in FreeType, just pass the ariali.ttf file to FT_New_Face and you will be able to render in italics. 要在FreeType中表示斜体,只需将ariali.ttf文件传递给FT_New_Face,您就可以用斜体进行渲染。 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. 一个好主意是创建一个管理字体面和字体的FontManager,这样您就可以创建多种类型的字体,这些字体具有不同的样式和大小,而无需再次重新创建它们。 Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM