有關(guān)字體的一點(diǎn)參考:
TTC和TTF的解釋:
TTC:TrueType Collection file. A scheme where multiple TrueType fonts can be stored in a single file, typically used when only a subset of glyphs changes among different designs. They're used in Japanese fonts, where the Kana glyphs change but the Kanji remain the same.
TTF:The recommended file extension for TrueType font files on the PC. On the Macintosh, exactly the same data is in an *'sfnt' resource. The recommended file extension for the TrueType flavour of *OpenType fonts is also TTF. (But Type 1 flavour OpenType fonts should have an OTF extension.)
所以我個(gè)人認(rèn)為TTF才是一個(gè)將一種字體定義好的文件格式,它里面應(yīng)該包括每個(gè)字的寫法。而TTC是一個(gè)鏈接容器,可能只有部分字體的寫法,其他的字體是從別的TTF中鏈接過(guò)來(lái)的。
ttc 是TrueType的集合,可能會(huì)在一個(gè)ttc文件中包含多個(gè)type 接口??梢杂肍ontLab, 或者 breakttc.exe 將一個(gè)ttc文件分離成多個(gè)ttf文件。
因此,TTC是幾個(gè)TTF合成的字庫(kù),安裝后字體列表中會(huì)看到兩個(gè)以上的字體。兩個(gè)字體中大部分字都一樣時(shí),可以將兩種字體做成一個(gè)TTC文件,現(xiàn)在常見(jiàn)的TTC中的不同字體,漢字一般沒(méi)有差別,只是英文符號(hào)的寬度不一樣,以便適應(yīng)不同的版面要求。
我想說(shuō)的以后的TTC字庫(kù)可能就是一個(gè)發(fā)展趨勢(shì),因?yàn)樗苡袃?yōu)越行,任何字體可以合成TTC字庫(kù)的
生成字形位圖后,我們要將字形位圖轉(zhuǎn)換為我們自己的圖形數(shù)據(jù),生成最接近位圖大小的2的冪次方位圖

/**////This function gets the first power of 2 >= the
///int that we pass it.
inline int next_p2 ( int a )


{
int rval=1;
while(rval<a) rval<<=1;
return rval;
}
位圖數(shù)據(jù)轉(zhuǎn)換為RGBA格式,RGB分別給0xFF而不是別的顏色,因?yàn)檫@樣的話就可以在外界傳入字體顏色 任何傳入字體顏色&0xFF = 字體顏色
alpha數(shù)據(jù),我們就傳入字形位圖的數(shù)據(jù)(里面包含著FreeType生成的反鋸齒位圖的alpha數(shù)據(jù))參考:
http://freetype.sourceforge.net/freetype2/docs/tutorial/step1.html 官方教學(xué)
http://www.linuxforum.net/forum/showflat.php?Board=kylix&Number=592188 對(duì)應(yīng)的中文翻譯
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=43
posted on 2010-09-10 18:28
風(fēng)輕云淡 閱讀(1706)
評(píng)論(0) 編輯 收藏 引用 所屬分類:
GameDevelop