scistag.imagestag.font_registry.RegisteredFont

class RegisteredFont(font_face, base_path, variations)[source]

Bases: object

A registered font contains information about a single available font and it’s style variations.

Upon request it can be used to create a real font handle with the specified properties such as weight and style.

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”)

Methods

get_handle

Tries to create a font handle for given font :type size: int :param size: The font's size :type flags: set[str] | None :param flags: The flags such as {'Bold'} or {'Bold', 'Italic'} :rtype: Font | None :return: On success the handle of the font

Attributes

__dict__

__doc__

__module__

__weakref__

list of weak references to the object (if defined)

font_face

The font face's name

base_path

The filename base path (excluding variations)

extension

The file extension

variable_weight

Has the font a totally flexible weight?

variations

Different main variations, e.g.

get_handle(size, flags=None)[source]

Tries to create a font handle for given font :type size: int :param size: The font’s size :type flags: set[str] | None :param flags: The flags such as {‘Bold’} or {‘Bold’, ‘Italic’} :rtype: Font | None :return: On success the handle of the font

base_path

The filename base path (excluding variations)

extension

The file extension

font_face

The font face’s name

variable_weight

Has the font a totally flexible weight?

variations

Different main variations, e.g. Italic