Missing Fonts

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Gary Rathbone
Posts: 39
Joined: Mon Apr 19, 2021 8:39 pm

Missing Fonts

Post by Gary Rathbone » Fri Mar 08, 2024 1:05 pm

Hi all,

I've been playing around with this for a few days now and been searching Livecode forums but remain totally stumped.

I would like to use "Open Sans" in my application. I understand for the standalone I need to use "Copy Files" in the "Standalone Application Settings".

However, during development I am unable to access the Open Sans family. It is definitely installed as I can use it in other applications, and it's present in my fonts directory.

I've put "fontnames()" into a field, and Open Sans isn't listed, neither is it listed in any Livecode font menus.

I've tried using "Start using font file...". This brings the name into the Livecode Font menus, but has no effect on changing the font.

Any help would be gratefully received.

Gary

Windows 11 - Livecode 9.6.9

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Missing Fonts

Post by stam » Fri Mar 08, 2024 1:48 pm

I think LC has issues with .otf fonts. If your Open Sans is .otf, consider converting it to .ttf
There are any number of sites that can do this free, for example https://convertio.co/otf-ttf/

If that's not the issue maybe post some code?

Stam

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Missing Fonts

Post by richmond62 » Fri Mar 08, 2024 2:04 pm

As far as I know LC ONLY works properly with .ttf fonts.

Gary Rathbone
Posts: 39
Joined: Mon Apr 19, 2021 8:39 pm

Re: Missing Fonts

Post by Gary Rathbone » Fri Mar 08, 2024 11:59 pm

Thanks for your help, but the Open Sans family is all .ttf

Stam, there isn't any code to post as the font just don't appear in any font list.

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Missing Fonts

Post by stam » Sat Mar 09, 2024 1:07 am

Not sure if there are any peculiarities affecting the Windows Version of LC.
But happy to test on Mac if u share your .ttf font…

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Missing Fonts

Post by SparkOut » Sat Mar 09, 2024 11:41 am

Gary Rathbone wrote:
Fri Mar 08, 2024 1:05 pm
I've tried using "Start using font file...". This brings the name into the Livecode Font menus, but has no effect on changing the font.
So, you are successfully getting "Start using font file ..." to make the font available to LiveCode. That's a good (and needed) start.

When you say that has no effect on changing the font, what do you mean? By selecting a field and setting the font in the Property Inspector? Setting the textfont of a field by script? Where are you assigning the font to the firld, or fields, or group, or card or stack?
Fields inherit the "effective" font from their parents which also inherit from their parents etc. Any change of font to an object at more specific level will block inheritance from above. Any children will inherit the new font from their parent but may also have inheritance blocked by their own specific setting.

If you are setting the font at the stack level then check for inheritance being blocked at all levels below.

Set a specific field with the font so that it no longer inherits and see if that works. If not, it's hard to tell without seeing what's going on in your environment.

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Missing Fonts

Post by SparkOut » Sat Mar 09, 2024 3:07 pm

I had a very limited play with setup of a few fields and fonts to check inheritance.
There's definitely something screwy going on, inheritance of the effective textfont and fontsize are not working properly on Windows, at least as far as I understand.
I am not in a position to raise a bug report/recipe, but please can you do that and advise the reference number. I will add updates when I get a chance.

Gary Rathbone
Posts: 39
Joined: Mon Apr 19, 2021 8:39 pm

Re: Missing Fonts

Post by Gary Rathbone » Sun Mar 10, 2024 2:34 pm

The more I look at this, the more confused I get. I decided to use "Quicksand" as it appears in the Livecode font menu. However, there is only a single style available. In MSWord there are three styles, Regular, Light and Medium.

The same with "Open Sans", a single style in Livecode and multiple styles in MSWord.

If anyone can explain how to access the styles in Livecode, I'd be very grateful.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Missing Fonts

Post by jacque » Sun Mar 10, 2024 6:59 pm

If I remember right, LC only shows the family name in the Font menu, which isn't necessarily the name of the individual variations. Look at the font in a font utility to see the actual names of the different styles and assign your controls with those. LC says if you set text to bold, for example, and there is a matching variation in the font file then styling will work, but if LC can't find a comparable style, nothing will change. In that case you may need to know the actual style name to use it.
Last edited by jacque on Sun Mar 10, 2024 7:03 pm, edited 1 time in total.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Missing Fonts

