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

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

Re: [h-e-w] Font mixup.


From: Jason Rumney
Subject: Re: [h-e-w] Font mixup.
Date: 15 Nov 2001 19:35:57 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50

Anders Lindgren <address@hidden> writes:

> Hi!
> 
> I just upgraded from Emacs 20 to 21 and realized that my favourite
> font is no longer available.
> 
> Or rather, the font menu (Shift-Left Mouse Button) correctly finds it
> and displays it as a correct sample.  However, whenever I selects it
> emacs will reder itself using a totally different font.
> 
> The font in question is Terminal Regular of size 6, as returned by
> w32-select-font:
> 
> "-raster-Terminal-normal-r-normal-normal-8-60-96-96-c-*-ms-oemlatin"

There is a bug that only iso8859-1 fonts are used for ASCII in 21.1
(I still haven't determined if this is Windows specific)

Robert Praetorius posted the following workaround to this list a
couple of weeks ago:


(Please excuse this code - it's neither optimal nor well organized.  It 
just accreted until I had worked around the problem.  And once I had, 
cleaning it up wasn't my top priority.)

;; I think I might be able to cons up a coding system with
;; cp-make-coding-systems-for-codepage (cp850 for Terminal fonts)
;; but I really don't want a whole new coding system - I just want
;; to use a subset of a font that's compatible with the current
;; coding system.
;; TBD I wish I know how to get the (default?) charset of the current
;; buffer - then I could go to x-font-name-charset-alist and look up
;; string the w32 charset/codepage pair (w32-charset-ansi 1252) in
;; w32-charset-info-alist (I currently have it hardwired)
(defun rudely-wedge-font-into-face (font face)
  "used when we know we're only going to be using a subset
of the font (commonly the 7 bit subset) and really really
want that font even though it has the wrong charset.
Assumes the coding system is iso-latin-1"
  (let* ((xlfd (x-decompose-font-name font))
         (charset-name (concat (aref xlfd 12) "-" (aref xlfd 13)))
         (set-and-page (assoc charset-name w32-charset-info-alist))
         (save-wcia w32-charset-info-alist)
         (save-iedr inhibit-eval-during-redisplay)
         (fudged-font-name (x-compose-font-name
                            (progn (aset xlfd 12 "iso8859")
                                          (aset xlfd 13 "1")
                                          xlfd))))
    (unwind-protect
        (progn
          (push (cons "iso8859-1" (cdr set-and-page))
                w32-charset-info-alist)
          (setq inhibit-eval-during-redisplay nil)
;         (set-face-attribute face nil :family "Terminal")
          (set-face-attribute face nil :font fudged-font-name)
          (message (propertize "%s" 'face face) face)
          (let ((redisplay-dont-pause t))
            (sit-for 0)))
      (setq w32-charset-info-alist save-wcia)
      (setq inhibit-eval-during-redisplay save-iedr))))


-- 
Jason Rumney




reply via email to

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