Hello Prot,
First of all, thank you for the interpretation of cultural works,
philosophical entries and high quality Emacs packages.
Currently, I'm trying to tweak `shr-use-fonts' to use proportional fonts
in EWW and nov-mode. But, I'm not able to get desired results from the
bold face, to reproduce the error, try the following snippet in emacs -Q
session:
(progn
(package-initialize)
(package-install 'fontaine)
(require 'fontaine)
(setq fontaine-presets
'((regular
:variable-pitch-family "sans-serif")))
(fontaine-set-preset 'regular)
(with-temp-buffer
(setq buffer-file-name "/tmp/test.html")
(insert
"Some <b>bold</b>, <i>italics</i> and <b><i>bold-italics</i></b> text.")
(save-buffer))
(setq-default shr-use-fonts t)
(eww-open-file "/tmp/test.html"))
You will be presented with an EWW buffer where Emacs will not be able to
use bold font of your default Sans-serif family. Now, try the following
snippet with M-: binding:
(progn
(setq-local shr-use-fonts nil)
(eww-reload t))
This works as expected, is there something wrong in my Fountaie's
config?
Thank you,
Utkarsh Singh
--
Utkarsh Singh
https://utkarshsingh.xyz/
> From: Utkarsh Singh <utkarsh190601@gmail.com>> Date: Sun, 17 Jul 2022 15:29:09 +0530>> Hello Prot,
Hello Utkarsh and thank you for taking the time to report this in such
detail!
> First of all, thank you for the interpretation of cultural works,> philosophical entries and high quality Emacs packages.
You are welcome! Over the coming weeks I plan to study some
translations of Hindu material, if all goes well.
> Currently, I'm trying to tweak `shr-use-fonts' to use proportional fonts> in EWW and nov-mode. But, I'm not able to get desired results from the> bold face, to reproduce the error, try the following snippet in emacs -Q> session:> [... 29 lines elided]> This works as expected, is there something wrong in my Fountaie's> config?
I can reproduce the bug. Though it happens on my end without calling a
fontain function.
I place this text in the scratch buffer:
(progn
(setq-local shr-use-fonts nil)
(eww-reload t))
And then I evaluate the following one-by-one to see the results on the
'progn' and 'setq-local' keywords:
(set-face-attribute 'font-lock-keyword-face nil :inherit '(variable-pitch bold italic))
(set-face-attribute 'font-lock-keyword-face nil :inherit 'unspecified)
(set-face-attribute 'font-lock-keyword-face nil :inherit '(bold variable-pitch italic))
The first one is faulty, while the last one is correct. Does this
happen on your end as well? Not with emacs -Q, just you regular setup.
In other words, the order of inheritance is what is causing the problem
here. I will check what we can do in fontaine and report back to you.
All the best,
Prot
--
Protesilaos Stavrou
https://protesilaos.com
> From: Protesilaos Stavrou <info@protesilaos.com>> Date: Sun, 17 Jul 2022 14:53:04 +0300>> In other words, the order of inheritance is what is causing the problem> here. I will check what we can do in fontaine and report back to you.
While the order of inheritance does matter, the real problem is
fontaine's. It sets an explicit weight attribute to the face. So when
we have ":inherit (variable-pitch bold)" the weight of the former
overrides the latter.
Here we are applying an explicit weight:
(fontaine--apply-preset
fontaine--apply-variable-pitch-preset
"Set `variable-pitch' face attributes based on PRESET for optional FRAME."
(fontaine--set-face-attributes
'variable-pitch
(or (plist-get properties :variable-pitch-family) (plist-get properties :default-family))
(or (plist-get properties :variable-pitch-weight) (plist-get properties :default-weight))
(or (plist-get properties :variable-pitch-height) 1.0)
frame))
I am not sure what the solution is. We could test if the weight of
variable-pitch is the same as the default face, and internally set the
weight to "unspecified". But that will not solve the problem: the bug
will appear again when the user applies a different weight for
variable-pitch than they do for the default face.
--
Protesilaos Stavrou
https://protesilaos.com