Hi all,
I am having some trouble implementing these font properties: XHeight, Descent, CapHeight, Leading, LineHeight.
The documentation (Font — Xojo documentation) is silent.
Thank you in advance for your help.
DB
Hi all,
I am having some trouble implementing these font properties: XHeight, Descent, CapHeight, Leading, LineHeight.
The documentation (Font — Xojo documentation) is silent.
Thank you in advance for your help.
DB
It would help if you defined what you mean by “trouble”.
You can access the properties FontAscent or TextHeight by writing this:
Var myDouble as Double
Var myGraphics as Graphics
myDouble = myGraphics.FontAscent
myDouble = myGraphics.TextHeight
But what do you have to write to access these properties : XHeight, Descent, CapHeight, Leading, LineHeight ?
DB
I just ran into the same problem accessing these values.
The document Font — Xojo documentation shows an example that makes it look like getting the Leading should go:
Var helvetica12 As New Font(“Helvetica”, 12) ’ from the docs
myLeading = helvetica12.Leading ’ should be allowed after the above line?
But when compiling, line 1 displays an ERROR saying it found a REALbasic method instead of a type name.
So, how is the leading for a font accessed?
The Font class is available for Mobile projects only as documented at the Compatibility section ( Font — Xojo documentation ).
I am getting a different reading… Here is what I’m seeing on that page. Should I be referencing a different page?
If you have MBS and are only targeting macOS you can use FontMBS to get the information you need.
OK, I didn’t see it because it was right in front of me.
I was able to use Graphics.TextHeight to get the results I was needing (placing the next line of text).
Thanks for you patience…