Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu OS: Font selection of 'Fira Code' with Light style gives only 'Fira Code' regular style #4223

Open
froloffw7 opened this issue Jul 14, 2022 · 23 comments

Comments

@froloffw7
Copy link

I'm using FiraCode font and prefer Light weight font style.

Regular weght font selection

Font Selection FireCode Regular

Light weght font selection

Font Selection FireCode Regular

Unfortunately application doesn't follow the font selection, but always use Regular font weight.

Main Window CudaText

Hereafter the Sublime text editor screenshot with FiraCode Light weight font style.

Main Window Sublime Text

@Alexey-T
Copy link
Owner

Alexey-T commented Jul 14, 2022

This is behaviour of Lazarus IDE (I get font name/style via TFontDialog only). can you please

@Alexey-T
Copy link
Owner

Alexey-T commented Jul 14, 2022

Lazarus font dialog is here:
Tools / Options, then in tab - Editor / Display / "Default editor font"

ff

@veksha
Copy link
Contributor

veksha commented Jul 14, 2022

you can also try Font Changer addon.

image

@Alexey-T
Copy link
Owner

I confirm issue on Ubuntu: I cannot select 'Litght' version because it don't have separate name like 'FiraCode Light', only one name here: FiraCode

@veksha
Copy link
Contributor

veksha commented Jul 14, 2022

But I have it in the left list in Font Dialog.

image

@veksha
Copy link
Contributor

veksha commented Jul 14, 2022

do you, guys, have these files in /usr/share/fonts/TTF?

-rw-r--r-- 1 root root  319368 янв 29 22:04  FiraCode-Bold.ttf
-rw-r--r-- 1 root root  288380 янв 29 22:04  FiraCode-Light.ttf
-rw-r--r-- 1 root root  283684 янв 29 22:04  FiraCode-Medium.ttf
-rw-r--r-- 1 root root  289624 янв 29 22:04  FiraCode-Regular.ttf
-rw-r--r-- 1 root root  285428 янв 29 22:04  FiraCode-Retina.ttf
-rw-r--r-- 1 root root  304248 янв 29 22:04  FiraCode-SemiBold.ttf

fc-list "Fira Code" | egrep -o 'FiraCode.*'

FiraCode-SemiBold.ttf: Fira Code,Fira Code SemiBold:style=SemiBold,Regular
FiraCode-Retina.ttf: Fira Code,Fira Code Retina:style=Retina,Regular
FiraCode-Bold.ttf: Fira Code:style=Bold
FiraCode-Light.ttf: Fira Code,Fira Code Light:style=Light,Regular
FiraCode-Medium.ttf: Fira Code,Fira Code Medium:style=Medium,Regular
FiraCode-Regular.ttf: Fira Code:style=Regular

also look here: https://unix.stackexchange.com/questions/392380/how-do-i-alias-one-of-the-weights-of-a-font-family-with-fontconfig

@Alexey-T
Copy link
Owner

I have only /usr/share/fonts/truetype but (I installed FiraCode) I cannot find Fira*

@froloffw7
Copy link
Author

froloffw7 commented Jul 14, 2022

I confirm issue on Ubuntu: I cannot select 'Litght' version because it don't have separate name like 'FiraCode Light', only one name here: FiraCode

I suppose there should be the way to select font style from the font selection dialog.

I do not install fonts globally, but put font files into the $HOME/.fonts directory.
Currently I'm using FiraCode variable font (FiraCode-VF.ttf file) , but tried also with separate files (FiraCode-xxxx.ttf).

fc-list "Fira Code" | egrep -o 'FiraCode.*'
output:

FiraCode/FiraCode-VF.ttf: Fira Code,Fira Code Light
FiraCode/FiraCode-VF.ttf: Fira Code,Fira Code Light:style=Bold
FiraCode/FiraCode-VF.ttf: Fira Code,Fira Code Light:style=Medium
FiraCode/FiraCode-VF.ttf: Fira Code,Fira Code Light:style=Regular
FiraCode/FiraCode-VF.ttf: Fira Code,Fira Code Light:style=SemiBold
FiraCode/FiraCode-VF.ttf: Fira Code,Fira Code Light:style=Light,Regular

@veksha
Copy link
Contributor

veksha commented Jul 14, 2022

as a temporary solution, try to use non-variable version. (maybe uninstall variable first)

@Alexey-T
Copy link
Owner

user@user-HP-Pavilion-g6-Notebook-PC:~/.local/share/fonts$ fc-list "Fira Code" | egrep -o 'FiraCode.*'
FiraCode-Regular.ttf: Fira Code:style=Regular
FiraCode-Light.ttf: Fira Code,Fira Code Light:style=Light,Regular
FiraCode-Medium.ttf: Fira Code,Fira Code Medium:style=Medium,Regular
FiraCode-SemiBold.ttf: Fira Code,Fira Code SemiBold:style=SemiBold,Regular
FiraCode-Bold.ttf: Fira Code:style=Bold
FiraCode-Retina.ttf: Fira Code,Fira Code Retina:style=Retina,Regular

@froloffw7
Copy link
Author

as a temporary solution, try to use non-variable version. (maybe uninstall variable first)

I tried already. This doesn't help.

