emacs-pretest-bug
[Top][All Lists]
Advanced

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

Carbon / reported font width wrong?


From: David Reitter
Subject: Carbon / reported font width wrong?
Date: Fri, 11 Nov 2005 15:50:14 +0000

In the Carbon port (current CVS), fontset-info or frame-char-width report wrong pixel widths for fonts. In the example below, two fontsets are created. The I set the frame font (to load the font) and compare reported character width with (frame-char-width).

From my understanding of the documentation, the two should be the same - but they differ.

Please correct me if my understanding is wrong and this is not a bug. In that case it'd be helpful to know how to determine the height and normal width of characters in a fontset before the fontset is actually loaded. The reason why I'd like to do this is to change the font of a given frame without changing its pixel size (or at least with only minimal changes in pixel size). For this, I need to calculate the new (character-based) width and height using the old ones and the old and new font character dimensions.

Thanks
D

---

(defun create-aquamacs-fontset (maker name weight variety style sizes &optional fontsetname) "Create a mac fontset with the given properties (leave nil to under-specify). SIZES is a list of integers, indicating the desired font sizes in points. Errors are signalled with ``signal-font-error'', unless ''ignore-font- errors''
is non-nil. (This function is part of Aquamacs and subject to change.)"
  (message (concat "Defining fontset: " (or fontsetname name)))
  (condition-case e
      (dolist (size sizes)
        
        (create-fontset-from-mac-roman-font
         (format "-%s-%s-%s-%s-%s-*-%s-*-*-*-*-*-mac-roman"
                 (or maker "*")
                 (or name "*")
                 (or weight "*")
                 (or variety "*")
                 (or style "*")
                 size
                 )
         nil
         (concat (or fontsetname name) (int-to-string size))
         )
        )
    (error (signal-font-error e)))

)

(create-aquamacs-fontset
"apple" "lucida grande*" "medium" "r" "normal" '(9 10 11 12 13 14 16 18) "lucida" )
(create-aquamacs-fontset
"apple" "monaco*" "medium" "r" "normal" '(9 10 11 12 13 14 16 18) "monaco" )


(set-frame-font "fontset-lucida13")
(fontset-info "fontset-lucida13")
;; "SIZE is the maximum bound width of ASCII font in the fontset,"
;; first element of vector is 15 (width in pixels)
(frame-char-width)


(set-frame-font "fontset-monaco12")
(fontset-info "fontset-monaco12")
;; width reported is 8
(frame-char-width)
;; real width is 7




reply via email to

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