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

face problem on windows #113

Open
albreche opened this issue Feb 1, 2022 · 7 comments
Open

face problem on windows #113

albreche opened this issue Feb 1, 2022 · 7 comments

Comments

@albreche
Copy link

albreche commented Feb 1, 2022

Hi there,
on windows, i can't get the faces weight behaviour. Below an illustration of the problem : all fonts are medium

image

Note faces are correctly set (eg: header1 has face org-level-1 which inherits from nano-face-strong).
Changing the nano-face-strong weight in nano-face.el to bold produce the expected result.
I use roboto mono which defines the expected weight.

It seems the problem is a kind of interference with default fonlt as set from the gui.

Does anyone has a clue ?

Btw, awesome work here !

@albreche
Copy link
Author

albreche commented Feb 2, 2022

edit: the problem come from the ttfs. Using RobotoMono NF (from nerdfont, the windows compatible one), the face changes depending on structural info, which is the expected behavior. But using the Roboto Mono from google, it does not work.
Hence, i believe i have a problem with emacs, fonts and Windows.
Consequently, this issue is not relevant regarding nano emacs.

@rougier
Copy link
Owner

rougier commented Feb 2, 2022

Thanks for the report. If you get the problem, probably others will have the same. If you find the reason and fix, please post if here.

@albreche
Copy link
Author

albreche commented Feb 3, 2022

looking at variable 'font-weight-table', i see that 'medium' is an alias for 'normal'. In nano-faces.el, the nano-face-strong is set to 'medium' for graphic-display. Hence , nano-face-strong wheight is the same as default face .

a quick&dirty fix this is to set the weight attribute to , eg, semibold instead of medium in nano-faces.el in graphic mode

diff --git "a/nano-faces.el" "b/nano-faces.el"
index 8904cf5..3d02f64 100644
--- "a/nano-faces.el"
+++ "b/nano-faces.el"
@@ -204,7 +204,7 @@ background color that is barely perceptible."
   (if (display-graphic-p)
       (set-face-attribute 'nano-face-strong nil
                           :foreground (face-foreground 'nano-face-default)
-                          :weight 'medium)
+                          :weight 'semi-bold)
     (set-face-attribute 'nano-face-strong nil
                         :foreground (face-foreground 'nano-face-default)
                         :weight 'bold))

@albreche
Copy link
Author

albreche commented Feb 6, 2022

Now, it works better using static ttf files and updating nano-faces.el with familiy attributes corresponding to the correct ttf as for example :

--- "a/nano-faces.el"
+++ "b/nano-faces.el"
@@ -204,18 +204,24 @@ background color that is barely perceptible."
   (if (display-graphic-p)
       (set-face-attribute 'nano-face-strong nil
                           :foreground (face-foreground 'nano-face-default)
-                          :weight 'medium)
+                          :weight 'medium
+                          :family "Roboto Mono Medium")


@rougier
Copy link
Owner

rougier commented Feb 15, 2022

Thanks. I'm not sure to understand why Emacs failq at settings the weight from the :weight property.

@claudiusmueller
Copy link

I just wanted to add that this is still a problem (Windows 10, Emacs 29.2). The solution provided above by @albreche still works.

@rougier
Copy link
Owner

rougier commented Mar 18, 2024

On OSX, a patch for fixing weight has been recently merged but I don't think it will dod anything on Windows.

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

No branches or pull requests

3 participants