scistag.imagestag.font_registry.FontRegistry

class FontRegistry[source]

Bases: object

Manages all available fonts which can be used from (especially) ImageStag and SlideStag.

Methods

get_font

Tries to create a font handle for given font

get_fonts

Returns a list of all fonts

register_font

Registers a single font.

Attributes

__dict__

__doc__

__module__

__weakref__

list of weak references to the object (if defined)

_base_fonts_registered

Defines if the base fonts were configured already

access_lock

Multi-thread access lock

fonts

Dictionary of registered fonts

classmethod _ensure_setup()[source]

Ensures the standard fonts were set up

classmethod _register_base_fonts()[source]

Registers the standard fonts which shipped with SciStag

classmethod get_font(font_face, size, flags=None)[source]

Tries to create a font handle for given font

Parameters
  • font_face (str) – The font’s face

  • size (int) – The font’s size

  • flags (set[str] | None) – The flags such as {‘Bold’} or {‘Bold’, ‘Italic’}

Return type

Font | None

Returns

On success the handle of the font

classmethod get_fonts()[source]

Returns a list of all fonts

Returns

A list of all registered fonts and their variations

classmethod register_font(font_face, base_path, variations)[source]

Registers a single font. See _register_base_fonts for examples.

Parameters
  • font_face (str) – The font’s face name, e.g. Roboto

  • base_path (str) – Base file name without extension, e.g. /home/user/myProject/fonts/Roboto

  • variations (list[tuple[str, set[str]]]) – The single font variations. The flags (e.g. “Bold”) as string and the file name extension,

e.g. “-Bold”)

_base_fonts_registered = False

Defines if the base fonts were configured already

access_lock = <unlocked _thread.RLock object owner=0 count=0>

Multi-thread access lock

fonts = {}

Dictionary of registered fonts