Skip to main content
Inspiring
September 11, 2014
Answered

Is there any API to get the x-height or corpus height of the text?

  • September 11, 2014
  • 1 reply
  • 721 views

Hello all,

I am looking into the api to get the x-height or corpus size of the text. But so far I am not able to find any API through which we can do this.

Can anyone knows how we can get the x-height?

FYI x-height - Wikipedia, the free encyclopedia

Thanks for any help..

This topic has been closed for replies.
Correct answer A. Patterson

Adobe doesn't really provide font details through their API. You might be able to calculate it using system calls about the font in question though; Illustrator's internal coordinate system is pixels, so if you can figure out the pixel height of the x-height from queries about the font through the OS, that might be the same as in Illustrator.

1 reply

A. Patterson
A. PattersonCorrect answer
Inspiring
September 11, 2014

Adobe doesn't really provide font details through their API. You might be able to calculate it using system calls about the font in question though; Illustrator's internal coordinate system is pixels, so if you can figure out the pixel height of the x-height from queries about the font through the OS, that might be the same as in Illustrator.

Inspiring
September 11, 2014

Thanks for the reply,

I saw an API  GetDistanceToBaseline, it is written in the documentation that this api is used to retrieves the distance to the baseline in the font.

But It's not mention, distance to baseline from where? Is it from the ascent or mean line?

A. Patterson
Inspiring
September 11, 2014

Honestly, I'm not sure I know we use that function in our stuff, so my colleague problems knows more than I (she has written most of our text stuff). There are some methods in the GlyphRunSuite that kind of feign in the direction of that kind of information (GetMinCapHeight(), GetMaxCapHeight(), etc.) but nothing as specific as you're looking for. I'm pretty sure I saw something that gave you the ascender height (maybe descender too?) but not its far from complete. If you haven't already, open ATESuites.h and see what you can find. They're clearly not striving for complete font metrics though, which is kind of a shame -- we'd certainly make use of that if it was in there.