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))) |
163 |
(f-inherit (intern (format "font-latex-title-%s-face" (1+ num))))) |
(f-inherit (intern (format "font-latex-title-%s-face" (1+ num))))) |
164 |
(if (featurep 'xemacs) |
(unless (get face-name 'saved-face) ; Do not touch customized faces. |
165 |
(let ((size |
(if (featurep 'xemacs) |
166 |
;; Multiply with .9 because `face-height' returns a value |
(let ((size |
167 |
;; slightly larger than the actual font size. |
;; Multiply with .9 because `face-height' returns a value |
168 |
;; `make-face-size' takes numeric points according to Aidan |
;; slightly larger than the actual font size. |
169 |
;; Kehoe in <16989.15536.613916.678965@parhasard.net> (not |
;; `make-face-size' takes numeric points according to Aidan |
170 |
;; documented). |
;; Kehoe in <16989.15536.613916.678965@parhasard.net> (not |
171 |
(round (* 0.9 |
;; documented). |
172 |
(face-height 'default) |
(round (* 0.9 |
173 |
(expt height-scale (- max 1 num)))))) |
(face-height 'default) |
174 |
;; (message "%s - %s" face-name size) |
(expt height-scale (- max 1 num)))))) |
175 |
(make-face-size face-name size)) |
;; (message "%s - %s" face-name size) |
176 |
(set-face-attribute face-name nil :height height-scale))))) |
(make-face-size face-name size)) |
177 |
|
(set-face-attribute face-name nil :height height-scale)))))) |
178 |
|
|
179 |
(defcustom font-latex-title-fontify 1.1 ;; (if (featurep 'xemacs) 'color 1.1) |
(defcustom font-latex-title-fontify 1.1 ;; (if (featurep 'xemacs) 'color 1.1) |
180 |
"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. |
192 |
;; Possibly add some word about XEmacs here. :-( |
;; Possibly add some word about XEmacs here. :-( |
193 |
:type '(choice (number :tag "Scale factor") |
:type '(choice (number :tag "Scale factor") |
194 |
(const color)) |
(const color)) |
195 |
:initialize (lambda (symbol value) |
:initialize 'custom-initialize-default |
|
(set-default symbol (eval value))) |
|
196 |
:set (lambda (symbol value) |
:set (lambda (symbol value) |
197 |
(set-default symbol value) |
(set-default symbol value) |
198 |
(unless (eq value 'color) |
(unless (eq value 'color) |
206 |
(let* (;; reverse for XEmacs: |
(let* (;; reverse for XEmacs: |
207 |
(num (- max (1+ num))) |
(num (- max (1+ num))) |
208 |
(face-name (intern (format "font-latex-title-%s-face" num))) |
(face-name (intern (format "font-latex-title-%s-face" num))) |
209 |
(f-inherit (intern (format "font-latex-title-%s-face" (1+ num)))) |
(f-inherit (intern (format "font-latex-title-%s-face" (1+ num))))) |
|
face-exists) |
|
|
;; If the use has customized this face (i.e. it already exists), we must |
|
|
;; not set the parent/inherit property. |
|
|
(setq face-exists (if (featurep 'xemacs) |
|
|
(find-face face-name) |
|
|
(facep face-name))) |
|
210 |
(eval |
(eval |
211 |
`(defface ,face-name |
`(defface ,face-name |
212 |
nil ;; Set by `font-latex-update-title-faces' when needed. |
nil ; Set by `font-latex-update-title-faces' when needed. |
213 |
(format "Face for LaTeX titles at level %s. |
(format "Face for sectioning commands at level %s. |
214 |
|
|
215 |
Probably you don't want to customize this face directly. Better |
Probably you don't want to customize this face directly. Better |
216 |
change the base face `font-latex-title-5-face' or customize the |
change the base face `font-latex-title-5-face' or customize the |
217 |
variable `font-latex-title-fontify'." num) |
variable `font-latex-title-fontify'." num) |
218 |
:group 'font-latex-highlighting-faces)) |
:group 'font-latex-highlighting-faces)) |
219 |
(if face-exists |
(unless (get face-name 'saved-face) ; Do not touch customized faces. |
|
(message "face:%s already exists, skipping parent" face-name) |
|
|
;; (message "face:%s, inherit/parent:%s" face-name f-inherit) |
|
220 |
(if (fboundp 'set-face-parent) |
(if (fboundp 'set-face-parent) |
221 |
(set-face-parent face-name f-inherit) |
(set-face-parent face-name f-inherit) |
222 |
(set-face-attribute face-name nil :inherit f-inherit)))))) |
(set-face-attribute face-name nil :inherit f-inherit)))))) |