[Home] [Downloads] [Search] [Help/forum]

MUSHclient scripting

Description of MUSHclient world function: world.WindowFont

Name WindowFont
Type Method
Summary Loads a font into a miniwindow
Prototype long WindowFont(BSTR WindowName, BSTR FontId, BSTR FontName, double Size, BOOL Bold, BOOL Italic, BOOL Underline, BOOL Strikeout, short Charset, short PitchAndFamily);

View list of data type meanings


This loads the specified font into the miniwindow, and remembers it by the nominated "font id". The font id is later used for drawing in this font. You do not need to specify a colour, that is done when the text is actually drawn.

WindowName - the name of an existing miniwindow.

FontId - the font id to be associated with this particular font and size. If you are only planning to use one or two fonts you might call them "f1" and "f2". For more complex situations you might call them something like "heading", "body", "boldbody", "footer" etc.

If you use an existing FontId then the existing font is deleted and replaced by the one specified now.

FontName - the name of the font (for example, "Lucida Console", "Comic Sans MS", "Fixedsys"). If the FontName is an empty string (ie. name is "") and the Size is zero, then any existing font of the same FontId is deleted (and no new font is added).

If you are using Lua scripting, you can use the utils.getfontfamilies function to find which font names are actually installed.

Size - the size of the font in points

Bold - true if you want the bold version of the font

Italic - true if you want the italic version of the font

Underline - true if you want the underline version of the font

Strikeout - true if you want the strikeout version of the font

Charset - The character set wanted. Some possible values are:

0 - ANSI
1 - Default
2 - Symbol

Unless you have a reason otherwise, use 1 (default) which is the default value for Lua.

PitchAndFamily - the requested pitch and family

You can add together the following values:


0 - Don't care
16 - Roman (variable width, serif, eg. Times Roman)
32 - Swiss (variable width, sans-serif, eg. Helvetica)
48 - Modern (fixed width, serif or sans-serif - eg. Courier)
64 - Script (cursive, etc.)
80 - Decorative (Old English, etc.)


0 - Default
1 - Fixed pitch
2 - Variable pitch
8 - Mono font


4 - Use Truetype font

A reasonable entry would be 0 - for don't care. Or, if you wanted a variable width, serif, truetype font, you could specify 20 (which is 16 + 4).

For more information, see:


Note: Available in version 4.34 onwards.

Lua example
-- Trebuchet MS, 28 point, bold
WindowFont (win, "heading", "Trebuchet MS", 28, true, false, false, false)
Lua notes
You can use the following constants for the charset argument:

miniwin.font_charset_ansi = 0
miniwin.font_charset_default = 1
miniwin.font_charset_symbol = 2

You can use the following constants for the PitchAndFamily argument (these can be added together):

miniwin.font_family_any = 0
miniwin.font_family_roman = 16
miniwin.font_family_swiss = 32
miniwin.font_family_modern = 48
miniwin.font_family_script = 64
miniwin.font_family_decorative = 80

miniwin.font_pitch_default = 0
miniwin.font_pitch_fixed = 1
miniwin.font_pitch_variable = 2
miniwin.font_truetype = 4
miniwin.font_pitch_monospaced = 8
Returns eNoSuchWindow - no such miniwindow

eCannotAddFont - cannot add it (perhaps font does not exist)

eOK - completed OK

View list of return code meanings

Introduced in version 4.34

See also ...

Function Description
WindowCreate Creates a miniwindow
WindowFontInfo Returns information about a font
WindowFontList Lists all fonts loaded into a miniwindow
WindowText Draws text into a miniwindow
WindowTextWidth Calculates the width of text in a miniwindow

Search for script function

Enter a word or phrase in the box below to narrow the list down to those that match.

The function name, prototype, summary, and description are searched.

Search for:   

Leave blank to show all functions.

Return codes

Many functions return a "code" which indicates the success or otherwise of the function.

You can view a list of the return codes

Function prototypes

The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).

You can view a list of the data types used in function prototypes

View all functions


Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]