[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Aquamacs-bugs] Re: incorrect fontification of non-ascii chars on Ma
From: |
YAMAMOTO Mitsuharu |
Subject: |
Re: [Aquamacs-bugs] Re: incorrect fontification of non-ascii chars on Mac OS X 10.4 |
Date: |
Fri, 01 Jul 2005 17:02:49 +0900 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/22.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) |
>>>>> On Thu, 30 Jun 2005 19:19:08 +0100, David Reitter <address@hidden> said:
> On 30 Jun 2005, at 11:40, YAMAMOTO Mitsuharu wrote:
>> I'm not aware of that (I only define one fontset on startup).
>> Removing the Foptimize_char_table call in Fset_fontset_font
>> (fontset.c) seems to improve the speed at least for this case.
> I removed this (and the checks etc.) and it does improve the speed
> significantly. I'm down to maybe 2 seconds for those 25
> fontsets. However, this is still too long - especially considered we
> get more fontsets in the future.
I'm now trying to make create-fontset-from-mac-roman-font faster by
creating a template for character mapping and reusing it. The code at
the end of this mail makes it 5 times faster (without removing the
Foptimize_char_table call). Unfortunately, it introduces some wrong
glyphs and I suspect there's a bug in fontset manipulation.
For example, the following example results in a non-nil value. I.e.,
character ranges returned by fontset-info may contain generic
characters.
(let (result)
(dolist (char-font (aref (fontset-info "fontset-default") 2))
(if (and (consp (car char-font))
(or (generic-char-p (car (car char-font)))
(generic-char-p (cdr (car char-font)))))
(setq result (cons char-font result))))
result)
Sometimes there's also a generic characters in non-boundary position,
and it confuses set-fontset-font. For example, after the evaluation
of
(set-fontset-font "fontset-startup" '(299753 . 299819)
'("dingbats" . "adobe-fontspecific")),
the result of (fontset-info "fontset-startup") contains an entry
((299753 . 299903) ("dingbats" . "adobe-fontspecific")). There's a
generic character 299776 in this range.
>> I think that's because the current Emacs internal code, aka
>> emacs-mule, is created so that it matches the X11 font system. You
>> don't want to change the Emacs internal code for the Carbon port,
>> do you?
> It's probably smart to wait for unicode support. But at that point
> it would make sense to be able to sidestep Mule and use the system's
> input and text display (=font selection) methods. And that applies
> to all ports where the underlying systems offer good inputs methods.
> Maybe it would help if someone (more knowledgeable than me) took a
> good look at how it's done in the Emacs-on-Aqua port.
I'm not quite sure why such aspects relate to fontset creation. Maybe
I don't understand what you mean.
YAMAMOTO Mitsuharu
address@hidden
(new-fontset "fontset-mac_template"
'((ascii . "-*-monaco-medium-r-normal--12-*-*-*-*-*-mac-roman")))
(let ((fontset "fontset-mac_template"))
(dolist
(font-encoder
(nreverse
(mapcar (lambda (lst)
(cons (cons (nth 3 lst) (nth 0 lst)) (nth 1 lst)))
mac-font-encoder-list)))
(let ((font (car font-encoder))
(encoder (cdr font-encoder)))
(map-char-table
(lambda (key val)
(or (null val)
(generic-char-p key)
(memq (char-charset key)
'(ascii eight-bit-control eight-bit-graphic))
(set-fontset-font fontset key font)))
(get encoder 'translation-table)))))
(defconst mac-char-fontspec-list
(let* ((first (aref (fontset-info "fontset-mac_template") 2))
(prev first)
(mac-registries (mapcar 'car mac-font-encoder-list)))
(while (cdr prev)
(if (not (member (cdr-safe (cadr (car (cdr prev)))) mac-registries))
(setcdr prev (cdr (cdr prev)))
(setq prev (cdr prev))))
;; skip ascii
(cdr first)))
(defun fontset-add-mac-fonts (fontset &optional base-family)
(if base-family
(setq base-family (downcase base-family))
(let ((ascii-font
(downcase (x-resolve-font-name
(fontset-font fontset (charset-id 'ascii))))))
(setq base-family (aref (x-decompose-font-name ascii-font)
xlfd-regexp-family-subnum))))
(dolist (char-fontspec mac-char-fontspec-list)
(set-fontset-font fontset (car char-fontspec)
(cons (format (car (cadr char-fontspec)) base-family)
(cdr (cadr char-fontspec))))))