Hello everybody,
for making section headings in LaTeX source code stand out, AUCTeX
uses a variable-pitch font and scales it based on the section level.
In order to achieve this on XEmacs it tries to get the size of the
default face/font, multiplies it with an appropriate factor and feeds
the size back to a defface statement.
The currently released version of AUCTeX uses `face-height' to get the
default size. Steven E. Harris mentioned on the AUCTeX mailing list
that this, as the sum of the face's ascent and descent, does not
correctly reflect the font size. He suggested a solution based on the
function `font-size' similar to the one used in
`custom-face-font-size'.
The problem now is that `font-size' (on X) can return
* an integer if the font size was specified in points,
* a string if the font size was specified in pixels or
* nil if the font size was not specified at all.
In order to catch those cases we now have
(let* ((base-size (font-size (font-create-object
(face-font-name 'default))))
(base-size-num (cond ((numberp base-size)
base-size)
((stringp base-size)
(string-to-number
(progn
(string-match "^[0-9]+" base-size)
(match-string 0 base-size))))
(t (face-height 'default))))
in font-latex.el. The resulting value will be multiplied with the
scaling factor, converted to a string, concatenated with "pt" and used
for the :size specifier of the defface statement.
Is this an appropriate way to handle this in XEmacs? (I am not really
sure because `font-size' is undocumented and I had to look at
`x-font-create-object' in order to see what it may return.) Or is
there a better method?
--
Ralf