整合了几篇文章,并进行了修改测试。成功之后,放出来供大家参考。
- 字体下载
https://download.csdn.net/download/quantum7/12600359
不知道哪个字体能显示汉字,那就下载几个。吾初始都是设置为0,系统自动增加。
- 代码
中文能显示,英文当然更能了。
#include
#include
#include
#include
#include
#include FT_FREETYPE_H
#define FONT_FILE "/home/quantum6/code/test-fonts/simsun.ttc"
int main()
{
FT_Library m_pFTLib;
FT_Face m_pFTFace;
int i=0;
int j=0;
wchar_t chinese_char = L'泰';
FT_Error result = FT_Init_FreeType(&m_pFTLib);
if(FT_New_Face(m_pFTLib, FONT_FILE, 0, &m_pFTFace))
{
printf("FT_New_Face error!\n");
return;
}
//FT_ENCODING_GB2312, FT_ENCODING_UNICODE
FT_Select_Charmap(m_pFTFace, FT_ENCODING_UNICODE);
FT_Set_Char_Size(m_pFTFace, 0, 12glyph->bitmap;
int h = bmp.rows;
int w = bmp.width;
for (i=0; i
关注
打赏
热门博文
- 历史最高名次:17
- 日常收集的妙语
- git更新:Your local changes to the following files would be overwritten by merge
- Github通过PR提交代码到开源库
- Github参与OpenJDK8的开发指南
- FreeType可以指定斜体值了!祝贺修改代码整合进入FreeType
- JDK/FreeType中关于斜的英文有哪些
- WINDOWS编译ffmpeg:LINK : fatal error LNK1104: 无法打开文件“LIBCMT.lib”
- 全网首发:编译ffmpeg: error: ‘VFW_E_NOT_FOUND‘ undeclared ; did you mean ‘NTE_NOT_FOUND‘?
- WINDOWS+VS2012+msys2编译ffmpeg成功,DLL不能用