help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Browsing Unicode Symbols


From: Florian Beck
Subject: Re: Browsing Unicode Symbols
Date: Wed, 09 Jul 2008 00:52:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Peter Dyballa <address@hidden> writes:

> Am 08.07.2008 um 14:58 schrieb Nordlöw:
>
>> Is there a way to visually browse/explore the Unicode symbols
>> available in GNU Emacs (CVS) either globally or locally defined by a
>> specific/current font? Compare list-colors-display().
>
> Yes. Open utf8.txt from the Kermit distribution. When you're using
> only fonts (as opposed to fontsets) then you'll see, what this font
> can offer for you.

How exactly do I do this: »using only fonts (as opposed to fontsets)«?
As far as I can see I am always using a fontset.

Anyway, to see how a certain character is displayed, simply insert it:

(insert (propertize STRING 'face `(:family ,(format "%s" FONT))))

To visualise how a certain character is displayed by all your fonts, you
can use something like this:

(defun insert-char-all-fonts (char &optional collection start end)
  "Insert CHAR with all fonts in COLLECTION."
  (let ((collection (delete-dups (or collection (mapcar #' (lambda (font) (aref 
font 0)) (x-family-fonts)))))
        (i 0))
    (dolist (font collection)
      (if (and (or (not start) (>= i start))
               (or (not end) (<= i end)))
      (insert ;(get-char-with-font char font)
                (propertize char 'face `(:family ,(format "%s" font)))))
      (incf i))))

You have to turn off font-lock to see the effect.

Caveat: this gets *very* slow if you have a lot of fonts (use start and
end).

To see how a specific font renders all characters, dolist the characters
defined in the the unicode standard (/admin/unidata/UnicodeData.txt in
the emacs sources).
     

-- 
Florian Beck


reply via email to

[Prev in Thread] Current Thread [Next in Thread]