Cocos2d的位图字体.fnt是有http://www.angelcode.com/products/bmfont/定义的。
这个位图字体基础是True Type, Free Type开发库可以读取字体的各种信息。
出处:
http://www.angelcode.com/products/bmfont/
格式解释:
http://www.angelcode.com/products/bmfont/doc/file_format.html#tags
绘制指南
http://www.angelcode.com/products/bmfont/doc/render_text.html
Free Type库也有关于外形、排版的信息解释。
http://www.freetype.org/freetype2/documentation.html
http://www.freetype.org/freetype2/docs/tutorial/step2.html
还有一些文档描述了相关信息
[Android]Android字体高度的研究
http://sd4886656.iteye.com/blog/1200890
Step By Step(Java 2D图形篇<四>)
http://www.cnblogs.com/stephen-liu74/archive/2011/10/14/2186737.html
摘录如下:
android自定义View绘制的时候,会有很多情况下要与字体打交道,涉及到字体宽度、高度的时候要特别注意一下几个概念,见图:
baseLine:一行文字的底线。
Ascent: 字符顶部到baseLine的距离。
Descent: 字符底部到baseLine的距离。
Leading: 字符行间距。
7) 字体属性(FontMetrics)的常用参量:
Baseline: 字体的基线,如g.drawString("Hello",x,BaselineY)
getAscent(): 字体的上差值,在所有的数字和字符中,其最高点到基线的距离
getDescent(): 字体的下差值,在所有的数字和字符中,其最低点到基线的距离
getLeading(): 当前行的Descend到下一行Ascend之间的距离
getHeigth(): 字体的高度 = Ascent + Descent + Leading.
下面的示例代码在运行后,可以显示的给出各个参量所表示的具体范围。
还有advance字符占位, kern字符组合间距等信息。advance是从左到右移动,kern是微调advance当前点。
注:advance点是在baseline上。