[REBOL] Re: Setting default font for all View sessions
From: brian:wisti:gma:il at: 28-Dec-2006 10:06
Hi Anton,
On 12/28/06, Anton Rolls <anton-wilddsl.net.au> wrote:
> Hi Brian,
>
> >> ? "font-"
> Found these words:
> font-fixed string! "courier new"
> font-sans-serif string! "arial"
> font-serif string! "times"
>
> layout [
> vh1 "Yo!" font-name font-fixed
> style text text font-name font-fixed
> text "Enter your name: "
> ]
>
> OR
>
> foreach [style obj] svv/vid-styles [
> if all [
> obj/font
> obj/font/name <> font-fixed
> ][
> print [style obj/font/name]
> obj/font/name: font-fixed
> ]
> ]
>
> face/font/name: font-fixed
That's just what I needed, thanks. I expanded a little, since I now
know that I have more fonts than just font-fixed to work with. It even
works when I just put it in my user.r file. So for future Redhat
sufferers, here's the relevant portion of my user.r:
if (not none? system/view) [
; ...
;; Fix fonts on Redhat/CentOS Linux
; Replace with whatever serif and sans-serif fonts View can find.
font-serif: "Georgia"
font-sans-serif: "Arial"
foreach [style obj] svv/vid-styles [
if obj/font [
print obj/font/name
switch obj/font/name [
"helvetica" [ obj/font/name: font-sans-serif ]
"times" [ obj/font/name: font-serif ]
]
]
]
]
And here's an expanded version of my font demo layout
view layout [
text "Courier" font-name "Courier"
text "Times" font-name "Times"
text "Helvetica" font-name "Helvetica"
text "Arial" font-name "Arial"
text "Verdana" font-name "Verdana"
text "Georgia" font-name "Georgia"
text "font-fixed" font-name font-fixed
text "font-serif" font-name font-serif
text "font-sans-serif" font-name font-sans-serif
text "Default"
button "Quit" [ quit ]
]
I'm content now. Everything would be perfect if I could get
anti-aliased fonts in View, though.
Thanks for the assist!
Kind Regards,
Brian Wisti
http://coolnamehere.com/