Skip to main content
caring_child5E57
Participant
August 7, 2018
Answered

Line height and containing box height calculation

  • August 7, 2018
  • 1 reply
  • 2503 views

Please can you provide more information how default line height (and its containing box height) is being calculated?

This will be very helpful for me to be able to create plugin which can automatically create pixel perfect html.

I assume font metrics are used for it. For example:

Helvetica Neue Regular:

Em Size = 1000

Win Ascent = Typo Ascent = HHead Ascent = 952

Win Descent = Typo Descent = HHead Descent =  ( - ) 213

Typo Line Gap = HHead Line Gap = 28

Line Height Coefficient = (952 + 213 + 28) / 1000 = 1.193

Using this coefficient I get following Line heights (last two columns are obtained from Adobe XD using Point Text):

Font sizeCoefficientLine HeightLine Height RoundedXD Line HeightXD Container Height
11.1931.193112
21.1932.386223
31.1933.579444
41.1934.772555
51.1935.965666
61.1937.158777
71.1938.351888
81.1939.544101010
91.19310.737111111
101.19311.93121212
111.19313.123131212
121.19314.316141414
131.19315.509161515
141.19316.702171616
151.19317.895181717
161.19319.088191818
171.19320.281202020
181.19321.474212221
191.19322.667232322
201.19323.86242423
211.19325.053252524
221.19326.246262726
231.19327.439272827
241.19328.632292928
251.19329.825303029
261.19331.018313231
271.19332.211323332
281.19333.404333433
291.19334.597353534
301.19335.79363635
1001.193119.3119119116
10001.1931193119311931165

As you can see there are discrepancies highlighted in bold.

1. My line height calculations are different very slightly on few places. Is it result of incorrectly calculated coefficient or is it rounding issue?

2. Containing box size is smaller than line height (I and others will assume it will be about the size of line height), why is it so? Number 1165 for 1000pt font size indicate Ascent + Descent is used for its calculation but even when I used coefficient 1.165 to calculate containing box there ware few differences...

It will be very helpful if you can provide formula or guide how those two are being calculated.

Thank you,

Julius

    This topic has been closed for replies.
    Correct answer Nina_Ramos_Harrison

    Hello Julius!

    Adobe XD doesn't currently support 3rd party plug-in development. I encourage you to upvote this feature request to stay up-to-date on any changes for this https://adobexd.uservoice.com/admin/v3/suggestions/12945705/activity

    Thanks!

    Nina

    Adobe XD

    1 reply

    Nina_Ramos_HarrisonCorrect answer
    Adobe Employee
    August 15, 2018

    Hello Julius!

    Adobe XD doesn't currently support 3rd party plug-in development. I encourage you to upvote this feature request to stay up-to-date on any changes for this https://adobexd.uservoice.com/admin/v3/suggestions/12945705/activity

    Thanks!

    Nina

    Adobe XD