Text attributes¶
-
class img_gen.Typography(content: str, align: TypographyAlign | None =
None, color: ColorKind | None =None, line: Line | None =None, overflow: bool =False, font: Font | None =None, border: Border | None =None)¶ –
An attribute to represent a [
Layer](struct@crate::Layer)’s rendered text.- align¶
The alignment of the text.
- as_json_str()¶
Serialize the
Typographyobject to a JSON string.
- as_yaml_str()¶
Serialize the
Typographyobject to a YAML string.
- color¶
The color used to fill the rendered text.
- content¶
The text content.
- static from_json_str(json_str)¶
Deserialize a
Typographyobject from a JSON string.
- static from_yaml_str(yaml_str)¶
Deserialize a
Typographyobject from a YAML string.
- overflow¶
Controls how text that doesn’t fit within the layer’s bounds is handled.
true: the font size is progressively reduced until all text fits within the layer.false: text wraps within the layer’s horizontal boundary; any text that still overflows is replaced with a trailing ellipsis (…).
-
class img_gen.Font(family: str =
'Roboto', style: str | None =None, weight: Weight | None =None, subset: str | None =None, path: str | None =None)¶ –
A property to implicitly describe the font used in a [
Typography](struct@super::Typography) attribute.- family¶
The font family’s name.
- path¶
An optional path to the font’s
.ttffile.
- style¶
The font family’s style.
-
class img_gen.Line(amount: int =
1, height: float =1.0)¶ –
A property to implicitly describe the size of the text in a [
Typography](struct@super::Typography) attribute.- amount¶
Returns the current line amount.
- height¶
Returns the current line height.
- class img_gen.Weight¶
An enumeration of the possible font weights.
-
Thin =
Weight.Thin¶
-
Light =
Weight.Light¶
-
Regular =
Weight.Regular¶
-
Medium =
Weight.Medium¶
-
Bold =
Weight.Bold¶
-
Black =
Weight.Black¶
-
Thin =
- class img_gen.TypographyAlign¶
A enumeration of the possible alignment options for the text in a [
Typography] attribute.-
StartTop =
TypographyAlign.StartTop¶
-
StartCenter =
TypographyAlign.StartCenter¶
-
StartBottom =
TypographyAlign.StartBottom¶
-
CenterTop =
TypographyAlign.CenterTop¶
-
Center =
TypographyAlign.Center¶
-
CenterCenter =
TypographyAlign.CenterCenter¶
-
CenterBottom =
TypographyAlign.CenterBottom¶
-
EndTop =
TypographyAlign.EndTop¶
-
EndCenter =
TypographyAlign.EndCenter¶
-
EndBottom =
TypographyAlign.EndBottom¶
-
StartTop =