[oi-dev] Emacs has a bad font
Andreas Wacknitz
a.wacknitz at gmx.de
Tue Jun 11 19:34:55 UTC 2024
I am an emacs user and have configured it to use my preferred font.
This
(use-package font
:no-require
:hook (after-init . setup-fonts)
:preface
(defun font-installed-p (font-name)
"Check if a font with FONT-NAME is available."
(find-font (font-spec :name font-name)))
(defun setup-fonts ()
(cond ((font-installed-p "JetBrainsMono")
(set-face-attribute 'default nil :font "JetBrainsMono"))
((font-installed-p "Source Code Pro")
(set-face-attribute 'default nil :font "Source Code Pro"))
((font-installed-p "DejaVu Sans")
(set-face-attribute 'default nil :font "DejaVu Sans")))
(provide 'font)))
is what I am using in my init.el file to choose my preferred font.
When I evaluate-and-print
(face-attribute 'default :font)
#<font-object "-JB-JetBrains
Mono-regular-normal-normal-*-27-*-*-*-m-0-iso10646-1">
I am sure that I am using JetBrains Mono as intended.
Andreas
Am 11.06.24 um 03:09 schrieb Gordon Ross:
> Looking into this again. I definitely have this font selected:
>
> $ fc-match "Deja Vu Sans Mono"
> DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
> $ fc-match "Deja Vu Sans Mono-12"
> DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
>
> It exists, and is a TrueType font.
> If I use that font in a mate-terminal profile
> (un-check "use system font" and specify that)
> it renders with font smoothing as expected.
>
> Selecting that same font in emacs give the jagged edges.
> Any ideas what else could be disabling font smoothing?
>
> On Tue, Nov 21, 2023 at 7:58 PM Alan Coopersmith
> <alan.coopersmith at oracle.com> wrote:
>> Yes, the "bad" one is not antialiased, possibly a bitmap font,
>> while the "good" one is definitely antialiased, possibly TrueType or OpenType.
>>
>> -alan-
>>
>> On 11/21/23 07:25, Gordon Ross wrote:
>>> Thanks. I've confirmed that emacs is using the system font in both builds.
>>> Here are two screen shots (bad, good) that one can zoom in.
>>> The bad one has visible stair step diagonals etc. so I guess
>>> the good one has "anti-aliasing" and the bad does not?
>>> Does that clue help in tracking this down?
>>>
>>> On Mon, Nov 20, 2023 at 2:20 PM Alan Coopersmith
>>> <alan.coopersmith at oracle.com> wrote:
>>>> GTK & Pango use fonts from fontconfig, not from X11, so it's not expected
>>>> to match xfontsel (which uses X11 fonts). Among other things, Pango 1.44
>>>> dropped support for Type 1 & bitmap fonts, which X11/xfontsel still support,
>>>> leaving TrueType & OpenType font support. One easy to spot difference,
>>>> fontconfig uses more natural names, like "DejaVu Sans Mono", while X11 uses
>>>> the older naming format with the 14 dashes separating fields. Visually,
>>>> if the font is anti-aliased or LCD optimized, it must be fontconfig, as
>>>> the X11 font system doesn't support either technology.
>>>>
>>>> https://www.x.org/releases/current/doc/xorg-docs/fonts/fonts.html
>>>> describes the difference (using "Xft" for the fontconfig system),
>>>> but it's about a decade behind the latest changes now.
>>>>
>>>> -alan-
>>>>
>>>> On 11/20/23 11:10, Gordon Ross wrote:
>>>>> As far as I can tell, the "system" font for mate terminal and such is:
>>>>> "DejaVu Sans Mono", or
>>>>> -misc-dejavu sans mono-medium-o-normal--0-0-0-0-p-0-ascii-0
>>>>>
>>>>> Based on what I see with xfontsel, it looks like emacs may be using:
>>>>> -misc-dejavu sans light-extralight-r-normal--0-0-0-0-p-0-ascii-0
>>>>>
>>>>> I tried playing with the options/Set Default Font in emacs.
>>>>> I'm not sure why, but emacs shows a lot less than xlsfonts does.
>>>>>
>>>>> Here's what I have (from "save options") in both builds.
>>>>> (custom-set-faces
>>>>> ;; custom-set-faces was added by Custom.
>>>>> ;; If you edit it by hand, you could mess it up, so be careful.
>>>>> ;; Your init file should contain only one such instance.
>>>>> ;; If there is more than one, they won't work right.
>>>>> '(default ((t (:family "DejaVu Sans Mono" :foundry "PfEd" :slant
>>>>> normal :weight normal :width normal :height 113)))))
>>>>>
>>>>> There seems to be a change in either the fonts or the rendering, from
>>>>> the older OI build to recent ones.
>>>>> The examples shown by "xfontsel" look too light in some cases too.
>>>>> I'd appreciate tips on how to track down this problem.
>>>>>
>>>>> Thanks
>>>>>
>>>>> On Wed, Nov 8, 2023 at 4:27 PM Gary Mills <gary_mills at fastmail.fm> wrote:
>>>>>> On Wed, Nov 08, 2023 at 05:44:42PM +0100, Andreas Wacknitz wrote:
>>>>>>
>>>>>>> If you are using the gtk variant of emacs
>>>>>> That's the one I'm using.
>>>>>>
>>>>>>> then it relies on pango for
>>>>>>> font rendering and layout which in case has dropped support for older
>>>>>>> font types a couple of months ago.
>>>>>>> So your problem might be that you are trying to use an unsupported (by
>>>>>>> pango) font type and thus rendering results look ugly.
>>>>>>> You might solve this be choosing a font of a supported font type, eg. a
>>>>>>> truetype font.
>>>>>> There's no indication of truetype in the list of fonts that emacs
>>>>>> displays. In fact, emacs will often tell me that a font does not
>>>>>> exist when I select that font from its list.
>>>>>>
>>>>>>
>>>>>> --
>>>>>> -Gary Mills- -refurb- -Winnipeg, Manitoba, Canada-
>>>>>>
>>>>>> _______________________________________________
>>>>>> oi-dev mailing list
>>>>>> oi-dev at openindiana.org
>>>>>> https://openindiana.org/mailman/listinfo/oi-dev
>>>>> _______________________________________________
>>>>> oi-dev mailing list
>>>>> oi-dev at openindiana.org
>>>>> https://openindiana.org/mailman/listinfo/oi-dev
>>>>
>> --
>> -Alan Coopersmith- alan.coopersmith at oracle.com
>> Oracle Solaris Engineering - https://blogs.oracle.com/solaris
>>
> _______________________________________________
> oi-dev mailing list
> oi-dev at openindiana.org
> https://openindiana.org/mailman/listinfo/oi-dev
More information about the oi-dev
mailing list