On Wed, Nov 24, 2010 at 3:34 PM, Shaping <shap...@charter.net> wrote:
> I still find most of the Factor words difficult to understand without many
> references to the help browser. I have a general solution to this problem
> planned, but implementing it requires considerable re-writing, which I must
> do, anyway, as preparation for the new GUI. I can't do this efficiently
> until I have a good text editing and am able to change the font in the
> listener, which I still have no idea how to do.
>
There isn't a clean API to change the font or styles of the listener.
However, on Windows you can hack basis/windows/fonts/fonts.factor to do so.
In fonts.factor there are two definitions "windows-fonts" and
"(cache-fonts)". "windows-fonts" looks like this:
MEMO: windows-fonts ( -- fonts )
windows-major 6 >=
H{
{ "sans-serif" "Segoe UI" }
{ "serif" "Cambria" }
{ "monospace" "Consolas" }
}
H{
{ "sans-serif" "Tahoma" }
{ "serif" "Times New Roman" }
{ "monospace" "Courier New" }
} ? ;
This sets the mapping of the default Factor sans serif/serif/monospace font
families to Windows font family names. The first set is used on Windows
Vista or 7, and the second on XP. You can change these to whatever you
prefer. The listener uses the "monospace" font mapping while the docs
browser uses the "sans-serif" mapping.
To change the size of fonts, look at "(cache-font)":
MEMO:: (cache-font) ( font -- HFONT )
*font size>>* neg ! nHeight
0 0 0 ! nWidth, nEscapement, nOrientation
font bold?>> FW_BOLD FW_NORMAL ? ! fnWeight
font italic?>> TRUE FALSE ? ! fdwItalic
FALSE ! fdwUnderline
FALSE ! fdWStrikeOut
DEFAULT_CHARSET ! fdwCharSet
OUT_OUTLINE_PRECIS ! fdwOutputPrecision
CLIP_DEFAULT_PRECIS ! fdwClipPrecision
DEFAULT_QUALITY ! fdwQuality
DEFAULT_PITCH ! fdwPitchAndFamily
font name>> windows-font-name
CreateFont
dup win32-error=0/f ;
Note the reference to "font size>>" at the very beginning. You can globally
scale the font sizes used in the UI by applying a multiplier to this value,
for example:
MEMO:: (cache-font) ( font -- HFONT )
*font size>> 1.5 * >integer* neg ! nHeight
0 0 0 ! nWidth, nEscapement, nOrientation
font bold?>> FW_BOLD FW_NORMAL ? ! fnWeight
font italic?>> TRUE FALSE ? ! fdwItalic
FALSE ! fdwUnderline
FALSE ! fdWStrikeOut
DEFAULT_CHARSET ! fdwCharSet
OUT_OUTLINE_PRECIS ! fdwOutputPrecision
CLIP_DEFAULT_PRECIS ! fdwClipPrecision
DEFAULT_QUALITY ! fdwQuality
DEFAULT_PITCH ! fdwPitchAndFamily
font name>> windows-font-name
CreateFont
dup win32-error=0/f ;
(The ">integer" is necessary because "CreateFont" expects an integer
height.) Once you've made these changes, press F2 in the listener, type
"save" to commit your changes to the Factor image, and quit and restart the
listener. You should see your font changes take effect after restarting.
-Joe
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk