Cairo user font API
剛剛發現 [
poppler] 無法在我這台 Ubuntu Dapper 的機器編譯,錯誤訊息如下:
CairoFontEngine.cc:82: error: 'cairo_user_font_backend_t' does not name a type
CairoFontEngine.cc:85: error: 'cairo_user_font_backend_t' does not name a type
CairoFontEngine.cc: In constructor
'CairoType3Font::CairoType3Font(GfxFont*, XRef*)':
CairoFontEngine.cc:97: error: 'font_backend' was not declared in this scope
CairoFontEngine.cc:97: error: 'cairo_user_font_face_create' was not declared
in this scope
make[3]: *** [CairoFontEngine.lo] Error 1
make[3]: Leaving directory `/home/jserv/misc/poppler/poppler'
而系統安裝的 Cairo 版本為 1.1.1-0ubuntu1,應該很新了,又,查閱 cvs commit log:
revision 1.21
date: 2006-05-19 19:21:59 +0000; author: krh;
state: Exp; lines: +311 -36
2006-05-19 Kristian Høgsberg
Memory leak patch from Carlos Garcia Campos (#6947).
* glib/poppler-action.cc:
* glib/poppler-document.cc:
* glib/poppler-page.cc:
* poppler/CairoFontEngine.cc:
* poppler/CairoFontEngine.h:
* poppler/CairoOutputDev.cc:
* poppler/CairoOutputDev.h:
* poppler/Gfx.cc:
* poppler/TextOutputDev.cc: Fix various memory leaks.
似乎沒有太特別之處,到底是怎麼一回事呢?
Kristian Høgsberg (poppler 計畫維護人與 Cairo/GTK+ 相關軟體的開發者) 在 Cairo mailing-list 提出過 [
User font take 2] 的提案,引入一系列新的 API 與 structure 來作 Type3 的 user font rendering,Keith Packard 在 [
回覆的文章] 提到:
It seems like something very similar to the PS Type3 mechanism would work nicely and avoid a huge pile of application and cairo complexity / locking issues.
Kristian Høgsberg 則在 [
隨後的文章] 做了補充:
So thinking about this, yeah, this might just work. I was working with different assumptions, though; that the API should support on demand loading of glyphs (to support fonts with a large number of
glyphs) and that we would want to do hinting. However, none of the custom document fonts (ps and pdf type3 font, svg fonts) that would use this feature support hinting and it's probably a safe assumption that none of these font formats will be used for big fonts. In the event that we need to support a new full featured font format, that's
better done as a full cairo font backend or in freetype anyway.
該 thread 系列文章對釐清 Cairo user font 新的 API 的概念很有幫助,commit log 可參考 Cairo git log 與 PDF Type3 相關的細節。
由 jserv 發表於 May 22, 2006 04:12 AM