set_fontT_set_fontSetFontSetFontset_font (Operator)

Name

set_fontT_set_fontSetFontSetFontset_font — Set the font used for text output.

Signature

set_font( : : WindowHandle, Font : )

Herror T_set_font(const Htuple WindowHandle, const Htuple Font)

void SetFont(const HTuple& WindowHandle, const HTuple& Font)

void HWindow::SetFont(const HString& Font) const

void HWindow::SetFont(const char* Font) const

void HWindow::SetFont(const wchar_t* Font) const   (Windows only)

static void HOperatorSet.SetFont(HTuple windowHandle, HTuple font)

void HWindow.SetFont(string font)

def set_font(window_handle: HHandle, font: str) -> None

Description

set_fontset_fontSetFontSetFontSetFontset_font sets the font FontFontFontFontfontfont for the output window WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle. All subsequent text outputs (e.g., with the operators disp_textdisp_textDispTextDispTextDispTextdisp_text, write_stringwrite_stringWriteStringWriteStringWriteStringwrite_string or read_stringread_stringReadStringReadStringReadStringread_string) will now use the new font instead of the default font (see set_system('default_font',Font)set_system("default_font",Font)SetSystem("default_font",Font)SetSystem("default_font",Font)SetSystem("default_font",Font)set_system("default_font",Font)). All available fonts can be queried with query_fontquery_fontQueryFontQueryFontQueryFontquery_font.

The syntax for the specification of FontFontFontFontfontfont is the following:

FONTNAME[-STYLE]-FONT_SIZE.

The optional STYLE may be one of the following (other values are possible as well):

The FONT_SIZE is measured in pixels.

An example of a valid string for FontFontFontFontfontfont would be

'Courier-Bold-14'.

Attention

For different machines the available fonts may differ a lot. Therefore it is suggested to use the operator query_fontquery_fontQueryFontQueryFontQueryFontquery_font or the procedure set_display_font.

Execution Information

Parameters

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle (input_control)  window HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Window handle.

FontFontFontFontfontfont (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Name of new font.

Example (HDevelop)

dev_get_window (WindowHandle)
query_font (WindowHandle, Font)
* Specify font name and size
FontWithSize := Font[0]+'-20'
set_font (WindowHandle, FontWithSize)
dev_disp_text ('Font set to: '+FontWithSize, 'window', 20, 12, 'black', \
               [], [])
* Specify font name, style, and size
FontWithStyleAndSize := Font[0]+'-Bold-20'
set_font (WindowHandle, FontWithStyleAndSize)
dev_disp_text ('Font set to: '+FontWithStyleAndSize, 'window', 50, 12, \
               'black', [], [])

Result

set_fontset_fontSetFontSetFontSetFontset_font returns TRUE if the font name can be resolved. Otherwise an exception is raised.

Possible Predecessors

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window

Possible Successors

query_fontquery_fontQueryFontQueryFontQueryFontquery_font

See also

get_fontget_fontGetFontGetFontGetFontget_font, query_fontquery_fontQueryFontQueryFontQueryFontquery_font, open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window

Module

Foundation