缘起:区区想用symbian系统API,把系统字体的字模实时获取出来。
所谓字模又叫glyph,有向量表达(paths)和位图表达(bitmap),这个之前弄freetype和ndsl编程时已经很熟悉。
关键是在处处不熟悉的S60平台,很多东西文档讲不全。如果算自然时间,我一个朋前就想实现这个功能,直到昨天才算有眉目,
BS Nokia公司的文档!!!
文档具体地点:S60 Developer Tools 3rd Edtion SDK / 1.1 MR/ SDK help, 索引关键字为:TPositionParam
这是CFont的嵌套类,文档内容为:
class TPositionParam;
Complicated parameter block used for contextual glyph selection, ligature creation and diacritic placement when drawing text in complex scripts
This class declares a constructor, another scoped class, and several other enums. However this class is unlikely to be useful to third party developers.
注意最后这句However...... unlikely。。。
Nokia你要么整点有用的,要么别发布这个接口啊,从v1取v5都是这句废话,害区区找不到,搞不清。
花了一下午试验,还是没搞清其iOutput下的iBitmap是个什么结构,也许太心烦了。
回家后重新一想,bitmap这种结构应该有些通用习惯吧?于是问问wiki,,找到这个http://en.wikipedia.org/wiki/Glyph_Bitmap_Distribution_Format
里面有个'A'字模的例子:
STARTFONT 2.1
FONT -gnu-unifont-medium-r-normal--16-160-75-75-c-80-iso10646-1
SIZE 16 75 75
FONTBOUNDINGBOX 16 16 0 -2
STARTPROPERTIES 2
FONT_ASCENT 14
FONT_DESCENT 2
ENDPROPERTIES
CHARS 1
STARTCHAR U+0041
ENCODING 65
SWIDTH 500 0
DWIDTH 8 0
BBX 8 16 0 -2
BITMAP
00
00
00
00
18
24
24
42
42
7E
42
42
42
42
00
00
ENDCHAR
ENDFONT
我不清楚s60的会不会也是这个,明天我再试试吧!
调试脚本先准备好:
(defun binary-rep-text ()
(interactive)
(backward-word 1)
(let* ((word (buffer-substring (point) (progn (forward-word) (point))))
(num (string-to-int word 16)))
(backward-kill-word 1)
(dotimes (time 8)
(insert (format "%d " (logand (lsh num (- time)) 1)) )
(backward-word)
)))
睡觉睡觉,开始做symbian之后,休息显得不足^_