android自定義View繪制的時候,會有很多情況下要與字體打交道,涉及到字體寬度、高度的時候要特別注意一下幾個概念,見圖:

baseLine:一行文字的底線。
Ascent: 字符頂部到baseLine的距離。
Descent: 字符底部到baseLine的距離。
Leading: 字符行間距。
基線(baeseline),坡頂(ascenter),坡底(descenter)上坡度(ascent),下坡度(descent)行間距(leading):坡底到下一行坡頂?shù)木嚯x字體的高度=上坡度+下坡度+行間距ascent是指從一個字的基線(baseline)到最頂部的距離,descent是指一個字的基線到最底部的距離注意, ascent和top都是負數(shù)