Without Canvas(HTML5 element), how to measure TextMetrics like ascent, descent, CapHeight of font in JavaScript

453 Views Asked by At

Note:

  1. I need ascent descent and CapHeight of font and not just line-height.
  2. Need metrics using client-side Scripting(JavaScipt).
1

There are 1 best solutions below

0
On

You can use opentype.js to parse a font to get values in the font's OS/2 table. For ascent, descent and cap height, use the sTypoAscender, sTypoDescender and sCapHeight fields.