FiraCode/FiraCode-Medium.ttf: Fira Code,Fira Code Medium:style=Medium,Regular
FiraCode/FiraCode-Retina.ttf: Fira Code,Fira Code Retina:style=Retina,Regular
FiraCode/FiraCode-Bold.ttf: Fira Code:style=Bold
FiraCode/FiraCode-SemiBold.ttf: Fira Code,Fira Code SemiBold:style=SemiBold,Regular
FiraCode/FiraCode-Regular.ttf: Fira Code:style=Regular
FiraCode/FiraCode-Light.ttf: Fira Code,Fira Code Light:style=Light,Regular

@veksha
Copy link
Contributor

veksha commented Jul 14, 2022

maybe try fc-cache -f or restart. or sudo dpkg-reconfigure fontconfig-config

@froloffw7
Copy link
Author

froloffw7 commented Jul 14, 2022

fc-cache -f

fc-list "Fira Code" | egrep -o 'FiraCode.*'
FiraCode/FiraCode-Medium.ttf: Fira Code,Fira Code Medium:style=Medium,Regular
FiraCode/FiraCode-Retina.ttf: Fira Code,Fira Code Retina:style=Retina,Regular
FiraCode/FiraCode-Bold.ttf: Fira Code:style=Bold
FiraCode/FiraCode-SemiBold.ttf: Fira Code,Fira Code SemiBold:style=SemiBold,Regular
FiraCode/FiraCode-Regular.ttf: Fira Code:style=Regular
FiraCode/FiraCode-Light.ttf: Fira Code,Fira Code Light:style=Light,Regular

Font selection dialog still doesn't work and I have it different from you. But now I'm able to select the light-wight font manually in the user.json
"font_name__linux" : "Fira Code Light",

Most probably this is Lasarus font issue, as I don't have problem like this with any other application I'm using:
pluma editor, far2linux manager, st terminal, libreoffice etc.

@Alexey-T
Copy link
Owner

"font_name__linux" : "Fira Code Light", does the trick.

@froloffw7
Copy link
Author

froloffw7 commented Jul 14, 2022

"font_name__linux" : "Fira Code Light", does the trick.

Yes, but with separate ttf files only.
And it will be not worse to have font settings like: Fira Code Variable Font.

@veksha
Copy link
Contributor

veksha commented Jul 14, 2022

Font selection dialog still doesn't work and I have it different from you

I have compiled CudaText with Qt5. Maybe your dialog is different, because you are using GTK version?

@Alexey-T
Copy link
Owner

We are limited in Lazarus - we use TFontDialog and fixed set of styles: normal/bold.

@froloffw7
Copy link
Author

There should be possible to use freetype library (which is cross-platform) directly or via some wrapper like LazFreeType, but probably this does not worth the time.

@veksha
Copy link
Contributor

veksha commented Jul 14, 2022

lazarus issue 6 years old:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/29596

"Mantis submitter username: p_daniel

The same issue with weight: it's not possible to choose fonts with width different from "Regular" and "Bold".
However, all this works fine in Win32 interface, because Win32 version of TFontDialog returns a string that contains stretch and weight."

@froloffw7
Copy link
Author

froloffw7 commented Jul 14, 2022

I have compiled CudaText with Qt5

For some reason it doesn't work on my PC, just freezes after launch...

$ cudatext                                                                                                                          ↑
qt5ct: using qt5ct plugin
qt5ct: D-Bus global menu: no

"Mantis submitter username: p_daniel"

But he didn't provide the patch.

@veksha
Copy link
Contributor

veksha commented Jul 14, 2022

For some reason it doesn't work on my PC, just freezes after launch...

what if you will run strace cudatext ?

@froloffw7
Copy link
Author

froloffw7 commented Jul 15, 2022

what if you will run strace cudatext ?

Well, I tried to launch cudatext this way:

strace cudatext 2>cudatext.trc

and again had to kill the process, as even after 15 minutes it doesn't show any window and application had 100% CPU utilization.
Trace log file contains a lot of lines like this:

openat(AT_FDCWD, "/usr/share/fonts/truetype/kacst/KacstOffice.ttf", O_RDONLY) = 9
fcntl(9, F_SETFD, FD_CLOEXEC)           = 0
newfstatat(9, "", {st_mode=S_IFREG|0644, st_size=73680, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 73680, PROT_READ, MAP_PRIVATE, 9, 0) = 0x7f63683eb000
close(9)                                = 0
munmap(0x7f63683eb000, 73680)           = 0

For some reason the QT5 based application tried to scan the whole font directories ($HOME/.fonts as well).

@Alexey-T Alexey-T changed the title Ubuntu OS: Font selection always Regular weight. Ubuntu OS: Font selection of 'Fira Code' with Light style gives only 'Fire Code' normal style Jul 15, 2022
@Alexey-T Alexey-T changed the title Ubuntu OS: Font selection of 'Fira Code' with Light style gives only 'Fire Code' normal style Ubuntu OS: Font selection of 'Fira Code' with Light style gives only 'Fira Code' regular style Jul 15, 2022
@veksha
Copy link
Contributor

veksha commented Jul 15, 2022

what if you will run strace cudatext ?

Well, I tried to launch cudatext this way:

strace cudatext 2>cudatext.trc

@froloffw7
try runing dbus-monitor and launching cudatext

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants