* How to set the font of a region?
@ 2004-07-29 13:38 Pascal Bourguignon
2004-07-29 14:51 ` Kevin Rodgers
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Pascal Bourguignon @ 2004-07-29 13:38 UTC (permalink / raw)
I tried this (on X, emacs 21.3.1):
(let* ((default-font "-*-console-medium-r-normal-*-16-*-*-*-*-*-*-*")
(default-face (gensym "face")))
(make-face default-face)
(set-face-font default-face default-font)
(dolist (font font-list)
(let ((face (gensym "face")))
(make-face face)
(set-face-font face font)
(let ((start (point)))
(insert font)
(insert "\n")
(facemenu-add-face 'default start (point))
(facemenu-set-face default-face start (point)))
(let ((start (point)))
(insert "The lazy dog jumped over the fast fox! (let [it {be} and] say) no.more;\n")
(facemenu-add-face 'default start (point))
(facemenu-set-face face start (point))))))
-->
--international-medium-r-normal--15-150-72-72-m-90-iso8859-1
The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
--iris-medium-r-normal--10-100-72-72-m-60-iso8859-1
The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
--iris-medium-r-normal--12-120-72-72-m-80-iso8859-1
The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
--iris-medium-r-normal--13-130-72-72-m-90-iso8859-1
The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
...
but all the text generated keeps the same default font. Why my
facemenu-set-face calls are without effect?
--
__Pascal Bourguignon__ http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to set the font of a region?
2004-07-29 13:38 How to set the font of a region? Pascal Bourguignon
@ 2004-07-29 14:51 ` Kevin Rodgers
2004-07-29 15:28 ` Pascal Bourguignon
2004-08-05 8:12 ` Oliver Scholz
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2004-07-29 14:51 UTC (permalink / raw)
Pascal Bourguignon wrote:
> I tried this (on X, emacs 21.3.1):
>
> (let* ((default-font "-*-console-medium-r-normal-*-16-*-*-*-*-*-*-*")
> (default-face (gensym "face")))
> (make-face default-face)
> (set-face-font default-face default-font)
> (dolist (font font-list)
> (let ((face (gensym "face")))
> (make-face face)
> (set-face-font face font)
> (let ((start (point)))
> (insert font)
> (insert "\n")
> (facemenu-add-face 'default start (point))
> (facemenu-set-face default-face start (point)))
> (let ((start (point)))
> (insert "The lazy dog jumped over the fast fox! (let [it {be} and] say) no.more;\n")
> (facemenu-add-face 'default start (point))
> (facemenu-set-face face start (point))))))
>
> -->
>
> --international-medium-r-normal--15-150-72-72-m-90-iso8859-1
> The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
> --iris-medium-r-normal--10-100-72-72-m-60-iso8859-1
> The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
> --iris-medium-r-normal--12-120-72-72-m-80-iso8859-1
> The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
> --iris-medium-r-normal--13-130-72-72-m-90-iso8859-1
> The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
> ...
>
>
> but all the text generated keeps the same default font. Why my
> facemenu-set-face calls are without effect?
I don't know. Does it help to use an interned symbol for the face?
i.e. change (gensym "face") to (gentemp "face") after (require 'cl).
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to set the font of a region?
2004-07-29 13:38 How to set the font of a region? Pascal Bourguignon
2004-07-29 14:51 ` Kevin Rodgers
@ 2004-07-29 15:28 ` Pascal Bourguignon
2004-08-05 8:12 ` Oliver Scholz
2 siblings, 0 replies; 4+ messages in thread
From: Pascal Bourguignon @ 2004-07-29 15:28 UTC (permalink / raw)
Pascal Bourguignon <spam@thalassa.informatimago.com> writes:
> I tried this (on X, emacs 21.3.1):
>
> (let* ((default-font "-*-console-medium-r-normal-*-16-*-*-*-*-*-*-*")
> (default-face (gensym "face")))
> (make-face default-face)
> (set-face-font default-face default-font)
> (dolist (font font-list)
> (let ((face (gensym "face")))
> (make-face face)
> (set-face-font face font)
> (let ((start (point)))
> (insert font)
> (insert "\n")
> (facemenu-add-face 'default start (point))
> (facemenu-set-face default-face start (point)))
> (let ((start (point)))
> (insert "The lazy dog jumped over the fast fox! (let [it {be} and] say) no.more;\n")
> (facemenu-add-face 'default start (point))
> (facemenu-set-face face start (point))))))
>
> -->
>
> --international-medium-r-normal--15-150-72-72-m-90-iso8859-1
> The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
> --iris-medium-r-normal--10-100-72-72-m-60-iso8859-1
> The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
> --iris-medium-r-normal--12-120-72-72-m-80-iso8859-1
> The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
> --iris-medium-r-normal--13-130-72-72-m-90-iso8859-1
> The lazy dog jumped over the fast fox! (let [be {it} and] say) no.more;
> ...
>
>
> but all the text generated keeps the same default font. Why my
> facemenu-set-face calls are without effect?
No, apart being much slower, there's no change in results.
--
__Pascal Bourguignon__ http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to set the font of a region?
2004-07-29 13:38 How to set the font of a region? Pascal Bourguignon
2004-07-29 14:51 ` Kevin Rodgers
2004-07-29 15:28 ` Pascal Bourguignon
@ 2004-08-05 8:12 ` Oliver Scholz
2 siblings, 0 replies; 4+ messages in thread
From: Oliver Scholz @ 2004-08-05 8:12 UTC (permalink / raw)
Pascal Bourguignon <spam@thalassa.informatimago.com> writes:
> I tried this (on X, emacs 21.3.1):
>
> (let* ((default-font "-*-console-medium-r-normal-*-16-*-*-*-*-*-*-*")
> (default-face (gensym "face")))
> (make-face default-face)
> (set-face-font default-face default-font)
> (dolist (font font-list)
> (let ((face (gensym "face")))
> (make-face face)
> (set-face-font face font)
> (let ((start (point)))
> (insert font)
> (insert "\n")
> (facemenu-add-face 'default start (point))
> (facemenu-set-face default-face start (point)))
> (let ((start (point)))
> (insert "The lazy dog jumped over the fast fox! (let [it {be} and] say) no.more;\n")
> (facemenu-add-face 'default start (point))
> (facemenu-set-face face start (point))))))
>
[...]
> but all the text generated keeps the same default font. Why my
> facemenu-set-face calls are without effect?
What major mode had the buffer in which you tried it? If font-lock
mode is on, it removes all faces from buffer text before it adds its
own. (In CVS Emacs you can use the text property `font-lock-face' to
deal with that.)
Also, I'd use `put-text-property' to add faces programmatically. And
for cases like the above, I'd use an anonymous face---a list of the
form:
(face . PROPERTIES)
(progn
(switch-to-buffer (generate-new-buffer "*tmp*"))
(fundamental-mode)
(let ((start (point)))
(insert "The quick brown fox jumps over the lazy dog.\n")
;; (facemenu-add-face 'font-lock-warning-face start (point))
(put-text-property start (point)
'face
'(face :family "times new roman" :foreground "blue"))
))
Oliver
--
19 Thermidor an 212 de la Révolution
Liberté, Egalité, Fraternité!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-08-05 8:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-29 13:38 How to set the font of a region? Pascal Bourguignon
2004-07-29 14:51 ` Kevin Rodgers
2004-07-29 15:28 ` Pascal Bourguignon
2004-08-05 8:12 ` Oliver Scholz
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.