[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 如何找出一個漢字所對應的字體



On Fri, Apr 12, 2002 at 02:15:29AM -0700, Chen sheng wrote:
> 我是為了在OpenGL中顯示漢字, 才要處理字體的.
> 如果你對OpenGL感興趣, 我不妨說得具體一點.
> 
> OpenGL是這樣處理字體的, 例如要顯示ASCII字符,
> 先用glXUseXFont從字體font中取出前127個字符的字形,
> 放到以listBase開始的地方:
> glXUseXFont(font, 0, 127, listBase);
> 
> 然後如果我要顯示字符'A', 就用glCallList顯示'A'所在
> 位置的字形. 因為'A'=65, 'A'所在位置為listBase + 65,
> 所以用:
> glCallList(listBase + 65);
> 
> 顯示漢字也是類似的, 只不過glXUseXFont要把所有的漢字
> 裝載進去.

查了一下,你這好象是使用glx處理漢字,我在google上看到
有freetype的opengl binding,應該比glx容易用,你可以看
一下。

> 
> 以上這種顯示漢字的方法是我目前正在做的, 缺點是我要
> 自己處理漢字. 還有一種方法就是利用XmbDrawString把
> 一個mb_string做成bitmap, 再通過glBitmap顯示出來,
> 這樣一來所有處理漢字的工作都由XmbDrawString完成了.
> 不過我沒有試過, 因為我不知道如何把mb_string生成
> bitmap. 有誰可以告訴我嗎?
> 

Xlibc 的 drawable 可以是一個pixmap, 所以你自己先要一塊
pixmap,然後在上面寫字就行了。具體的看xlibc的手冊。

pango 對各種文字支持更多,但知道有沒有opengl的renderor.
可能沒有。

-- 
hashao|       五色令人目盲;五音令人耳聾;五味令人口爽;馳騁畋獵,令人
hashao|     心發狂;難得之貨,令人行妨。
hashao|       是以聖人為腹不為目,故去彼取此。

-- 
To UNSUBSCRIBE, email to debian-chinese-gb-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

-- 
| This message was re-posted from debian-chinese-gb@lists.debian.org
| and converted from gb2312 to big5 by an automatic gateway.


-- 
To UNSUBSCRIBE, email to debian-chinese-big5-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: