Skip to main content
raoulduke007
Participant
February 21, 2015
Answered

How does Illustrator calculate the Em Box Height?

  • February 21, 2015
  • 1 reply
  • 1412 views

I'm trying to determine how Illustrator calculates the baseline position from the top of the bounding box for a Point Text object.  It appears to be the same distance as an Area Text object with the First Baseline setting set to Em Box Height.  I just can't figure out what property in a font's metrics this corresponds to.  Illustrator's help defines it as:

"The top of the em box in Asian fonts touches the top of the type object. This option is available regardless of the Show Asian Options preference."

For some fonts, this distance seems to be close the the font's ascender but this doesn't hold true for every font.  Any clues how Illustrator calculates this?

This topic has been closed for replies.
Correct answer CarlosCanto

here you go

var idoc = app.activeDocument;

var itext = idoc.selection[0];

var top = itext.position[1];

var base = itext.anchor[1];

alert('Em? size: ' + (top-base));

1 reply

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
February 21, 2015

here you go

var idoc = app.activeDocument;

var itext = idoc.selection[0];

var top = itext.position[1];

var base = itext.anchor[1];

alert('Em? size: ' + (top-base));

raoulduke007
Participant
February 22, 2015

Yes!  I don't know how I missed the anchor property.  This is exactly what I was looking for.  Thank you!!

I'm still a little curious how Illustrator determines the baseline position as it relates to a font's metrics.  However, it doesn't really matter -- I can do what I need to do now.

CarlosCanto
Community Expert
Community Expert
February 22, 2015

The baseline must be the text "path", the only known value, plus the overall bounding box