Changing an objects font in IOS

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Changing an objects font in IOS

Post by FireWorx » Mon Jan 09, 2012 6:53 am

Hi, Can anyone tell me why the attached stack works fine in the IDE but not on the IOS tester? The button script is:
on mouseUp
put field "Font Choices" of card 1 into tList
repeat with x = 1 to the number of lines of tList
put line x of tList into tFontToTry
set the textFont of button "test" to tFontToTry
set the foregroundColor of button "test" to "red"
answer tFontToTry
end repeat
end mouseUp

The problem is not that the fonts are not supported in IOS because I use the same fonts in IOS without a problem.
See attached stack.
Thanks
Dave
Attachments
Choose Font2.livecode.zip
(2.57 KiB) Downloaded 248 times

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Changing an objects font in IOS

Post by jacque » Mon Jan 09, 2012 7:25 pm

A quick google shows those fonts aren't available in iOS, or at least not by the names you're using. Here is a list of the standard iOS fonts that ship with the system: http://bees4honey.com/blog/tutorial/ios ... onts-list/

Since you are using those three fonts on your iOS device, it may be that a particular app has installed them and they are only available there. One way to test that would be to choose a font from the list on the web page and see if that works. If so, then the ones you've listed in your stack aren't generally available.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Changing an objects font in IOS

Post by FireWorx » Tue Jan 10, 2012 2:57 am

Hi, With all due respect I don't think that is the case. Check this revised attached stack. It works great in the IDE. You can click both on the button that uses the font names () property to add fonts to the list and the button that pulls the font names out of the list and displays them. It works fine. Load my revised stack into the tester. The font names () property loads the available fonts into the list and then displays them. Now click on the button that pulls the same font names from the list. It won't display them.

This works in IOS

on mouseUp
put fontnames () into tList
set the textsize of button "test" to "18"
repeat with x = 1 to the number of lines of tList
put line x of tList into tFontToTry
set the textFont of button "test" to tFontToTry
set the foregroundColor of button "test" to "red"
answer tFontToTry with "Add to List" or "Move along" or "Exit"
if it is "exit" then exit mouseup
if it is "add to List" then
put the number of lines of field "font choices" into tLines
put 1 + tLines into tLine
put line x of tList into line tLine of field "Font Choices"
end if
end repeat
end mouseUp

THIS DOESNT
on mouseUp
put field "Font Choices" of card 1 into tList
repeat with x = 1 to the number of lines of tList
put line x of tList into tFontToTry
set the textFont of button "test" to tFontToTry
set the foregroundColor of button "test" to "red"
answer tFontToTry
end repeat
end mouseUp

I just want the user to pick from 5 nice fonts NOT scroll through 200. Hence my preference for the more direct rout. It Not working though. =(

Dave
Attachments
Choose Font.livecode.zip
(2.65 KiB) Downloaded 258 times

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Changing an objects font in IOS

Post by FireWorx » Tue Jan 10, 2012 3:15 am

Interesting. in IOS A small percentage of the Font's DO render in the tester when chosen by name from the field containing the font name, many others don't. But in IOS almost all of the fonts render when chosen by name from the variable populated from the fontname () property.

Go figure.

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Changing an objects font in IOS

Post by FireWorx » Tue Jan 10, 2012 3:57 am

Well I guess you might be right although it's a little odd that I can use Noteworthy Bold and many others in IOS if I choose them in the field preferences prior to running in the sim but if I choose the same font name out of a list of choices from within IOS I can't set the text to it. Here are a list of fonts that I like for my project that DO work in case anyone is interested in allowing the user to pick the font of his choice in the preferences area of the IOS stack.
Dave
Attachments
Choose Font.livecode.zip
(2.81 KiB) Downloaded 285 times

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Changing an objects font in IOS

Post by teacherguy » Mon Jul 09, 2012 10:34 pm

I just encountered this problem today. It is very odd that I cannot change the font of a field via script ("set the textfont of field...")

UPDATE: Aha! Thanks Ken Ray...

http://lists.runrev.com/pipermail/use-l ... 70159.html

Post Reply