Custom fonts with a standalone

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

cmhjon
Posts: 175
Joined: Tue Aug 04, 2015 11:55 am

Re: Custom fonts with a standalone

Post by cmhjon » Wed Feb 14, 2024 6:32 pm

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

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Custom fonts with a standalone

Post by Klaus » Wed Feb 14, 2024 6:41 pm

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. :?

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Custom fonts with a standalone

Post by SparkOut » Wed Feb 14, 2024 6:50 pm

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.

cmhjon
Posts: 175
Joined: Tue Aug 04, 2015 11:55 am

Re: Custom fonts with a standalone

Post by cmhjon » Wed Feb 14, 2024 7:03 pm

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

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Custom fonts with a standalone

Post by stam » Thu Feb 15, 2024 4:26 pm

.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.

cmhjon
Posts: 175
Joined: Tue Aug 04, 2015 11:55 am

Re: Custom fonts with a standalone

Post by cmhjon » Thu Feb 15, 2024 8:51 pm

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 :)

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Custom fonts with a standalone

Post by SparkOut » Thu Feb 15, 2024 9:29 pm

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).

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Custom fonts with a standalone

Post by richmond62 » Fri Feb 16, 2024 3:24 pm


Post Reply

Return to “Talking LiveCode”