Page 2 of 2

Re: Custom fonts with a standalone

Posted: Wed Feb 14, 2024 6:32 pm
by cmhjon
Hi everyone,

Yes, I added the font via Copy Files in the Standalone App Settings. I also add the code as instructed within a preOpenStack handler:

Code: Select all

start using font file (specialFolderPath("resources") & "/MyFont.otf")
After compiling, I get a folder containing the .exe, the font file, and an empty 'Externals' folder however and when I open the app, the font doesn't display correctly.

In Windows, where is this 'Resources' folder? Where should my font be located so that the .exe will see and start using it?

Best regards,
Jon

Re: Custom fonts with a standalone

Posted: Wed Feb 14, 2024 6:41 pm
by Klaus
cmhjon wrote:
Wed Feb 14, 2024 6:32 pm
In Windows, where is this 'Resources' folder?
The folder containg your EXE.
cmhjon wrote:
Wed Feb 14, 2024 6:32 pm
Where should my font be located so that the .exe will see and start using it?
This sounds like LC only supports TTF (TrueType) font files this way, but not OTF. :?

Re: Custom fonts with a standalone

Posted: Wed Feb 14, 2024 6:50 pm
by SparkOut
Try adding the keyword "globally" at the end if the "start using" statement. I have often had to do that, not sure why. But also test with another font style to see if it is the otf style that's the problem. I can't remember at the moment but I think otf is supported. But not every font file is the same.

Re: Custom fonts with a standalone

Posted: Wed Feb 14, 2024 7:03 pm
by cmhjon
I tried adding 'globally' to the end of the command but this didn't resolve the issue. Font still doesn't display correctly.

I will try converting the OpenType to a TrueType and see if that works.

Best regards,
Jon

Re: Custom fonts with a standalone

Posted: Thu Feb 15, 2024 4:26 pm
by stam
.ttf should work... It certainly has when I used this a few years ago.

if .otf is the issue perhaps consider submitting an enhancement request at https://quality.livecode.com?

I'm guessing this wasn't a thing when font file usage was implemented.

Alternatively, you could maybe provide an installer for the font - if installed during app installation then you would just reference this with the font name (presumably).

Let us know how you get on...
S.

Re: Custom fonts with a standalone

Posted: Thu Feb 15, 2024 8:51 pm
by cmhjon
I tried this with a TTF and although I get a folder containing the exe, the font file, and an empty 'Externals' folder...the font still does not display correctly.

In the Standalone App Settings > 'Copy Files' tab, do I need to enable the 'Copy Referenced Files' checkbox and populate the 'Destination Folder' with something?

Best regards,
Jon :)

Re: Custom fonts with a standalone

Posted: Thu Feb 15, 2024 9:29 pm
by SparkOut
No, you don't.

A) put the path to the fontfile into tFontfile and check "there is a file (tFontfile)" before the start using statement. Show an error if the engine can't find the right font file.
B) after successful check the file exists and start using statement, answer the fontnames. Make sure the same name exists in the list of fontnames as you have set the fields to display. Note the font filename is often a more general name for the style and includes various specific fontfaces within (eg bold and other variants).

Re: Custom fonts with a standalone

Posted: Fri Feb 16, 2024 3:24 pm
by richmond62