Blitz3D+ Command Reference

GadgetFont ( gadget )

Parameters

gadget - gadget to read the font from

Description

Returns a font handle matching the font assigned to a gadget, or 0 if it uses the default.

Requires Extended language mode.

The read-back partner of SetGadgetFont. If the gadget was given a font, GadgetFont builds and returns an equivalent system font handle - same face, size, bold, italic and underline - which you can pass straight on to SetGadgetFont or SetTextAreaFont on another gadget, or use with the 2D text commands. That is how a "make the other pane match" feature copies typography across.

A gadget still wearing the standard Windows UI font returns 0, so check before reusing the value.

Each call loads a fresh handle, exactly as if you had called LoadFont yourself - so treat it like a font you loaded: fetch it once and keep it, rather than calling this every frame, and note that a graphics-mode change invalidates gadget-font handles like any other font handle.

The world editor shell sample shows the kind of multi-pane layout where fonts get shared.

See also: SetGadgetFont, SetTextAreaFont, RequestFont, LoadFont.

Index