It is currently Tue Mar 09, 2021 9:54 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: microsoft ttf fonts can not be used in the Linux
PostPosted: Fri May 29, 2020 6:46 pm 
Offline
User
User

Joined: Wed May 20, 2020 5:19 pm
Posts: 30
Hello.
Here example showing the problem:
Code:
FontName$ = "Times New Roman"

If OpenWindow(0, 0, 0, 300, 160, "Loading font...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  Result = FontRequester(FontName$, 14, 0, RGB(0, 0, 0), #PB_Font_Bold)
  If LoadFont(1, SelectedFontName(), SelectedFontSize() )
    SetGadgetFont(#PB_Default, FontID(1))
    TextGadget(0, 10, 10, 300, 40, SelectedFontName()+" "+Str(SelectedFontSize()) )
  EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

The font Previews fine when using the FontRequester but does not display as "Times New Roman" in the Text Gadget.
Tested with 64bit PureBasic latest version on Ubuntu 20.04 64 bit and Suse Enterprise Desktop 15.1 64 bit.

Code works under Windoz and OSX

Thank you.


Top
 Profile  
Reply with quote  
 Post subject: Re: microsoft ttf fonts can not be used in the Linux
PostPosted: Sat May 30, 2020 5:48 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Jun 26, 2014 9:17 am
Posts: 312
Location: Germany
For better fault isolation it should be mentioned that
FontName$ = "TimesNewRoman" or
FontName$ = "Times"
can be found better.
However,
FontName$ = "Source Code Pro" as .ttf
(with spaces in the name) is set correctly.

_________________
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de


Top
 Profile  
Reply with quote  
 Post subject: Re: microsoft ttf fonts can not be used in the Linux
PostPosted: Sat May 30, 2020 2:40 pm 
Offline
User
User

Joined: Wed May 20, 2020 5:19 pm
Posts: 30
Hi Oma.
With FontName$ = "TimesNewRoman" or FontName$ = "Times" also doesn't works.
Not going to change source working on Win and MacOS.
I hope author will check the problem.

CUL


Top
 Profile  
Reply with quote  
 Post subject: Re: microsoft ttf fonts can not be used in the Linux
PostPosted: Tue Nov 17, 2020 3:40 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 14181
Location: France
Seems to work here in both gtk and QT. Can anybody else confirm ?


Top
 Profile  
Reply with quote  
 Post subject: Re: microsoft ttf fonts can not be used in the Linux
PostPosted: Tue Nov 17, 2020 5:13 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Dec 17, 2009 12:00 pm
Posts: 215
Location: Llangadog, Wales, UK
Does not appear to work on my system with GTK2/GTK3. But does work with QT!

Using the test code above and GTK- Times New Roman is listed and highlighted but when selected the window shows a substituted sans-serif font of similar size.

If certain other fonts are chosen, for example DejaVu Serif or a Noto Serif, they work OK. With LibreOffice on the same machine Times New Roman works. The MS ttf fonts exist under /usr/share/fonts/truetype/

However - fonts in Linux are still something of a mystery to me :wink:. Tested with MX Linux, no explicit font changes made since install.

_________________
www.deeproot.co.uk


Top
 Profile  
Reply with quote  
 Post subject: Re: microsoft ttf fonts can not be used in the Linux
PostPosted: Tue Nov 17, 2020 8:04 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jun 02, 2003 9:16 am
Posts: 2124
Location: Germany
Is the font installed and the fontconfig cache rebuilt? The command fc-cache rebuilds it. You can also try to find the font with fc-match or grep it from fc-list output.
Some font packages forget to call fc-cache afterwards. Most applications rely on a correct fontconfig cache.

_________________
bye,
Daniel


Top
 Profile  
Reply with quote  
 Post subject: Re: microsoft ttf fonts can not be used in the Linux
PostPosted: Tue Nov 17, 2020 9:26 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Dec 17, 2009 12:00 pm
Posts: 215
Location: Llangadog, Wales, UK
DarkDragon wrote:
Is the font installed and the fontconfig cache rebuilt? The command fc-cache rebuilds it. You can also try to find the font with fc-match or grep it from fc-list output.
I didn't know about that - thanks very much!

Unfortunately fc-cache did not change the result. Times New Roman and other MS fonts do appear in the fc-list output.

I don't use these on Linux myself - but I guess they should work.

_________________
www.deeproot.co.uk


Top
 Profile  
Reply with quote  
 Post subject: Re: microsoft ttf fonts can not be used in the Linux
PostPosted: Mon Dec 07, 2020 1:53 pm 
Offline
User
User

Joined: Wed May 20, 2020 5:19 pm
Posts: 30
Fred wrote:
Seems to work here in both gtk and QT. Can anybody else confirm ?


Hello.
With 5.73 version also doesn't works.
What to do? :(


Top
 Profile  
Reply with quote  
 Post subject: Re: microsoft ttf fonts can not be used in the Linux
PostPosted: Mon Dec 07, 2020 4:56 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Dec 17, 2009 12:00 pm
Posts: 215
Location: Llangadog, Wales, UK
Hello dibor

Yes you are correct - previously tested with a Beta and re-tested with 5.73 LTS. Same result as above - works with QT, does not work with GTK2/GTK3.

My best suggestion for now - Do you really need the MS fonts for your Linux program? There are some good and much safer alternatives. Liberation, DejaVu and FreeSerif/FreeSans appear to be pre-installed on almost all Linux systems. Noto fonts and probably a few others are also common.

My personal approach for a big project that exists on all 3 platforms is to have a common Procedure that sets all fonts to enumerated constants. Then for Windows, Linux and Mac this procedure uses font-name equivalents which are as safe as possible for each platform. Also perhaps we should not assume that proprietary MS fonts will be installed on every customer's Linux system, even though they should work if available.

_________________
www.deeproot.co.uk


Top
 Profile  
Reply with quote  
 Post subject: Re: microsoft ttf fonts can not be used in the Linux
PostPosted: Mon Dec 07, 2020 5:52 pm 
Offline
User
User

Joined: Wed May 20, 2020 5:19 pm
Posts: 30
Hi deeproot.
Tnx for answer.
Yes, look like this is a good way.
For Windoz and MacOS MS fonts, for Linux other.
But anyway, author should be informed about this bug.

Best Wishes.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye