1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
|
Text
====
.. automodule:: svgwrite.text
.. autoclass:: svgwrite.text.Text
.. seealso:: http://www.w3.org/TR/SVG11/text.html#TextElement
Refer to **TSpan** SVG Attributes
Parent Classes
--------------
* :class:`svgwrite.base.BaseElement`
* :class:`svgwrite.text.TSpan`
* :class:`svgwrite.mixins.Transform`
* :class:`svgwrite.mixins.Presentation`
TSpan
=====
.. autoclass:: svgwrite.text.TSpan
.. seealso:: http://www.w3.org/TR/SVG11/text.html#TSpanElement
.. automethod:: svgwrite.text.TSpan.__init__
Attributes
----------
.. attribute:: TSpan.text
stores the text value.
Methods
-------
.. automethod:: svgwrite.text.TSpan.__init__
Parent Classes
--------------
* :class:`svgwrite.base.BaseElement`
* :class:`svgwrite.mixins.Presentation`
SVG Attributes
--------------
* **x** -- `<coordinate+>`
If a single `<coordinate>` is provided, then the value represents the new
absolute X coordinate for the current text position for rendering the
glyphs that correspond to the first character within this element or
any of its descendants.
If `list` of n `<coordinates>` is provided, then the values represent
new absolute X coordinates for the current text position for rendering
the glyphs corresponding to each of the first n characters within this
element or any of its descendants.
If more `<coordinates>` are provided than characters, then the extra
`<coordinates>` will have no effect on glyph positioning.
If more characters exist than `<coordinates>` , then for each of these
extra characters:
(a) if an ancestor **Text** or **TSpan**
element specifies an absolute X coordinate for the given
character via an **x** attribute, then that absolute X
coordinate is used as the starting X coordinate for that
character (nearest ancestor has precedence), else
(b) the starting X coordinate for rendering the glyphs corresponding
to the given character is the X coordinate of the resulting
current text position from the most recently rendered glyph for
the current **Text** element.
If the attribute is not specified:
(a) if an ancestor **Text** or **TSpan**
element specifies an absolute X coordinate for a given character
via an **x** attribute, then that absolute X coordinate is
used (nearest ancestor has precedence), else
(b) the starting X coordinate for rendering the glyphs corresponding
to a given character is the X coordinate of the resulting current
text position from the most recently rendered glyph for the current
**Text** element.
* **y** -- `<coordinate+>`
The corresponding list of absolute Y coordinates for the glyphs
corresponding to the characters within this element. The processing
rules for the **y** attribute parallel the processing rules for
the **x** attribute.
* **dx** -- `<length+>`
If a single <length> is provided, this value represents the new
relative X coordinate for the current text position for rendering
the glyphs corresponding to the first character within this element
or any of its descendants. The current text position is shifted
along the x-axis of the current user coordinate system by `<length>`
before the first character's glyphs are rendered.
If a `list` of n `<length>` is provided, then
the values represent incremental shifts along the x-axis for the
current text position before rendering the glyphs corresponding to
the first n characters within this element or any of its descendants.
Thus, before the glyphs are rendered corresponding to each character,
the current text position resulting from drawing the glyphs for the
previous character within the current **Text** element
is shifted along the X axis of the current user coordinate system by
`<length>` .
If more `<lengths>` are provided than characters, then any extra
`<lengths>` will have no effect on glyph positioning.
If more characters exist than <length>s, then for each of these extra
characters:
(a) if an ancestor **Text** or **TSpan**
element specifies a relative X coordinate for the given character
via a **dx** attribute, then the current text position is shifted
along the x-axis of the current user coordinate system by that
amount (nearest ancestor has precedence), else
(b) no extra shift along the x-axis occurs.
If the attribute is not specified:
(a) if an ancestor **Text** or **TSpan**
element specifies a relative X coordinate for a given character
via a **dx** attribute, then the current text position is shifted
along the x-axis of the current user coordinate system by that
amount (nearest ancestor has precedence), else
(b) no extra shift along the x-axis occurs.
* **dy** -- `<length+>`
The corresponding list of relative Y coordinates for the characters
within the **tspan** element. The processing rules for the **dy** attribute
parallel the processing rules for the **dx** attribute.
* **rotate** -- `<angle+>`
The supplemental rotation about the current text position that will be
applied to all of the glyphs corresponding to each character within
this element.
If a `list` of `<numbers>` is provided, then the first `<number>` represents
the supplemental rotation for the glyphs corresponding to the first
character within this element or any of its descendants, the second
<number> represents the supplemental rotation for the glyphs that
correspond to the second character, and so on.
If more `<numbers>` are provided than there are characters, then the
extra `<numbers>` will be ignored.
If more characters are provided than `<numbers>`, then for each of these
extra characters the rotation value specified by the last number must
be used.
If the attribute is not specified and if an ancestor **Text**
or **TSpan** element specifies a supplemental rotation
for a given character via a **rotate** attribute, then the given
supplemental rotation is applied to the given character (nearest
ancestor has precedence). If there are more characters than `<numbers>`
specified in the ancestor's **rotate** attribute, then for each of
these extra characters the rotation value specified by the last number
must be used.
This supplemental rotation has no impact on the rules by which current
text position is modified as glyphs get rendered and is supplemental
to any rotation due to text on a path and to **glyph-orientation-horizontal**
or **glyph-orientation-vertical**.
* **class** -- `string`
assigns one or more css-class-names to an element
* **style** -- `string`
allows per-element css-style rules to be specified directly on a given element
* **externalResourcesRequired** -- `bool`
*False*: if document rendering can proceed even if external resources are
unavailable else: *True*
* **textLength** -- `<length>`
The purpose of this attribute is to allow
the author to achieve exact alignment, in visual rendering order after
any bidirectional reordering, for the first and last rendered glyphs
that correspond to this element; thus, for the last rendered character
(in visual rendering order after any bidirectional reordering), any
supplemental inter-character spacing beyond normal glyph advances are
ignored (in most cases) when the user agent determines the appropriate
amount to expand/compress the text string to fit within a length of
**textLength**.
* **lengthAdjust** -- ``'spacing | spacingAndGlyphs'``
Indicates the type of adjustments which the user agent shall make to make
the rendered length of the text match the value specified on the **textLength**
attribute.
* ``'spacing'`` indicates that only the advance values are adjusted. The
glyphs themselves are not stretched or compressed.
* ``'spacingAndGlyphs'`` indicates that the advance values are adjusted and
the glyphs themselves stretched or compressed in one axis (i.e., a
direction parallel to the inline-progression-direction).
If the attribute is not specified, the effect is as a value of *spacing*
were specified.
Standard SVG Attributes
-----------------------
* :doc:`Core Attributes </attributes/core>`
* :doc:`Conditional Processing Attributes </attributes/conditional_processing>`
* :doc:`Graphical Event Attributes </attributes/graphical_event>`
* :doc:`Presentation Attributes </attributes/presentation>`
TRef
====
.. autoclass:: svgwrite.text.TRef
.. seealso:: http://www.w3.org/TR/SVG11/text.html#TRefElement
.. automethod:: svgwrite.text.TRef.__init__
.. automethod:: svgwrite.text.TRef.set_href
Parent Classes
--------------
* :class:`svgwrite.base.BaseElement`
* :class:`svgwrite.mixins.XLink`
* :class:`svgwrite.mixins.Presentation`
SVG Attributes
--------------
* **class** -- `string`
assigns one or more css-class-names to an element
* **style** -- `string`
allows per-element css-style rules to be specified directly on a given element
* **externalResourcesRequired** -- `bool`
*False*: if document rendering can proceed even if external resources are
unavailable else: *True*
* **xlink:href** -- `<string>`
A IRI reference to an element whose character data content shall be used
as character data for this **tref** element.
Standard SVG Attributes
-----------------------
* :doc:`Core Attributes </attributes/core>`
* :doc:`Conditional Processing Attributes </attributes/conditional_processing>`
* :doc:`Graphical Event Attributes </attributes/graphical_event>`
* :doc:`Presentation Attributes </attributes/presentation>`
TextPath
========
.. autoclass:: svgwrite.text.TextPath
.. seealso:: http://www.w3.org/TR/SVG11/text.html#TextPathElement
Methods
-------
.. automethod:: svgwrite.text.TextPath.__init__
Parent Classes
--------------
* :class:`svgwrite.base.BaseElement`
* :class:`svgwrite.mixins.XLink`
* :class:`svgwrite.mixins.Presentation`
SVG Attributes
--------------
* **class** -- `string`
assigns one or more css-class-names to an element
* **style** -- `string`
allows per-element css-style rules to be specified directly on a given element
* **externalResourcesRequired** -- `bool`
*False*: if document rendering can proceed even if external resources are
unavailable else: *True*
* **xlink:href** -- `string`
A IRI reference to an element whose character data content shall be used
as character data for this **TRef** element.
* **startOffset** -- `<length>`
An offset from the start of the **path** for
the initial current text position, calculated using the user agent's
distance along the path algorithm. Value as percentage or distance along
the path measured in the current user coordinate system.
* **method** -- ``'align | stretch'``
Indicates the method by which text should be rendered along the path.
* **spacing** -- ``'auto | exact'``
Indicates how the user agent should determine the spacing between glyphs
that are to be rendered along a path.
Standard SVG Attributes
-----------------------
* :doc:`Core Attributes </attributes/core>`
* :doc:`Conditional Processing Attributes </attributes/conditional_processing>`
* :doc:`Graphical Event Attributes </attributes/graphical_event>`
* :doc:`Presentation Attributes </attributes/presentation>`
TextArea
========
.. autoclass:: svgwrite.text.TextArea
.. seealso:: http://www.w3.org/TR/SVGMobile12/text.html#TextAreaElement
Methods
-------
.. automethod:: svgwrite.text.TextArea.write
Parent Classes
--------------
* :class:`svgwrite.base.BaseElement`
* :class:`svgwrite.mixins.Transform`
* :class:`svgwrite.mixins.Presentation`
SVG Attributes
--------------
* **x** -- *<coordinate>*
The x-axis coordinate of one corner of the rectangular region into which
the text content will be placed. The lacuna value is ``'0'``.
* **y** -- *<coordinate>*
The y-axis coordinate of one corner of the rectangular region into which
the text content will be placed. The lacuna value is ``'0'``.
* **width** -- ``'auto'`` | *<coordinate>*
The width of the rectangular region into which the text content will be
placed. A value of ``'auto'`` indicates that the width of the rectangular
region is infinite. The lacuna value is ``'auto'``.
* **height** -- ``'auto'`` | *<coordinate>*
The height of the rectangular region into which the text content will be
placed. A value of ``'auto'`` indicates that the height of the rectangular
region is infinite. The lacuna value is ``'auto'``.
* **editable** -- ``'auto`| simple'``
This attribute indicates whether the text can be edited. See the definition
of the 'editable' attribute.
* **focusable** -- ``'true | false | auto'``
=========== =============================================================
Value Description
=========== =============================================================
``'true'`` The element is keyboard-aware and must be treated as any
other UI component that can get focus.
``'false'`` The element is not focusable.
``'auto'`` The lacuna value. Equivalent to ``'false'``
=========== =============================================================
Exception: see http://www.w3.org/TR/SVGMobile12/interact.html#focusable-attr
* **line-increment** -- ``'auto | inherit'`` | `<number>`
The **line-increment** property provides limited control over the size of
each line in the block-progression-direction. This property applies to the
**textArea** element, and to child elements of the **textArea** element.
The **line-increment** property must not have any effect when used on an
element which is not, or does not have as an ancestor, a **textArea**
element.
* **text-align** -- ``'start | end | center | inherit'``
Alignment in the inline progression direction in flowing text is provided
by the text-align property.
* **display-align** -- ``'auto | before | center | after | inherit'``
The **display-align** property specifies the alignment, in the
block-progression-direction, of the text content of the **textArea** element.
============= ===========================================================
Value Description
============= ===========================================================
``'auto'`` For SVG, auto is equivalent to before.
``'before'`` The before-edge of the first line is aligned with the
before-edge of the first region.
``'center'`` The lines are centered in the block-progression-direction.
``'after'`` The after-edge of the last line is aligned with the
after-edge of the last region.
============= ===========================================================
Layout rules: see http://www.w3.org/TR/SVGMobile12/text.html#TextAreaElement
|