Page 1 of 3

Missing Fonts

Posted: Fri Mar 08, 2024 1:05 pm
by Gary Rathbone
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

Re: Missing Fonts

Posted: Fri Mar 08, 2024 1:48 pm
by stam
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

Re: Missing Fonts

Posted: Fri Mar 08, 2024 2:04 pm
by richmond62
As far as I know LC ONLY works properly with .ttf fonts.

Re: Missing Fonts

Posted: Fri Mar 08, 2024 11:59 pm
by Gary Rathbone
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.

Re: Missing Fonts

Posted: Sat Mar 09, 2024 1:07 am
by stam
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…

Re: Missing Fonts

Posted: Sat Mar 09, 2024 11:41 am
by SparkOut
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.

Re: Missing Fonts

Posted: Sat Mar 09, 2024 3:07 pm
by SparkOut
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.

Re: Missing Fonts

Posted: Sun Mar 10, 2024 2:34 pm
by Gary Rathbone
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.

Re: Missing Fonts

Posted: Sun Mar 10, 2024 6:59 pm
by jacque
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.

Re: Missing Fonts

Posted: Sun Mar 10, 2024 6:59 pm
by richmond62
Just set the style in the text field.

Re: Missing Fonts

Posted: Sun Mar 10, 2024 7:48 pm
by Gary Rathbone
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.

Re: Missing Fonts

Posted: Sun Mar 10, 2024 8:00 pm
by Gary Rathbone
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.)

Re: Missing Fonts

Posted: Sun Mar 10, 2024 9:14 pm
by bn
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 907 times


open Sans semibold.jpg


open sans medium.jpg
open sans medium.jpg (29.46 KiB) Viewed 907 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

Re: Missing Fonts

Posted: Sun Mar 10, 2024 10:03 pm
by SparkOut
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.

Re: Missing Fonts

Posted: Mon Mar 11, 2024 2:00 pm
by Gary Rathbone
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?