[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fonts and fontsets on X
From: |
Yuri D'Elia |
Subject: |
Fonts and fontsets on X |
Date: |
Fri, 12 Oct 2012 18:38:30 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.7) Gecko/20120922 Icedove/10.0.7 |
Hi everyone. I would like to have some insider's comments about
fontsets. I'm trying both emacs 23/24 from debian.
Can fontsets be used as a decent "fallback" mechanism whenever the
requested glyph of a font is missing?
The typical case scenario is a monospaced font that comes in both
normal/bold variants, but the bold face does not contain all glyphs.
Showing the glyph from the normal face would be better than using
another face.
My initial approach to this was:
(create-fontset-from-fontset-spec "-unknown-Droid Sans
Mono-normal-normal-normal-*-18-*-*-*-*-*-fontset-normal,-unknown-DejaVu
Sans Mono-normal-normal-normal-*-18-*-*-*-*-*-*")
(create-fontset-from-fontset-spec "-unknown-Droid Sans
Mono-bold-normal-normal-*-18-*-*-*-*-*-fontset-bold,-unknown-Droid Sans
Mono-normal-normal-normal-*-18-*-*-*-*-*-*,-unknown-DejaVu Sans
Mono-normal-normal-normal-*-18-*-*-*-*-*-*")
(set-face-attribute 'default :font "fontset-normal")
(set-face-attribute 'bold :font "fontset-bold")
But, it doesn't seem to work as intended. I still see glyphs coming from
a different face (math greek letters, for exacly). Why exactly?
My second attempt was to use fontconfig, which works correctly under urxvt:
<fontconfig>
<match target="font">
<test name="family">
<string>Droid Sans Mono</string>
</test>
<edit name="family" mode="append" binding="weak">
<string>DejaVu Sans Mono</string>
</edit>
</match>
<match target="font">
<test name="family">
<string>Droid Sans</string>
</test>
<test name="weight">
<const>bold</const>
</test>
<edit name="fullname" mode="append" binding="same">
<string>Droid Sans Regular</string>
</edit>
</match>
</fontconfig>
notice how I define a "same" binding which replaces the fullname of the
font for the bold variant, and then a general weak fallback.
However, emacs still completely ignores my definition, and C-u C-x =
confirms that the font being displayed is not the one I requested. By
reading the manual, starting emacs with -fn 'Droid Sans Mono' should use
all glyps from Droid (then DejaVu Sans, if my fontconfig setup is ok),
and *then* use fontset-default.
Then, let's assume I have a different family for 'variable-pitch, which
is reasonable, since I don't want monospaced glyphs here.
Again, it seems that the only way I can make use of the font's own
glyphs before the fallback is to define its own fontset and redefine all
the ranges.
Either I don't get it, or fontset doesn't seem to play well at all with
font-lock and different faces.
- Fonts and fontsets on X,
Yuri D'Elia <=