Showing posts with label fontconfig. Show all posts
Showing posts with label fontconfig. Show all posts

July 23, 2012

libeasyfc 0.9

Well, this article is just to advertise my efforts on libeasyfc again. libeasyfc is a library to allow you to add/modify/remove the fontconfig configuration for your preferred fonts.

Currently it has the following features:
  • Set an alias for sans-serif, serif, monospace, cursive and fantasy per languages.
  • Enable/Disable hinting, auto-hinting, embedded bitmap and anti-aliasing.
  • Set/Unset the sub-pixel geometry and the hint style for auto-hinting.
No GUI in this project, but CLI is available as the example code. or you can use fonts-tweak-tool for GUI. modified version for new release of libeasyfc is also available in my github.

Enjoy!

June 25, 2012

Fontconfig in scheme

This is just experimental and wrote it for learning purpose or testing because it may be helpful to consider modifying the data structure for the better matching rules in the future.

The code just tries to build the pattern from the configuration as similar as possible, but not trying later process. I mean to match the best font in the system against it, like FcFontMatch() does. so strictly speaking this doesn't work as the language binding in scheme but if anyone wants to try, you could use it perhaps.

The code snippets are available here.

just to share this with you.

June 25, 2010

A hack to allow editing the charset and the lang in a font on fontconfig

Background

fontconfig is scanning a font and gathering the information to see what kind of character sets it's possible to support. being used to pick up the certain font according to  a request from a user. having said that all of the fonts doesn't necessarily have certain coverage of the glyphs for certain character sets. so given that missing glyphs are not a big deal or still looks good with a fallback font for them, there should be needs to use such fonts for the certain language anyway.

Syntax

After this hack, two elements are available. <charset> to update the character sets information a.k.a. FcCharSet and <langset> to update the language coverage information a.k.a. FcLangSet. in either case, the element has to have the language name that is available as orth file in fontconfig but without .orth suffix, as CDATA. it looks like:

<match target="scan"> <test name="family"> <string>HanaMin</string> </test> <edit name="charset" mode="assign" binding="strong"> <charset>ja</charset> </edit> <edit name="lang" mode="assign" binding="strong"> <langset>ja</langset> </edit> </match>

And you have to run fc-cache again to re-generate the fontconfig cache file because the above rule only affects the scan phase. then starting to match HanaMin for serif:lang=ja in this case. which originally has zh-hk, zh-mo and zh-tw coverage.

Code

See private git repo

July 2, 2008

Flash 9で日本語が表示されない件

しばし表示されなくて困ってた。今まではxfsの設定ファイルが必要でそこからフォントパスをたどってもげもげとかだったのが、fontconfigに移行した、ところまでは情報として入手できてたけど、Pangoもリンクしててなおさら不自然極まりない挙動に頭を抱えてたが、Pangoはあまり直接関係はないみたいだ。fontconfig単体だけ使った場合には非常にありがちな問題なのだけど、sans-serifから見つけたフォントをそのまま使いつづけるため、最初に掴んだフォントが欧文フォントだと日本語とかがでなくなってしまうということらしい。.fonts.confをいじって日本語フォントを最初につかませるように変えたら問題なくなった。

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
...
<alias>
<family>sans-serif</family>
<prefer>
<family>VL Gothic</family>
</prefer>
</alias>
...
</fontconfig>

October 1, 2007

gmailで英数字がBoldにならない?

問題のフォントはどうもArialらしいんだが、深く原因追及する時間もないので、$HOME/.fonts.confにブラックリストを追加することで回避。
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
...
<selectfont>
...
<rejectfont>
<pattern>
<patelt name="family"><string>Arial</string></patelt>
</pattern>
</rejectfont>
...
</selectfont>
...
</fontconfig>