Code: [show] | [select all]
路径请根据实际情况修改,其中 -lpng -lz 不是必须的(也是根据实际情况)。gcc -static -std=c11 char_a.c -o char_a ^ -ID:/lib/freetype-2.7/include ^ -LD:/lib/freetype-2.7/objs/.libs ^ -lfreetype -lpng -lz
运行输出:
省略了相关的错误处理、判断,仅供参考,不建议在实际中使用这种方式。rows: 16, cols: 22 1111111111111111110000 1111111111111111111100 1111110000001111111110 1111110000000001111110 1111110000000001111110 1111110000000011111110 1111111111111111111100 1111111111111111110000 1111111111111111111110 1111110000000111111111 1111110000000000111111 1111110000000000011111 1111110000000000111111 1111110000000111111111 1111111111111111111100 1111111111111111110000
请注意获取的点阵尺寸和这里设置的并不相同
FT_Set_Pixel_Sizes( face, 50, 25 ); /* 像素宽度,高度 */
官方的说法是:
You should not rely on the resulting glyphs matching, or being constrained, to this pixel size. Refer to FT_Request_Size to understand how requested sizes relate to actual sizes.
Don't use this function if you are using the FreeType cache API.
环境配置可以参考 http://www.code-by.org/viewtopic.php?f=55&t=134