Skip to main content

Font Class

Package: GHIElectronics.Endpoint.Drawing
Module: GHIElectronics.Endpoint.Drawing

A TrueType / OpenType font loaded from raw file bytes. Pass to Canvas.DrawText to render strings at any pixel size.

class Font: ...

Methods​

Load(ttf_bytes)​

@staticmethod
def Load(ttf_bytes: bytes) -> Font:

Loads a TTF / OTF font from raw file bytes.

GetMetrics(size_px)​

def GetMetrics(self, size_px: int) -> tuple[int, int, int]:

Font-wide vertical metrics at the given pixel height. Returns (ascent, descent, line_gap). line_height = ascent - descent + line_gap.

Dispose()​

def Dispose(self) -> None:

Releases the native font handle.