Skip to content

set_fontSetFontSetFontset_fontT_set_fontπŸ”—

Short descriptionπŸ”—

set_fontSetFontSetFontset_fontT_set_font β€” Set the font used for text output.

SignatureπŸ”—

set_font( window WindowHandle, string Font )void SetFont( const HTuple& WindowHandle, const HTuple& Font )static void HOperatorSet.SetFont( HTuple windowHandle, HTuple font )def set_font( window_handle: HHandle, font: str ) -> None

Herror T_set_font( 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)

void HWindow.SetFont( string font )

DescriptionπŸ”—

set_fontSetFont sets the font Fontfontfont for the output window WindowHandlewindowHandlewindow_handle. All subsequent text outputs (e.g., with the operators disp_textDispText, write_stringWriteString or read_stringReadString) will now use the new font instead of the default font (see set_system('default_font',Font)). All available fonts can be queried with query_fontQueryFont.

The syntax for the specification of Fontfontfont is the following:

       FONTNAME[-STYLE]-FONT_SIZE.

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

  • Normal,

  • Bold,

  • BoldItalic, or

  • Italic.

The FONT_SIZE is measured in pixels.

An example of a valid string for Fontfontfont 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_fontQueryFont or the procedure set_display_font.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

WindowHandlewindowHandlewindow_handle (input_control) window β†’ (handle)HTuple (HHandle)HWindow, HTuple (IntPtr)HHandleHtuple (handle)

Window handle.

Fontfontfont (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (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_fontSetFont returns 2 (H_MSG_TRUE) if the font name can be resolved. Otherwise an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

open_windowOpenWindow

Possible successors

query_fontQueryFont

See also

get_fontGetFont, query_fontQueryFont, open_windowOpenWindow

ModuleπŸ”—

Foundation