Problems with Font and LR

In the Xojo Documentation we can find the page “Font.Constructor”

I have two doubts:

  1. What is a “postcriptName”. It also appears at page “Font”

  1. Why do I get an error if I write the Sample Code: Var helvetica12 as New Font(“Helvetica”, 12)

imatge

Last thing first. Font is only available in iOS projects, so if you’re working on a desktop, web or console project this won’t even compile.

PostscriptName is the internal name of the font. For instance, Helvetica Bold is named “Helvetica-Bold”. Keep in mind that you can’t just combine the two names together and expect that it’ll always work. The font must also exist on the device and if it doesn’t, results will be unpredictable.

shouldn’t it be ?

Var helvetica12 As Font = New Font("Helvetica", 12)

You can assign variable types using the constructor.

Var helvetica12 As New Font("Helvetica", 12)

Is valid, as is

Var p as New Picture( 100, 100 )

PostScript name is what you get when you double click on the font file.

Since Helvetica is part of the system already, I believe it is “Helvetica Regular”, as you see it in TextEdit.

Thank you Greg.
I had seen “This class is supported on iOS”, but the word “only” was not there, so I supposed it would also work on desktop applications. Now you made it clear. Thanks.
About “postscriptName”, I want to say that there exists a Property called “Name”, in the Font LR page. That’s why I didn’t understand “postscriptName”.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.