datatypes.data_textline

 1from typing import NamedTuple
 2
 3from lib import fonts, content, text
 4
 5
 6class DTextLine(NamedTuple):
 7    """A data structure for text line properties used in DrawBot."""
 8
 9    phraseWidth: int = 1
10    """The width of the phrase in units (default is 1)."""
11
12    align: fonts.TextAlign = "left"
13    """Text alignment option (default is `left`)."""
14
15    fontStyle: fonts.FontStyle = "upright"
16    """Font style to use (default is `upright`)."""
17
18    avoidShape: content.WordShape = None
19    """Shape to avoid when laying out text (default is None)."""
20
21    alterCase: content.TextCase = None
22    """Text case transformation to apply (default is None)."""
23
24    startWith: str = None
25    """String that the text line should start with (default is None)."""
26
27    shift: int = 0
28    """Horizontal shift for the text line (default is 0)."""
29
30    tabs: list[text.UnitTab] | int | float = None
31    """Can be a list of unit-alignment tuples or a number for justified tabs. 
32    
33    See `text.makeTabs()` and `text.makeTabsJustified()` for details.
34    """
class DTextLine(typing.NamedTuple):
 7class DTextLine(NamedTuple):
 8    """A data structure for text line properties used in DrawBot."""
 9
10    phraseWidth: int = 1
11    """The width of the phrase in units (default is 1)."""
12
13    align: fonts.TextAlign = "left"
14    """Text alignment option (default is `left`)."""
15
16    fontStyle: fonts.FontStyle = "upright"
17    """Font style to use (default is `upright`)."""
18
19    avoidShape: content.WordShape = None
20    """Shape to avoid when laying out text (default is None)."""
21
22    alterCase: content.TextCase = None
23    """Text case transformation to apply (default is None)."""
24
25    startWith: str = None
26    """String that the text line should start with (default is None)."""
27
28    shift: int = 0
29    """Horizontal shift for the text line (default is 0)."""
30
31    tabs: list[text.UnitTab] | int | float = None
32    """Can be a list of unit-alignment tuples or a number for justified tabs. 
33    
34    See `text.makeTabs()` and `text.makeTabsJustified()` for details.
35    """

A data structure for text line properties used in DrawBot.

DTextLine( phraseWidth: int = 1, align: Literal['left', 'center', 'right'] = 'left', fontStyle: Literal['upright', 'italic'] = 'upright', avoidShape: Literal['descender', 'ascender', 'caps'] = None, alterCase: Literal['UPPER', 'lower', 'title', 'title-force'] = None, startWith: str = None, shift: int = 0, tabs: list[tuple[int | float | str | None, typing.Union[typing.Literal['left', 'center', 'right'], str]]] | int | float = None)

Create new instance of DTextLine(phraseWidth, align, fontStyle, avoidShape, alterCase, startWith, shift, tabs)

phraseWidth: int

The width of the phrase in units (default is 1).

align: Literal['left', 'center', 'right']

Text alignment option (default is left).

fontStyle: Literal['upright', 'italic']

Font style to use (default is upright).

avoidShape: Literal['descender', 'ascender', 'caps']

Shape to avoid when laying out text (default is None).

alterCase: Literal['UPPER', 'lower', 'title', 'title-force']

Text case transformation to apply (default is None).

startWith: str

String that the text line should start with (default is None).

shift: int

Horizontal shift for the text line (default is 0).

tabs: list[tuple[int | float | str | None, typing.Union[typing.Literal['left', 'center', 'right'], str]]] | int | float

Can be a list of unit-alignment tuples or a number for justified tabs.

See text.makeTabs() and text.makeTabsJustified() for details.