159 |
(dotimes (num max) |
(dotimes (num max) |
160 |
(let* (;; reverse for XEmacs: |
(let* (;; reverse for XEmacs: |
161 |
(num (- max (1+ num))) |
(num (- max (1+ num))) |
162 |
(face-name (intern (format "font-latex-title-%s-face" num))) |
(face-name (intern (format "font-latex-title-%s-face" num)))) |
|
(f-inherit (intern (format "font-latex-title-%s-face" (1+ num))))) |
|
163 |
(unless (get face-name 'saved-face) ; Do not touch customized faces. |
(unless (get face-name 'saved-face) ; Do not touch customized faces. |
164 |
(if (featurep 'xemacs) |
(if (featurep 'xemacs) |
165 |
(let ((size |
(let ((size |
175 |
(make-face-size face-name size)) |
(make-face-size face-name size)) |
176 |
(set-face-attribute face-name nil :height height-scale)))))) |
(set-face-attribute face-name nil :height height-scale)))))) |
177 |
|
|
178 |
(defcustom font-latex-title-fontify 1.1 ;; (if (featurep 'xemacs) 'color 1.1) |
(defcustom font-latex-title-fontify 1.1 |
179 |
"Whether to fontify LaTeX titles with varying height faces or a color face. |
"Whether to fontify LaTeX titles with varying height faces or a color face. |
180 |
|
|
181 |
If it is a number, use varying height faces. The number is used |
If it is a number, use varying height faces. The number is used |
182 |
for scaling starting from `font-latex-title-5-face'. Typically |
for scaling starting from `font-latex-title-5-face'. Typically |
183 |
value from 1.05 to 1.3 give best result, depending on your font |
value from 1.05 to 1.3 give best result, depending on your font |
184 |
setup. |
setup. If it is `color', use `font-lock-type-face'. |
185 |
|
|
186 |
If it is `color', use `font-lock-type-face'. |
Caveats: Customizing the scaling factor applies to all sectioning |
187 |
|
faces unless those face have been saved by customize. Setting |
188 |
|
this variable directly does not take effect; unless you call |
189 |
|
`font-latex-update-title-faces' or restart Emacs. |
190 |
|
|
191 |
Switching from `color' to a number or vice versa does not take |
Switching from `color' to a number or vice versa does not take |
192 |
effect unless you call \\[font-lock-fontify-buffer] or restart |
effect unless you call \\[font-lock-fontify-buffer] or restart |
193 |
Emacs." |
Emacs." |
194 |
;; Possibly add some word about XEmacs here. :-( |
;; Possibly add some words about XEmacs here. :-( |
195 |
:type '(choice (number :tag "Scale factor") |
:type '(choice (number :tag "Scale factor") |
196 |
(const color)) |
(const color)) |
197 |
:initialize 'custom-initialize-default |
:initialize 'custom-initialize-default |
201 |
(font-latex-update-title-faces font-latex-title-max value))) |
(font-latex-update-title-faces font-latex-title-max value))) |
202 |
:group 'font-latex) |
:group 'font-latex) |
203 |
|
|
204 |
(defun font-latex-make-title-faces (max) |
(defun font-latex-make-title-faces (max &optional height-scale) |
205 |
"Build the faces used to fontify sectioning commands." |
"Build the faces used to fontify sectioning commands." |
206 |
(unless max (setq max font-latex-title-max)) |
(unless max (setq max font-latex-title-max)) |
207 |
|
(unless height-scale |
208 |
|
(setq height-scale (if (numberp font-latex-title-fontify) |
209 |
|
font-latex-title-fontify |
210 |
|
1.1))) |
211 |
(dotimes (num max) |
(dotimes (num max) |
212 |
(let* (;; reverse for XEmacs: |
(let* (;; reverse for XEmacs: |
213 |
(num (- max (1+ num))) |
(num (- max (1+ num))) |
214 |
(face-name (intern (format "font-latex-title-%s-face" num))) |
(face-name (intern (format "font-latex-title-%s-face" num))) |
215 |
(f-inherit (intern (format "font-latex-title-%s-face" (1+ num))))) |
(f-inherit (intern (format "font-latex-title-%s-face" (1+ num)))) |
216 |
|
(size (when (featurep 'xemacs) |
217 |
|
(round (* 0.9 (face-height 'default) |
218 |
|
(expt height-scale (- max 1 num))))))) |
219 |
(eval |
(eval |
220 |
`(defface ,face-name |
`(defface ,face-name |
221 |
nil ; Set by `font-latex-update-title-faces' when needed. |
(if (featurep 'xemacs) |
222 |
|
'((t (:size ,(format "%spt" size)))) |
223 |
|
'((t (:height ,height-scale :inherit ,f-inherit)))) |
224 |
(format "Face for sectioning commands at level %s. |
(format "Face for sectioning commands at level %s. |
225 |
|
|
226 |
Probably you don't want to customize this face directly. Better |
Probably you don't want to customize this face directly. Better |
227 |
change the base face `font-latex-title-5-face' or customize the |
change the base face `font-latex-title-5-face' or customize the |
228 |
variable `font-latex-title-fontify'." num) |
variable `font-latex-title-fontify'." num) |
229 |
:group 'font-latex-highlighting-faces)) |
:group 'font-latex-highlighting-faces)) |
230 |
(unless (get face-name 'saved-face) ; Do not touch customized faces. |
(when (and (featurep 'xemacs) |
231 |
(if (fboundp 'set-face-parent) |
;; Do not touch customized faces. |
232 |
(set-face-parent face-name f-inherit) |
(not (get face-name 'saved-face))) |
233 |
(set-face-attribute face-name nil :inherit f-inherit)))))) |
(set-face-parent face-name f-inherit))))) |
234 |
|
|
235 |
(font-latex-make-title-faces font-latex-title-max) |
(font-latex-make-title-faces font-latex-title-max) |
|
(font-latex-update-title-faces font-latex-title-max) |
|
236 |
|
|
237 |
;;; Keywords |
;;; Keywords |
238 |
|
|