Using Helvetica Neue in iOS

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Chipp
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 27
Joined: Sat Apr 08, 2006 9:50 am
Location: Austin, TX
Contact:

Using Helvetica Neue in iOS

Post by Chipp » Sat Oct 11, 2014 3:53 am

As many of you may know, Apple makes judicious use of Helvetica Neue and all it's font weights in their iOS interfaces. Sadly, one thing it appears LC doesn't do is translate those fonts correctly from Mac to iOS-- so everything comes out the same Helvetica Neue font no matter what font weight you have specified. And the "fontstyles" method doesn't give you the full range either.

This is what I finally figured out. Here is the correct mapping from Mac to iOS for Helvetica Neue: Say you have a field in your Mac application which has the textfont set to "Helvetica Neue Thin". To properly display, you'll need to set the same field's textfont in iOS to "HelveticaNeue-Thin".

Here are all the iOS equivalents:

HelveticaNeue-UltraLight
HelveticaNeue-Thin
HelveticaNeue-Light
HelveticaNeue
HelveticaNeue-Medium
HelveticaNeue-Bold
HelveticaNeue-Bold Condensed
HelveticaNeue-Black Condensed

And unless anyone knows of a better way, here is some code to update all those fields on all those cards when in iOS:

Code: Select all

on altUpdateFontsFor_iOS
   lock screen
   lock messages
   repeat with x=1 to the number of cards in this stack
      repeat with y=1 to the number of controls on card x
         try
            get the textfont of control y of cd x
            if it contains "Helvetica" and the environment is "mobile" then
               set the textfont of control y of cd x to fixHelvetica(it)
            end if
         end try
      end repeat
   end repeat
   unlock messages
   unlock screen
end altUpdateFontsFor_iOS

private function fixHelvetica pFontname
   --> Helvetica Neue Thin BECOMES HelveticaNeue-Thin
   put "-" into char 15 in pFontname
   delete character 10 in pFontname
   return pFontname
end fixHelvetica
You call it in your startup handler thusly:

Code: Select all

if the environment is "mobile" then altUpdateFontsFor_iOS
[url=http://www.altuit.com/webs/hemingway/Products/AltuitProducts.htm]Visit Altuit, creator of ButtonGadget and other Rev add-ons[/url]

jiml
Posts: 232
Joined: Sat Dec 09, 2006 1:27 am
Location: Los Angeles

Re: Using Helvetica Neue in iOS

Post by jiml » Sat Oct 11, 2014 10:56 pm

Nice.

Wouldn't it be convenient if LC could automatically map all fonts between systems.
Director did this ages ago with a plain text font mapping file, which the developer could alter as needed.

Jim Lambert

Post Reply

Return to “iOS Deployment”