Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extended KotD #18: _ULINESPACING
#1
Welcome to another KotD. In this edition, we're exploring _ULineSpacing. I'm hosting KotD this week. While my writing skills may not match Steve's, I will do my best. Full disclosure: I'm not a typography expert. Much of the content below is based on what I learned during the rewrite of the QB64-PE font support.

In the last KotD, Steve discussed _UFontHeight. You might be curious about the difference between _UFontHeight and _ULineSpacing, as they seem similar and can even return identical values. However, they are quite different; _UFontHeight returns the global glyph height of a font, whereas _ULineSpacing returns the height from one baseline to the next (baseline-to-baseline height).

[Image: textpg-intro-2x.png][Image: fontmetrics6-4072431861.gif]


The baseline is the imaginary line on which characters sit, serving as a reference point for glyph placement within a font. The ascent is the maximum pixel height above the baseline and is typically a positive value. The descent is the maximum pixel depth below the baseline, usually a negative value. The line gap represents the extra spacing required between two lines of text.

Therefore, baseline-to-baseline height can be expressed using the following formula:

baseline-to-baseline height = ascent − descent + linegap

So, what does this all mean? Essentially, it means that when printing multiple lines and needing to calculate the Y pixel positions, one should use _ULineSpacing instead of _UFontHeight.

That's all there is to it!

_ULINESPACING - QB64 Phoenix Edition Wiki
Reply


Messages In This Thread
Extended KotD #18: _ULINESPACING - by a740g - 06-24-2024, 05:19 AM
RE: Extended KotD #18: _ULineSpacing - by luke - 06-25-2024, 11:39 AM



Users browsing this thread: 3 Guest(s)