emacs-devel
[Top][All Lists]
Advanced

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

Accumulated fontset definition tweaks for testing


From: sand
Subject: Accumulated fontset definition tweaks for testing
Date: Thu, 15 May 2008 21:19:07 -0700

Below is the complete set of fontset changes that my system needed to
display the HELLO file and Markus Kuhn's "UTF-8-demo.txt" file.  There
are various problems with the fontset definitions that we can fix in
Emacs Lisp.

  1. The "symbol" and "phonetic" scripts don't have any representative
  characters defined, and they don't have any fontset defined.

  2. The Latin script doesn't have representative characters over
  7-bits.  This means the Xft backend doesn't have any constraint that
  would reject ISO8859-1 fonts.  Emacs appears to have special support
  for real ISO8859-1 characters, so the new definition should not
  break anything.

  3. The Armenian script has representative characters, but no fontset
  defined.

  4. The Thai fontset definition assumes that you have OpenType set
  up.  It needs a fallback in case you don't.

  5. The Hangul fontset definition assumes that you have a language
  definition in your Hangul font.  It needs a fallback in case you
  don't.

Note that for some people, the "symbol", "phonetic" and Latin scripts
may display just fine.  The problem is that Emacs is not rejecting
ISO8859-1 fonts---but if your installation happens to pick a
ISO10646-1 font with coverage first then you won't see any weirdness.
For example, my work machine had trouble displaying the scripts while
my home machine did not.

It may be that the Thai and Hangul definitions are the tip of the
iceberg.  I suspect that *every* ISO10646-1 fontset definition that
uses :otf or :language needs a fallback definition that uses :script.

If your HELLO file shows weird fonts being picked (such as a
double-width Chinese font for U+2018 LEFT SINGLE QUOTATION MARK) or
"missing font" boxes, can you please try putting the below code into
your .emacs file to see if it fixes the problem?  These were sufficent
to get my work machine displaying every HELLO and "UTF-8-demo.txt"
glyphs for every font that I had installed.

This code can be applied to CVS HEAD before or after the font-backend
merge.

Derek

--
Derek Upham
address@hidden

------------------------------ cut here ------------------------------

;; The eval-after-load here is a hack for testing.  These should
;; really be changes in "fontset.el".
;;
;; Some of the fontset definitions have 'prepend for testing.  When
;; added to "fontset.el" they should go into some appropriate
;; location in the current lists.

(eval-after-load "fontset"
  '(progn

;; Representative characters for Latin need to include the
;; various extension blocks.  This should replace the existing
;; definition.
(setq script-representative-chars
      (cons '(latin ?A ?Z ?a ?z #x00C0 #x0100 #x0180 #x1e00)
            script-representative-chars))

;; Representative characters for symbols were not defined.
(setq script-representative-chars
      (cons '(symbol #x201C #x2200 #x2500)
            script-representative-chars))

;; Representative characters for phonetics were not defined.
(setq script-representative-chars
      (cons '(phonetic #x0250 #x0283)
            script-representative-chars))

;; 'latin script needs a declaration that incorporates the Latin
;; representative characters.  None of the current ones do.
(set-fontset-font "fontset-default" 'latin
 (font-spec :registry "iso10646-1" :script 'latin) nil 'prepend)

;; No 'symbol script declaration exists.  Create one using the new
;; representative characters.
(set-fontset-font "fontset-default" 'symbol
 (font-spec :registry "iso10646-1" :script 'symbol))

;; No 'phonetic declaration exists.  Create one using the new
;; representative characters.  (Note that there is an 'ipa
;; declaration, but 'ipa doesn't exist as a real script.)
(set-fontset-font "fontset-default" 'phonetic
 (font-spec :registry "iso10646-1" :script 'phonetic))

;; No fontset was defined for Armenian.
(set-fontset-font "fontset-default" 'armenian
 (font-spec :registry "iso10646-1" :script 'armenian))

;; The Thai fontset definition assumes that you have OpenType
;; definitions set up properly.  We need an explicit :script
;; declaration as a backup.  I think this should go after the :otf
;; declaration, but I'm doing it as a 'prepend here.  (Perhaps
;; FreeSerif Thai fonts comply with OpenType, but Misc-Fixed
;; ones don't.)
(set-fontset-font "fontset-default" 'thai
 (font-spec :registry "iso10646-1" :script 'thai) nil 'prepend)

;; 'hangul script has a :language restriction for iso10646-1, but also
;; needs :script restriction as alternative.
(set-fontset-font "fontset-default" 'hangul
  (font-spec :registry "iso10646-1" :script 'hangul) nil 'prepend)

))




reply via email to

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