all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri D'Elia <wavexx@users.sourceforge.net>
To: emacs-devel@gnu.org
Subject: Fonts and fontsets on X
Date: Fri, 12 Oct 2012 18:38:30 +0200	[thread overview]
Message-ID: <k59h1n$23t$1@ger.gmane.org> (raw)

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.




             reply	other threads:[~2012-10-12 16:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-12 16:38 Yuri D'Elia [this message]
2012-10-16 12:06 ` Fonts and fontsets on X Kenichi Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='k59h1n$23t$1@ger.gmane.org' \
    --to=wavexx@users.sourceforge.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.