For the longest time, this has bombed for me on an Xft XEmacs:
(font-default-size-for-device)
The attached patch fixes this, and is enough to make W3 come up. (Which
hasn't worked for me since I switched to Xft.) I'll apply on Wednesday
or so if nobody objects.
2007-12-23 Mike Sperber <mike(a)xemacs.org>
* font.el (xft-font-create-object): Use
`fc-pattern-get-or-compute-size' instead of
`fc-pattern-get-size'.
* fontconfig.el (fc-pattern-get-or-compute-size): Add.
--
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla
diff --git a/lisp/font.el b/lisp/font.el
--- a/lisp/font.el
+++ b/lisp/font.el
@@ -813,7 +813,7 @@ Optional DEVICE defaults to `default-x-d
(pattern (fc-font-match device (fc-name-parse name)))
(font-obj (make-font))
(family (fc-pattern-get-family pattern 0))
- (size (fc-pattern-get-size pattern 0))
+ (size (fc-pattern-get-or-compute-size pattern 0))
(weight (fc-pattern-get-weight pattern 0)))
(set-font-family font-obj
(and (not (equal family 'fc-result-no-match))
diff --git a/lisp/fontconfig.el b/lisp/fontconfig.el
--- a/lisp/fontconfig.el
+++ b/lisp/fontconfig.el
@@ -349,6 +349,20 @@ corresponding Xft font slant constant."
(defun fc-font-weight-translate-from-string (str)
(let ((pair (assoc str fc-font-name-weight-mapping-string-reverse)))
(if pair (cdr pair))))
+
+(defun fc-pattern-get-or-compute-size (pattern id)
+ "Get the size from `pattern' associated with `id' or try to compute it.
+Returns NIL if unsucessful."
+ ;; Many font patterns don't have a "size" property, but do have a
+ ;; "dpi" and a "pixelsize" property".
+ (let ((maybe (fc-pattern-get-size pattern id)))
+ (if (not (eq maybe 'fc-result-no-match))
+ maybe
+ (let ((dpi (fc-pattern-get-dpi pattern id))
+ (pixelsize (fc-pattern-get-pixelsize pattern id)))
+ (if (and dpi pixelsize)
+ (* pixelsize (/ 72 dpi))
+ nil)))))
(defun fc-copy-pattern-partial (pattern attribute-list)
"Return a copy of PATTERN restricted to ATTRIBUTE-LIST.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches