Font issues

Deploying to Linux? Get penguinated here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Font issues

Post by andyh1234 » Mon Apr 07, 2008 4:07 pm

What is the best font to use generally cross platform.

I have been using Arial which has worked across Windows and Mac OK, but with v2.9 Ive just compiled to Linux and tested on Ubuntu and Arial just blows a lot of the text out of the boxes (too wide)

Any ideas on an Arial like font that will work?

Andy

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Post by andyh1234 » Mon Apr 07, 2008 7:06 pm

OK, im a little further with this!

Using the fontnames property I can find out which fonts are on the system and choose a substitute font.

Ive tried just setting the stack to that font so it filters down to all the controls, but the stacks have lots (and lots) of predetermined fints in them, so most controls are staying in Arial.

Is there an easy way to say 'if the platform is linux set the fontstyle of all the fields to xyz' rather than doing them one by one?

Here is the code im using to find the fonts...

Code: Select all

 if the platform is "Linux" then
    global LinuxFontName
    if "Arial" is among the lines of the fontNames then 
      put "Arial" into LinuxFontName
    else if "Helvetica" is among the lines of the fontNames then 
      put "Helvetica" into LinuxFontName
    else if "Freesans" is among the lines of the fontNames then 
      put "Freesans" into LinuxFontName
    else if "charter" is among the lines of the fontNames then 
      put "Garuda" into LinuxFontName
    else
-- code the ask user to install a font  
  end if

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Apr 07, 2008 9:31 pm

Hi Andy,

You might use this:

http://ftp.gnome.org/pub/GNOME/sources/ ... vera/1.10/

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Post by andyh1234 » Mon Apr 07, 2008 10:15 pm

Thanks Mark, my app is going to be shareware so I wasnt sure if I could use that font unless it was a free app.

Ive found some more code to get all the fields in a stack, so Im working on some code that rips through the form on a preopenstack if the platform is Linux and changes all the fields to a font that is present on the system, in the order that I prefer, basically substituting Arial with something else that works.

Not ideal, but if it works it will be fine, and if it works Ill post the code in case its useful to anyone else.

Thanks again.

Andy

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Post by andyh1234 » Mon Apr 07, 2008 10:48 pm

Here is the code Ive collected from around the web, if anyone has any suggestions to make it better it would be appreciated!

Andy

Code: Select all

on doSetFonts mystackname
  local i,j, IDtracker, Linuxfontname
  
  if the platform is "Linux" then
    -- Check which fonts are available
    if "Arial" is among the lines of the fontNames then 
      put "Arial" into LinuxFontName
    else if "Helvetica" is among the lines of the fontNames then 
      put "Helvetica" into LinuxFontName
    else if "Freesans" is among the lines of the fontNames then 
      put "Freesans" into LinuxFontName
    else if "charter" is among the lines of the fontNames then 
      put "Garuda" into LinuxFontName
    else
      set the textfont of stack mystackname to empty
      answer "None of the standard fonts were available, please install the Bitstream Vera Sans font to ensure the software displays correctly on this machine."
      exit doSetFonts
    end if
     
    put empty into theFieldList
    put empty into IDtracker
    set the wholeMatches to true
    repeat with i = 1 to the number of cards of stack mystackname
      -- Alter fields to selected font
      repeat with j = 1 to the number of fields of card i of stack mystackname
        if lineOffset ((the short id of field j of card i of stack mystackname),IDTracker) <> 0 then next repeat
        set the textfont of (the long id of field j of card i of stack mystackname) to LinuxFontName
      end repeat
      -- Alter buttons to selected font
      repeat with j = 1 to the number of buttons of card i of stack mystackname
        if lineOffset ((the short id of button j of card i of stack mystackname),IDTracker) <> 0 then next repeat
        set the textfont of (the long id of button j of card i of stack mystackname) to LinuxFontName
      end repeat
    end repeat
     
  end if
  
end doSetFonts  

Kevin
Posts: 74
Joined: Fri Oct 02, 2009 3:47 pm

Solution

Post by Kevin » Mon Nov 09, 2009 9:07 pm

Did anyone find a acceptable solution to this? Courier New is what I have been using but is seems there is documentation to the contrary.

http://www.codestyle.org/css/font-famil ... ults.shtml

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Nov 09, 2009 9:11 pm

Kevin,

What's with the link? All I see is a graph that confirms that everybody has that unusable font Courier New installed. I very much dislike that font.

Mark

P.S. I just didn't want to use the word "hate" ;-)
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Kevin
Posts: 74
Joined: Fri Oct 02, 2009 3:47 pm

Agree

Post by Kevin » Mon Nov 09, 2009 9:30 pm

The link was meant to assist in picking a reliable multi-platform font. The suggestion of Courier New/Courier is just something I settled on (not a real preference of any kind just found it useful). I am unclear on exactly how to set the default font to any specific selection for a particular platform (without looping the controls). I hopped that some one might have found a better solution.

Kevin

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Nov 09, 2009 11:56 pm

Hi Kevin,

The fact that a font is cross-platform isn't enough. It should also be feasible as an interface font. Btw what do you consider an acceptable solution?

Andy: I would loop over the number of controls, using one loop, instead of using a loop for fields and one for buttons. I think that the ID tracker got a bit orphaned in your script.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
Contact:

Post by andyh1234 » Tue Nov 10, 2009 4:32 pm

Thanks Mark, Ill update that code, makes a lot more sense and might speed the application load a little.

I was just learning Rev then so it would have gone straight over my head but I think I can figure it now!

Post Reply

Return to “Linux”