Paint.getTextWidths. What is advance width?

Deadly 提交于 2020-07-18 07:20:20

问题


What is advance width?

The term comes up in the android class Paint, specifically the function getTextWidths(). The documentation states “Return the advance widths for the characters in the string”.

what is the “advance widths?”


回答1:


Advance Width is a metrics term related to fonts/typography. There are some Q&A's here on SO that cover it, but the short definition is more or less:

The advance width is the distance between the glyph's initial pen position and the next glyph's initial pen position.

A visualization usually makes things easier to understand, so have a look at the image below.

enter image description here

Image courtesy of freetype.org.

Similar to the advance width, there is also a less frequently used advance height:

enter image description here

Image courtesy of freetype.org.

Freetype's article on glyps metrics goes more in depth about the various metrics. Might be worth a read if you're interested.

Note: I'm in no way affiliated with Freetype.org. I just happen to find their documentation on this matter useful.



来源:https://stackoverflow.com/questions/20103312/paint-gettextwidths-what-is-advance-width

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!