vibesketch.render.fonts

The reviewed Roboto font shared by publication SVG, PNG and PDF.

Module Attributes

Contour

points in font units, each with whether it is on the curve.

Functions

advance(text)

The width of one line of text in the publication font, in ems.

check_text(svg)

embed_font(svg)

Make SVG annotations portable without relying on the viewer's fonts.

glyph_of(char)

The glyph of char and its advance width, in font units; None when missing.

outline(glyph)

The contours of glyph in font units, composite glyphs resolved.

units_per_em()

vibesketch.render.fonts.advance(text)[source]

The width of one line of text in the publication font, in ems.

Advance widths only, without kerning; a character the font lacks counts as a full em, as the renderer’s own bounds do.

Parameters:

text (str)

Return type:

float

vibesketch.render.fonts.check_text(svg)[source]
Parameters:

svg (bytes)

Return type:

None

vibesketch.render.fonts.embed_font(svg)[source]

Make SVG annotations portable without relying on the viewer’s fonts.

Parameters:

svg (bytes)

Return type:

bytes

vibesketch.render.fonts.Contour

points in font units, each with whether it is on the curve.

Type:

A glyph contour

alias of list[tuple[float, float, bool]]

vibesketch.render.fonts.outline(glyph)[source]

The contours of glyph in font units, composite glyphs resolved.

TrueType glyf/loca as the OpenType specification gives them: https://learn.microsoft.com/en-us/typography/opentype/spec/glyf and …/loca. Off-curve points are quadratic B-spline controls; two in a row imply an on-curve point midway.

Parameters:

glyph (int)

Return type:

tuple[list[tuple[float, float, bool]], …]

vibesketch.render.fonts.glyph_of(char)[source]

The glyph of char and its advance width, in font units; None when missing.

Parameters:

char (str)

Return type:

tuple[int | None, float]

vibesketch.render.fonts.units_per_em()[source]
Return type:

int