(1. Find the bottleneck )
Fbiterm use the XFont to implement pcf & bdf font rendering. The dependency has two aspect: one is dependency of compiling, the other is dependency of linking.
The dependency of linking can be displayed via “ldd fbiterm", and it contains:
libXfont.so => /usr/lib/libXfont.so.1
,I trace the undefined function object in fbiterm via “nm fbiterm" and related file “PREFIX/src/font.c". Found! Fbiterm invoke serverl subroutine from the font.c:
,and I find their implementations depend on XFont.To cut off the dependency, we should implement the subroutines ourself to shrink the use of XFont, and link them locally into fbiterm.
(2. start to patch)
We need to tweak the header to solve the compiling dependency.
The compiling errors occur most on the X11 related headers, which locate in “PREFIX/include/". Remove all “" including, then compile-error & copy-patch all the neccessary declarations. The process is really tedious and slow, all I can do is to trace and trace the code again.
Hardest part is to reimplement “load_font" in “PREFIX/src/font.c".
“FontFileOPen, FontFileClose" can be substituded by FreeType’s face loading, and “bdfReadFont" can also take out of the consideration. But “pcfReadFont" is complicated. I plan to use Freetype libraries to setup the FontInfo. But it not as easy as imagine. The terminologies are strange to me. And I should to compare them with the terminologies of Freetype.
A specification of PCF file format is really useful. There is a great site which collects many format’s specifications:
這裡有一個網頁介紹了用XFont, FreeType, Xft, Fontconfig, Pango五種不同的方法操作字型:
1. char_code( 字的編碼 )
3. font_width, font_height
4. font_engine handler