Bug in custom fonts on iOS?
Thomas McGrath III
mcgrath3 at mac.com
Sat Mar 24 11:53:35 EDT 2012
Ken,
Very nice explanation and solution for dealing with the fontStyles and textFont.
Thanks
-- Tom McGrath III
http://lazyriver.on-rev.com
3mcgrath at comcast.net
On Mar 24, 2012, at 2:00 AM, Ken Ray wrote:
>>
>> Doing a 'Get Info' for those fonts, they all come up with names like this:
>>
>> Myriad Pro-Cond
>> Myriad Pro-Bold
>> Myriad Pro-Italic
>> etc...
>>
>> Using my calibrated eye, the hyphen between 'Myriad Pro' and 'Cond'
>> looks like an em-dash. Could that break things?
>>
>> Has anyone else seen this problem? (bonus: anyone have a work around?)
>
> It's not a bug, technically, but an idiosyncracy of working with mobile - this is referenced loosely in the iOS Deployment Release Notes (page 13), but here's the skinny:
>
> Fonts are assigned using the internal font name of a specific weight of a font (like "AmericanTypewriter-CondensedLight"), but that is not in "the fontNames"; it's in "the fontStyles" for a specific font, so to verify that you are setting a font properly, you have to check the fontStyles of every font.
>
> For example, you can set the textFont of a field in the IDE to "Palatino", but when you move the app to iOS, the textFont of the field is actually "Palatino-Roman", which is one of the fontStyles of the Palatino font.
>
> So for your app, if you want to display the different weights of the font, on iOS you'd say:
>
> put the fontStyles("Myriad Pro",0) into tFontWeights
>
> … which would give you back "Myriad Pro-Cond", "Myriad Pro-Bold", etc.
>
> What I've done for my application is to create a lookup table that I store in a custom property of my stack that maps these "weights" to names I want to have appear in a font menu. So for example, you could have:
>
> Myriad Pro-Cond = Myriad Pro Condensed
> Myriad Pro-Bold = Myriad Pro Bold
> (etc.)
>
> and then when someone picks "Myriad Pro Condensed" from the font menu, you do the lookup, find out that the weight is actually "Myriad Pro-Cond" and execute:
>
> set the textfont of <whatever> to "Myriad Pro-Cond"
>
> A pain, but it works…
>
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list