Post by richmond62 » Sun Mar 10, 2024 6:59 pm

Just set the style in the text field.

Gary Rathbone
Posts: 39
Joined: Mon Apr 19, 2021 8:39 pm

Re: Missing Fonts

Post by Gary Rathbone » Sun Mar 10, 2024 7:48 pm

After using "Start using font file..." on the following fonts.. (I wish I could post inline images, can't copy and paste either)..

OpenSans-Bold.ttf (Open Sans)
OpenSans-Light.ttf (Open Sans Light)
OpenSans-Medium.ttf (Open Sans Medium)
OpenSans-Regular.ttf (Open Sans)
OpenSans-SemiBold.ttf (Open Sans SemiBold)

The Fonts and Styles listed in LC for Open Sans are;

OpenSans
OpenSans Condensed
OpenSans SemiCondensed

Using the following code;

set the textfont of fld "f1" to "Open Sans" -- This changes the font to Open Sans (great)

set the textstyle of fld "f1" to "Medium" - This does nothing.

Surely, it can't be this difficult for LC to access and apply all installed font and styles. What am I missing?

Jacque & SparkOut: Thanks for your answers but LC only provides limited font styles.

Gary Rathbone
Posts: 39
Joined: Mon Apr 19, 2021 8:39 pm

Re: Missing Fonts

Post by Gary Rathbone » Sun Mar 10, 2024 8:00 pm

I'd love to be able to attach the Open Sans Font Family here, but I just get an "invalid file extension" error.

Anyway, the full family can be downloaded from...

https://fonts.google.com/specimen/Open+Sans

Anyone who can get a field to display...

Open Sans Light
Open Sans Medium
Open Sans SemiBold

...gets a free drink.

(Easy in the UK as you can send me your table number at any Wetherspoons pub, and your choice will be delivered to you in a matter of minutes.)

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Missing Fonts

Post by bn » Sun Mar 10, 2024 9:14 pm

Gary,
I downloaded the open sans family from Google. It gave me 2 variable fonts and a folder of static fonts.
That folder of static fonts contained the ones you are asking for.
I installed the fonts using a button

Code: Select all

on mouseUp
   answer file "choose font"
   if it is not empty then 
      put it into tFile
      start using font file tFile
   end if
end mouseUp
I made up a field and put some text into it.(see screenshots)
Then selecting the field and using the properties inspector for that field chose the ones you wanted.
open sans light.jpg
open sans light.jpg (29.2 KiB) Viewed 716 times


open Sans semibold.jpg


open sans medium.jpg
open sans medium.jpg (29.46 KiB) Viewed 716 times


Is that enough to get me a beer?

Please note that I am using a Mac, I hope this works similar on Windows

Kind regards
Bernd

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Missing Fonts

Post by SparkOut » Sun Mar 10, 2024 10:03 pm

Windows inheritance is still grimbulled.

Set the stack textfont to "whatevervalidfontyoulike"

Add a new field and put text into it. See that it inherits the font and style/size from the stack property. In the PI for the field the font details are shown in italics, indicating the effective font is inherited.

Edit the stack textfont or size. Note no changes in the display of the field inheriting this style. Try to force a screen redraw. Edit the text. Note the field retains the same size/font/style that it was originally created with. The PI still shows inheritance of font with the effective name in italics. Size remains as per the original size at which it was created in the PI regardless of the stack text size setting.

Do some more fiddling. Note nothing seems to have any effect except using the message box or script to

Code: Select all

set the textfont of field "fldTestfield" to empty
at which point inheritance is restored.

Gary Rathbone
Posts: 39
Joined: Mon Apr 19, 2021 8:39 pm

Re: Missing Fonts

Post by Gary Rathbone » Mon Mar 11, 2024 2:00 pm

Thank Bernd. I'm using Windows 11 (I have three different PC's) and have copied and pasted your code, however Open Sans Light still isn't listed. So sorry, no pint yet :cry:
Open.jpg
Interesting, SparkOut. I wonder if the two issues are separate or related?

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”