Fonts on Android

Ralph DiMola rdimola at evergreeninfo.net
Wed Aug 28 08:35:29 EDT 2019


>After running FontInfo(), I see this:
>
>*Barlow Bold
>bold
>*Barlow Regular
>Plain

What I would have expected is:
*Barlow
bold
plain

Then it would work as expected.

>When I set the font of my stack to "Barlow", everything (bold or not) comes up as Barlow Bold. 
>When I set the font of my stack to "Barlow Regular", everything (bold or not) comes up as Barlow Regular.

This is because the OS is seeing these as 2 different fonts.
Are the results of FontInfo() on the IDE or the Android device?

I have seen oddities like this when the internal font name is wrong/inconsistent or (for example)the regular version was created at a later date and the original name was "Barlow bold" and there was no other option than to name the new plain font to "Barlow regular". This would not allow them to operate as a family.

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net

-----Original Message-----
From: Dan Friedman [mailto:dan at clearvisiontech.com] 
Sent: Tuesday, August 27, 2019 6:54 PM
To: rdimola at evergreeninfo.net; 'How to use LiveCode'
Subject: Re: Fonts on Android

Ralph,

Thank you for the reply.  But, I don’t see how this helps.  I have two fonts:

Barlow-Bold.ttf
Barlow-Regular.ttf

After running FontInfo(), I see this:

*Barlow Bold
bold
*Barlow Regular
plain

When I set the font of my stack to "Barlow", everything (bold or not) comes up as Barlow Bold. 
When I set the font of my stack to "Barlow Regular", everything (bold or not) comes up as Barlow Regular.

Only thing I can think to do is to run thought EVERY object in my project and set the textFont of that control to "Barlow Bold" or "Barlow Regular".  Then there's text fields with mixed text...  Do I run through every text field and change the font of all bold text?   There has to be a way to map "Barlow Regular" to plain text, and "Barlow Bold" to bold text.  I must be missing something.

-Dan



On 8/27/19, 3:07 PM, "Ralph DiMola" <rdimola at evergreeninfo.net> wrote:

    When I run into this problem I use the routine below to enumerate all the
    fonts and their styles.
    If you have both a "Plain" and "Bold" style for a font then you use the font
    name and set its style to "Bold"
    If you use a "bold" base font then its "plain" style IS the bold font and
    setting its style to "Bold" will do nothing.
    
    function FontInfo
       local fnames,fstyles,tlist
       
       put the fontnames into fnames
       sort fnames
       repeat for each line tfnt in fnames
          put "*"&tfnt&cr after tlist
          put the fontstyles(tfnt,0) into  fstyles
          repeat for each line tsty in fstyles
             put space & tsty & cr after tlist
          end repeat
       end repeat
       delete char -1 in tlist
       return tlist
    end FontInfo
    
    Ralph DiMola
    IT Director
    Evergreen Information Services
    rdimola at evergreeninfo.net
    
    
    -----Original Message-----
    From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
    Of Dan Friedman via use-livecode
    Sent: Tuesday, August 27, 2019 5:11 PM
    To: How to use LiveCode
    Cc: Dan Friedman
    Subject: Fonts on Android
    
    Greetings!
    
    I am able to get a custom font installed and running on a Android device.
    But, how do you handle the font family?   Included in my app is
    "myfont-Regular.ttf" and "myfont-bold.ttf".   When the app launches, I call:
    
    set the textFont of stack "main" to "myfont" 
    
    It's only using the bold version (probably because it's first
    alphabetically).  Is there a way to map a font to a style so that text is "
    myfont-Regular" and bold text is "myfont-bold"?
    
    Thanks in advance,
    -Dan
    
     
    
    _______________________________________________
    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