--- font.el~ 2009-05-18 08:51:06.000000000 -0600 +++ font.el 2009-08-22 16:35:06.000000000 -0600 @@ -114,6 +114,7 @@ (fc . (fc-font-create-name fc-font-create-object)) (ns . (ns-font-create-name ns-font-create-object)) (mswindows . (mswindows-font-create-name mswindows-font-create-object)) + (carbon . (carbon-font-create-name carbon-font-create-object)) (pm . (x-font-create-name x-font-create-object)) ; Change? FIXME ;; #### what is this bogosity? (tty . (tty-font-create-plist tty-font-create-object))) @@ -1054,6 +1055,40 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; The window-system dependent code (carbon-style) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun carbon-font-create-object (fontname &optional device) + "Return a font descriptor object for FONTNAME, appropriate for Carbon devices." + (let* ((parsed-fontspec (carbon-parse-fontspec fontname)) + (retval (make-font :family (carbon-font-name parsed-fontspec) + :size (carbon-font-size parsed-fontspec))) + (style (carbon-font-style parsed-fontspec))) + (if (member style '("b" "bi" "bold" "bolditalic")) + (set-font-bold-p retval t)) + (if (member style '("i" "bi" "italic" "bolditalic")) + (set-font-italic-p retval t)) + retval)) + +(defun carbon-font-create-name (fontobj &optional device) + "Return a font name constructed from FONTOBJ, appropriate for Carbon devices." + (let* ((family (font-family fontobj)) + (size (font-size fontobj)) + (italic-p (font-italic-p fontobj)) + (bold-p (font-bold-p fontobj)) + (font-name (format + (cond ((and italic-p bold-p) "%s:%s:bi") + (italic-p "%s:%s:i") + (bold-p "%s:%s:b") + (t "%s:%s")) + (car family) + size))) + (if (try-font-name font-name) + font-name + (face-font 'default)))) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Now overwrite the original copy of set-face-font with our own copy that ;;; can deal with either syntax. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;