- 论坛徽章:
- 5
|
本帖最后由 nketc 于 2011-03-14 21:31 编辑
gtk中字体部分的架构是:
使用 pango 来完成文本的排版和渲染(这是上层的高级功能)
使用 fontconfig 来完成字体的管理 (比如我这个系统上有多少可用的字体等)
使用 freetype 把字符转化为字型。
problem:
1.怎样知道系统支持哪些字体
安装有gtk的系统会有一个fc-list使用程序,执行它,就会列出目前可用的字体。fc-list 是fontconfig的一部分。
下面是我这儿的部分输出:- thinkpad@laptop:~/workspace$ fc-list
- Verdana:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
- Liberation Mono:style=Regular
- Umpush:style=Oblique
- Nimbus Sans L:style=Regular Italic
- DejaVu Serif,DejaVu Serif Condensed:style=Condensed,Book
- WenQuanYi Bitmap Song:style=Bold
- Times New Roman:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,thường,Arrunta
- Webdings:style=Regular
- LMRoman10:style=DunhillOblique
- LMSans10:style=DemiCondensedOblique
- LMSans9:style=Regular
- LMSans8:style=Regular
复制代码 2.有详细的资料可推荐怎样填写str格式才不至于出问题呢
请参考pango的相关文档。
3.如果有个自定义的字体库,如何才能在pango里面使用他呢?
在系统的 /etc/fonts/ 下有个文件:fonts.conf,部分内容如下:- 23
- 24 <!-- Font directory list -->
- 25
- 26 <dir>/usr/share/fonts</dir>
- 27 <dir>/usr/share/X11/fonts</dir> <dir>/usr/local/share/fonts</dir>
- 28 <dir>~/.fonts</dir>
- 29
- 30 <!--
- 31 Accept deprecated 'mono' alias, replacing it with 'monospace'
- 32 -->
复制代码 只要把字体所在的路径填上,然后执行 fc-cache 即可。fc-cache也是fontconfig的一部分。 |
|