Page 5 of 7
Re: Looking for Help on a Project
Posted: Fri Jun 30, 2017 11:49 am
by bidgeeman
Hello once more.
I am having terrible trouble loading some custom fonts Windows ttf from a standalone.
I have 4 x fonts for 4 x buttons with the fonts that load into a text field.
When I make the standalone and put the exe on my daughters computer there are no fonts available.
I have added the fonts to the copy files in the standalone settings and even a Fonts folder but nothing
I tried this on open stack :
Code: Select all
put specialfolderpath("Fonts") into tFont
put specialfolderpath("Fonts") & "/Font1.ttf" into tFont
put specialfolderpath("Fonts") & "/Font2.ttf" into tFont
put specialfolderpath("Fonts") & "/Font3.ttf" into tFont
put specialfolderpath("Fonts") & "/Font4.ttf" into tFont
start using font file tFont
I have been stuck on this for hours
so Any help would be soooo appreciated.
Many thanks
Bidge
Re: Looking for Help on a Project
Posted: Fri Jun 30, 2017 12:31 pm
by Randy Hengst
Hello Bidge,
I regularly build for iOS. But, I assume the process is the same.
Add your font files using the Copy Files pane. Then in script set the textFont of the field, button, etc to the one you want.
If you're asking how to have the fonts appear in a font menu, then I don't know if the process above will work. I've never done that.
randy
Re: Looking for Help on a Project
Posted: Fri Jun 30, 2017 12:34 pm
by bidgeeman
Hi randy.
Thanks for the reply but where do I put the script to set the fields/buttons?
on open stack?
Thanks
Bidge
Re: Looking for Help on a Project
Posted: Fri Jun 30, 2017 12:47 pm
by Klaus
Hi Bidge,
all files etc. that you add via the "Copy files..." tab in the standalone builder settings, will be found in -> specialfolderpath("resources")
There is no specialfolderpath("Fonts"), as a look into the doctionary would have told you!
Usually you load fonts "on pre-/openstack":
Code: Select all
on openstack
put "Font1.ttf,Font2.ttf,Font3.ttf,Font4.ttf" into tFonts
repeat for each item tFont in tFonts
start using font file (specialfolderpath("resourrces") & "/" & tFont)
end repeat
## Your openstack stuff here...
## ...
end openstack
Best
Klaus
Re: Looking for Help on a Project
Posted: Fri Jun 30, 2017 1:06 pm
by bidgeeman
Hi Klaus.
Thanks for your reply and code fix but it did not work for some reason???
The fonts are in the copy files area. I just don't know what to do???
EDIT: Oh...I just noticed the typo
I'll try again
Bidge
Re: Looking for Help on a Project
Posted: Fri Jun 30, 2017 1:09 pm
by Klaus
Hi Bidge,
I have a typo in the sepcialfolderpath (resourrces), remove one R (resources) and try again.
If that doesn't work add this line and tell us what the dialog tells you:
Code: Select all
...
start using font file ...
if the result <> empty then
anser the result
end if
...
Best
Klaus
Re: Looking for Help on a Project
Posted: Fri Jun 30, 2017 1:39 pm
by bidgeeman
Hi Klaus.
I compiled the script hopefully correctly and still no fonts. Not even an error message
on the standalone.
I'm hoping it is due to my code writing:
Code: Select all
on openstack
put "Pacifico.ttf,Anton.ttf,Schoolbell.ttf,Luckiest Guy.ttf" into tFonts
repeat for each item tFont in tFonts
start using font file (specialfolderpath("resources") & "/" & tFont)
if the result <> empty then
answer the result
end if
end repeat
end openstack
Bidge
Re: Looking for Help on a Project
Posted: Fri Jun 30, 2017 1:41 pm
by Klaus
Hm, code is correct, sorry, no brilliant idea in the moment.
Maybe try with just ONE font? Poking in the dark here...
Re: Looking for Help on a Project
Posted: Fri Jun 30, 2017 1:54 pm
by bidgeeman
Oh dear....this is very dissapointing
Thanks for your help anyways Klaus and randy.
Bidge
Re: Looking for Help on a Project
Posted: Fri Jun 30, 2017 4:27 pm
by jacque
Do the fields have their font set correctly? There is a difference between the font assigned to characters and the font assigned to a field as a whole. If you set the textfont of the text in a field, when that text is removed the textfont will revert to the default font for the field. To make sure the field always displays the correct font, set the textfont of the field itself.
Re: Looking for Help on a Project
Posted: Fri Jun 30, 2017 11:22 pm
by bidgeeman
Hi jacque.
I have set the field and buttons with this on open stack script:
Code: Select all
set the textFont of field "Field" to "Font1"
set the textFont of button "Script" to "Font1"
set the textFont of button "Hand" to "Font2"
set the textFont of button "Bold" to "Font3"
set the textFont of button "Funny" to "Font 4"
Cheers
Bidge
Re: Looking for Help on a Project
Posted: Sat Jul 01, 2017 12:36 am
by bidgeeman
Hi Klaus.
Managed to get an answer "Something" from your code query.
(I am using 2 x stacks and forgot to set the path of the second stack that
contains the text field).
I gather this means that the font is not loading?
Can this somehow help with a possible solution?
Thanks
Bidge
Re: Looking for Help on a Project
Posted: Sat Jul 01, 2017 3:31 am
by bidgeeman
Thinking it was a bug I downloaded and installed Livecode V 8.1.4 and followed the instructions here:
http://lessons.livecode.com/m/4069/l/29 ... nts-on-ios
Still nothing. The custom font I selected did not show up in the load fonts field. I am completely at a loss
with this one
Bidge
Re: Looking for Help on a Project
Posted: Sat Jul 01, 2017 9:01 am
by SparkOut
The fontNames returns a list of the font names available on the device. The font name is not necessarily the same as the file name. One .ttf file may include a number of font names giving variations on weight and style, that may show up elsewhere in the fontNames list.
If it is a custom font, it might be that it doesn't match the file markers that the os uses to recognise a font automatically.
Are you trying this on a desktop or mobile device?
It's hard to diagnose, if you're following the tutorial then you should get results but as you aren't, it's going to take some more investigation. Do you want to send me your custom font and I will test it here?
Re: Looking for Help on a Project
Posted: Sat Jul 01, 2017 9:07 am
by bidgeeman
Hi Sparkout.
There are 4 x freeware fonts and none of them seem to work.
I have tried to attach them to this post.
Many thanks for any help.
Bidge