Custom fonts with a standalone
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Custom fonts with a standalone
Hello: I would like to bundle some fonts with my standalone, but don't want to make the user install them into his/her WIndows or Mac system. I know I can do this with an iOS standalone, but I'd like to be able to do it with my WIndows and Mac standalones. Is there a way to do this?
Thanks
Greg
Thanks
Greg
Re: Custom fonts with a standalone
Hi Greg,
if I remember right, you only need to add your fonts via the "Copy files" tab in the standalone
builder settings and they will be automatically availavble on iOS!
Worth a try!
Best
Klaus
if I remember right, you only need to add your fonts via the "Copy files" tab in the standalone
builder settings and they will be automatically availavble on iOS!
Worth a try!
Best
Klaus
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: Custom fonts with a standalone
Hi Klaus. I'm not interested in iOS. I would like the fonts to be available in the Windows or Mac standalone - even if those fonts are not system fonts
Re: Custom fonts with a standalone
Hi Greg,
oops, sorry, my fault!
OK, add the font files via the standalone builder "Copy files" and then you can "start using" them!
Check the entry "start using font file..." in the dictionary.
Basically you do something like this in the preopenstack script:
...
put specialfolderpath("engine") & "/A nice font.ttf" into tFont
start using font file tFont
## same for all other fonts...
...
When closing the stanadlone simply "stop using font file ...",
but maybe the fonts will be unloaded at at that point anyway
Best
Klaus
oops, sorry, my fault!
OK, add the font files via the standalone builder "Copy files" and then you can "start using" them!
Check the entry "start using font file..." in the dictionary.
Basically you do something like this in the preopenstack script:
...
put specialfolderpath("engine") & "/A nice font.ttf" into tFont
start using font file tFont
## same for all other fonts...
...
When closing the stanadlone simply "stop using font file ...",
but maybe the fonts will be unloaded at at that point anyway
Best
Klaus
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: Custom fonts with a standalone
Great Klaus. I'll give that a try. Is there anyway to BUILD the font files INTO the standalone? currently after building the standalone this way, the font files appear as separate files. It would be nice to have them bundled in with the .exe if possible
Re: Custom fonts with a standalone
Hi Greg,
hmm, you could store the font files into custom properties of the stack,
but in any case you need to write them to the end users hd to be able
to use them, sorry!
Maybe "spit them out" into the temp directory -> specialfolderpath("temporary"),
start using them from there and delete them on quit?
Best
Klaus
hmm, you could store the font files into custom properties of the stack,
but in any case you need to write them to the end users hd to be able
to use them, sorry!
Maybe "spit them out" into the temp directory -> specialfolderpath("temporary"),
start using them from there and delete them on quit?
Best
Klaus
Re: Custom fonts with a standalone
Hi Klaus,
I have the same question and since this thread is almost 10 years old, I thought I would see if anything has changed? In my case, my app will only be compiled for macOS and Windows. My app uses a custom font. Ideally, I would like to have the font "embedded" within the app/exe so the user does not have to install it.
If I use the commands shown above, does 'put specialfolderpath("engine") & "/A nice font.ttf' work for Mac AND Windows or would the folder path location be different between macOS and Windows?
Best regards,
Jon
Re: Custom fonts with a standalone
Hi Jon,
you're lucky, I'm still alive!
-> specialfolderpath("engine") is not the right folder, this only works on mobile, but is not recommended.
Use -> specialfolderpath("resources") instead, that is where all the files will reside that you add to
your runtime in the Standalone Application setting via "Copy files". This will work on ALL platforms!
Best
Klaus
you're lucky, I'm still alive!
-> specialfolderpath("engine") is not the right folder, this only works on mobile, but is not recommended.
Use -> specialfolderpath("resources") instead, that is where all the files will reside that you add to
your runtime in the Standalone Application setting via "Copy files". This will work on ALL platforms!
Best
Klaus
Re: Custom fonts with a standalone
Outstanding!
Thank you so much!
Jon
Thank you so much!
Jon
Re: Custom fonts with a standalone
Yep this works 100%
I had done exactly this for an early app in my workplace (desktop only mind you). That was a for a silly font where all glyphs were bullet points (used for a password field) - however I now just use unicode for that.
I'll be honest, I never understood why specialFolderPath("engine") is used - there probably is a use-case for it, but not one I've found. SpecialFolderPath("resources") does exactly what I need it to and is unambiguous...
I had done exactly this for an early app in my workplace (desktop only mind you). That was a for a silly font where all glyphs were bullet points (used for a password field) - however I now just use unicode for that.
I'll be honest, I never understood why specialFolderPath("engine") is used - there probably is a use-case for it, but not one I've found. SpecialFolderPath("resources") does exactly what I need it to and is unambiguous...
Re: Custom fonts with a standalone
Hmmmm. Maybe I spoke too fast. After doing everything, what I get for the Windows standalone is the .exe along with an empty 'Externals' folder the font file and when I open the app, the font doesn't display correctly.
What am I doing wrong?
Thank you,
Jon
What am I doing wrong?
Thank you,
Jon
Re: Custom fonts with a standalone
Have you added the font file via Copy Files in the Standalone Application Settings'?
Files should appear in the app folder it generates on Windows or in the equivalent folder inside the Mac app bundle.
Can't quite test on Windows right now, but I would expect the font file to appear in the same folder as the app, not the externals folder. The app folder should be what you get with specialFolderPath("resources"), so if your font file is there, you can access with
For mobile I believe you need to do more (modify the pList with font family name etc), but don't quote me on that...
Stam
Files should appear in the app folder it generates on Windows or in the equivalent folder inside the Mac app bundle.
Can't quite test on Windows right now, but I would expect the font file to appear in the same folder as the app, not the externals folder. The app folder should be what you get with specialFolderPath("resources"), so if your font file is there, you can access with
Code: Select all
on preOpenStack
start using font file (specialFolderPath("resources") & "/my-special-font.ttf")
end preOpenStack
Stam
Last edited by stam on Wed Feb 14, 2024 5:09 pm, edited 1 time in total.
Re: Custom fonts with a standalone
specialFolderPath("engine") was used BEFORE LC introduced specialFolderPath("resources") and some users still got not used to that!
So your fonts are not present in the resulting folder with the standaloneAfter doing everything, what I get for the Windows standalone is the .exe along with an empty 'Externals' folder the font file and when I open the app, the font doesn't display correctly.
although you added them in the STAB (Standalone Application Settings)?
Re: Custom fonts with a standalone
Yes, what stam wrote, this has not changed in the last 10 years.