brown.interface.font_interface

classes

permalink view source

FontInterface (Interface)

An interface for fonts, exposing many font metadata properties.

__init__ (brown_object, family_name, size, weight, italic) permalink view source

overriden from Interface

arguments:

brown_object (Brush): The object this interface belongs to

family_name (str): The name of the font family

size (Unit): The size of the font

weight (int or None): The font weight. If None, a normal weight will be used.

italic (bool): Italicized or not

properties

ascent: GraphicUnit The ascent of the font. permalink view source

The ascent is the vertical distance between the font baseline and the highest any font characters reach.

read-only.

descent: GraphicUnit The descent of the font. permalink view source

The ascent is the vertical distance between the font baseline and the lowest any font characters reach.

read-only.

em_size: GraphicUnit The em size for the font. permalink view source

NOTE: This is actually being calculated from the x-height of the font. Depending on the Qt specifics, this may or may not work as expected.

read-only.

methods

bounding_rect_of (text) permalink view source

Calculate the tight bounding rectangle around a string in this font.

arguments:

text (str): The text to calculate around.

returns: