androidtextmeasurement

Paint.getTextWidths. What is advance width?


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?”


Solution

  • 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.