Movatterモバイル変換


[0]ホーム

URL:


Chapter 11: Text

11.1. Introduction

Text that is to be rendered as part of an SVG document fragment is specified using thetext element. The text within atext element can be rendered:

The sectionText layout gives an introduction to text layout. It is followed by sections coveringcontent areas and thealgorithm for laying out text within acontent area. The specialized layout rules corresponding to text that ispre-formatted,auto-wrapped, andon a path are then addressed in individual sections.

Rules for text layout in SVG 1.1 are mostly defined within the SVG 1.1 specification. The rules mirror to a large extent those found in CSS. In SVG 2, the dependence on CSS is more explicit. In practice the resulting layout is the same. The change to directly relying on CSS specifications simplifies the SVG specification while making it more obvious that rendering agents can use the same code to render both text in HTML and in SVG. In particular, SVG 2 auto-wrapped text is based on CSS text layout.

SVG'stext elements are rendered like other graphics elements. Thus,coordinate system transformations,painting,clipping andmasking features apply totext elements in the same way as they apply toshapes such aspaths andrectangles.

SVG text supports advanced typographic features including:

SVG text supports international text processing needs such as:

Multi-language SVG content is possible bysubstituting different text strings based on the user's preferred language.

The characters to be drawn are expressed ascharacter data ([xml], section 2.4) inside thetext element. As a result:

For accessibility reasons, it is recommended that text that is included in a document have appropriate semantic markup to indicate its function. For example, a text element that provides a visible label for part of a diagram should have anid that is referenced by anaria-labelledby attribute on the relevant group or path element. SeeSVG accessibility guidelines for more information.

11.1.1. Definitions

character
A character is an atomic unit of text as defined in XML [XML].

Essentially, a Unicode code point. A character may be a control instruction (such as a tab, carriage return, or line feed), a renderable mark (letter, digit, punctuation or other symbol), or a modifier (such as a combining accent).

addressable character
Acharacter that is addressable by text positioning attributes and SVG DOM text methods. Characters discarded during layout such ascollapsed white space characters are not addressable, neither are characters within an element with a value ofnone for thedisplay property. Addressable characters are addressed by their index measured in UTF-16 code units (thus, a single Unicode code point above U+FFFF will map to two addressable characters as a UTF-16 code unit consists of 16 bits). Indexes are determined prior to applying anytext-transform conversions, as described for the methods in theSVGTextContentElement interface.

If support for CSS generated-content text is introduced in the future, it would be included in the array of addressable characters.

typographic character
A unit of a writing system— such as a Latin alphabetic letter (including its diacritics), Hangul syllable, Chinese ideographic character, Myanmar syllable cluster— that is indivisible with respect to a particular typographic operation (line-breaking, first-letter effects, tracking, justification, vertical arrangement, etc.). For the normative definition and the relationship between this and a Unicode grapheme cluster, seeCSSText Module Level 3, ([css-text-3]).
font
A font represents an organized collection ofglyphs in which the various glyph representations will share a particular appearance or styling.
glyph
A glyph represents a unit of rendered content within afont. Often, there is a one-to-one correspondence between characters to be drawn and corresponding glyphs (e.g., usually the character "A" is rendered using a single glyph), but other times multiple glyphs are used to render a single character (e.g., characters with accents) or a single glyph can be used to render multiple characters (e.g., ligatures). Typically, a glyph is defined by one or moreshapes such as apath, possibly with additional information such as rendering hints that help a font engine to produce legible text in small sizes.
text content element
A text content element is an SVG element that causes a text string to be rendered onto the canvas. The SVG text content elements are:text,textPath andtspan.
text content child element
A text content child element is atext content element that is allowed as a descendant of anothertext content element. In SVG the text content child elements are:textPath andtspan.
text content block element
A text content block element is atext content element that serves as a standalone element for a unit of text, and which may optionally contain certain childtext content elements (e.g.‘tspan’). SVG 2 defines a single text content block element:text.
content area
The area in which the text is normally laid out. This is equivalent to theCSS content area. The actual region where text layout occurs may be smaller due to padding and/or exclusions.
wrapping context
One or more regions (shapes) to be excluded from the content area during text layout. This is the same as theCSS wrapping context.
wrapping area
The area in which the text is laid out after subtracting any padding or exclude areas (wrapping context). This is the same as theCSS wrapping area.
line box
The rectangular area containing all the content used to layout a single line of text. This is the same as theCSS line box.

Although various CSS 3 text layout specs use the term, none current establish a formal definition. The link is therefore to CSS 2.1, andan issue has been filed with CSS WG.

inline-base direction
The primary direction in which content is ordered within a line or part of a line of text. It defines thestart andend sides of a line or part of a line of text (relevant, for example to how thetext-anchor property is applied). It is determined by thedirection property. (Note: the ordering of characters in a line of text is primary controlled by the Unicode bidi algorithm and not the inline-base direction.)
block-flow direction
The direction in whichline boxes are stacked. It is determined by thewriting-mode property.
alignment point
The point on a typographic character that should be aligned with thecurrent text position. It is determined by the glyph cell metrics and may depend on the script andinline-base direction.
current text position
The point in the current user space where thealignment point of the next typographic character to be renderedshould be placed.
text chunk
An independent block of text in which all characters are positioned together. Each new absolute positioning adjustment (due to anx ory attribute, or forced line break) creates a newtext chunk. Ligature substitution and bidi-reordering only occur within atext chunk.Text chunks are only relevant to pre-formatted text.
white space characters
The following characters are considered white space characters: U+0009 CHARACTER TABULATION, U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), U+000A LINE FEED (LF) and U+0020 SPACE.

11.1.2. Fonts and glyphs

A font consists of a collection of glyphs together with other information (collectively, the font tables) necessary to use those glyphs to present characters on some visual medium. The combination of the collection of glyphs and the font tables is called thefont data.

A font may supply substitution and positioning tables that can be used by a formatter (text shaper) to re-order, combine and position a sequence of glyphs to form one or more composite glyphs. The combining may be as simple as a ligature, or as complex as an indic syllable which combines, usually with some re-ordering, multiple consonants and vowel glyphs. The tables may be language dependent, allowing the use of language appropriate letter forms.

When a glyph, simple or composite, represents an indivisible unit for typesetting purposes, it is know as atypographic character.

Ligatures are an important feature of advance text layout. Some ligatures are discretionary while others (e.g. in Arabic) are required. The following explicit rules apply to ligature formation:

SVG 2 Requirement:Include explicit support for Web Open Font Format (WOFF).
Resolution:We will mandate WOFF support in SVG 2.
Purpose:To allow access to full OpenType features for internationalization and advanced typography.
Owner:Chris (no action)
Status:Done

Proper text rendering may depend on using the same font as used during authoring. For this reason SVG requires support for downloadable fonts as defined in theFont Resources section of theCSS Fonts Module. In particular, support for the Web Open Font Format [WOFF] is required.

New in SVG 2, WOFF allows authors to provide the fonts needed to properly render their content. This includes ensuring that the fonts have the proper OpenType tables to support complex scripts, discretionary ligatures, swashes, old-style numbers, and so on. WOFF also allows the fonts to be compressed, subsetted, and include licensing information.

11.1.3. Glyph metrics and layout

Glyph selection and positioning is normally handled according to the rules of CSS. In some cases, however, the final layout of text in SVG requires knowledge of the geometry properties of individual glyphs.

The geometric font characteristics are expressed in a coordinate system based on the EM box. (The EM is a relative measure of the height of the glyphs in the font.) The box 1 EM high and 1 EM wide is called thedesign space. This space is given a geometric coordinates by sub-dividing the EM into a number ofunits per em.

Units per em is a font characteristic. A typical value for units per em is 1000 or 2048.

The coordinate space of the EM box is called thedesign space coordinate system. For scalable fonts, the curves and lines that are used to draw a glyph are represented using this coordinate system.

Most often, the (0,0) point in this coordinate system is positioned on the left edge of the EM box, but not at the bottom left corner. The Y coordinate of the bottom of a roman capital letter is usually zero. The descenders on lowercase roman letters have negative coordinate values.

An 'M' inside an EM box showing the coordinate system, baseline,      ascent and descent.

An 'M' inside an Em box (blue square). The 'M' sits on the baseline (blue line). The origin of the coordinate system is shown by the small black circle.

SVG assumes that the font tables will provide at least three font characteristics: an ascent, a descent and a set of baseline-tables. The ascent is the distance to the top of the EM box from the (0,0) point of the font; the descent is the distance to the bottom of the EM box from the (0.0) point of the font. The baseline-table is explained below.

Within an OpenType font ([OPENTYPE]), for horizontal writing-modes, the ascent and descent are given by the sTypoAscender and sTypoDescender entries in the OS/2 table. For vertical writing-modes, the descent (the distance, in this case from the (0,0) point to the left edge of the glyph) is normally zero because the (0,0) point is on the left edge. The ascent for vertical writing-modes is either 1 em or is specified by the ideographic top baseline value in the OpenType Base table for vertical writing-modes.

Glyphs are positioned relative to a particular point on each glyph known as thealignment point. For horizontal writing-modes, the glyphs'alignment points are vertically aligned while for vertical writing-modes, they are horizontally aligned. The position of thealignment point depends on the script. For example, Western glyphs are aligned at the bottom of capital letters, northern indic glyphs are aligned at the top of a horizontal stroke near the top of the glyphs, and far-eastern glyphs are aligned either at the bottom or center of the glyph.

Within a script and within a line of text having a single font-size, the sequence of alignment points defines, in theinline-base direction, a geometric line called abaseline. Western and most other alphabetic and syllabic glyphs are aligned to an "alphabetic" baseline, the northern indic glyphs are aligned to a "hanging" baseline and the far-eastern glyphs are aligned to an "ideographic" baseline.

Baseline example in three different scripts.

Example baselines (red lines) in three different scripts. From left to right: alphabetic, hanging, ideographic. The EM box is shown in blue for the ideographic script.

As glyphs are sequentially placed along a baseline, thealignment point of a glyph is typically positioned at thecurrent text position (some properties such asvertical-align may alter the positioning). After each glyph is placed, thecurrent text position is advanced by the glyph'sadvance value (typically the width for horizontal text or height for vertical text) with any correction for kerning or other spacing adjustment as well as for new lines in pre-formatted or auto-wrapped text. The initial and final current text positions are used for alignment (e.g. when thetext-anchor value is either 'middle' or 'end'). The glyph's advance is needed when placing text along a path.

Baseline example in three different scripts.

Example of font metrics. The blue boxes show the geometric boxes for the three glyphs. The labeled small circles show thecurrent text position before glyph placement. The small square shows the finalcurrent text position after placing the last glyph. Note that the left side of the 'a' glyph's box is not aligned with the right side of the 'V' glyph's box due to kerning.

If a glyph does not provide explicit advance values corresponding to the current glyph orientation, then an appropriate approximation should be used. For vertical text, a suggested approximation is theem size.

The initialcurrent text position is established by thex andy attributes on thetext element or first renderedtspan element for pre-formatted text, or auto-wrapped text when thecontent area is determined by theinline-size property. For other auto-wrapped text, the initialcurrent text position is determined by the position of the first rendered glyph after applying the CSS line wrapping algorithm.

Abaseline-table specifies the position of one or more baselines in the design space coordinate system. The function of the baseline table is to facilitate the alignment of different scripts with respect to each other when they are mixed on the same text line. Because the desired relative alignments may depend on which script is dominant in a line (or block), there may be a different baseline table for each script. In addition, different alignment positions are needed for horizontal and vertical writing modes. Therefore, the font may have a set of baseline tables: typically, one or more for horizontal writing-modes and zero or more for vertical writing-modes.

Some fonts may not have values for the baseline tables. Heuristics are suggested for approximating the baseline tables inCSS Inline Layout Module Level 3 [css-inline-3] when a given font does not supply baseline tables.

When a different font (or change in font size) is specified in the middle of a run of text, thedominant baseline determines the baseline used to align glyphs in the new font (new size) to those in the previous font. Thedominant-baseline property is used to set the dominant baseline.

Alignment between an object relative to its parent is determined by thealignment baseline. It is normally the same baseline as the dominant baseline but by using the shorthandvertical-align property (preferred) or the longhandalignment-baseline another baseline can be chosen.

The dominant baseline can be temporarily shifted (as needed for superscripts or subscripts) by using either the shorthandvertical-align property (preferred) or the longhandbaseline-shift property. Note that shifts can be nested, each shift added to the previous shift.

Examples of using the 'vertical-align' property. Left shows '[[z]]' where the inner brackets are smaller. Right shows 'x2' where the '2' is a superscript.

Examples of using the 'vertical-align' property. Left: 'vertical-align:mathematical' ('alignment-baseline:mathematical') is applied to thetspan containing '[z]'. The light-blue line shows the position of the mathematical baseline. Right: 'vertical-align:super' ('baseline-shift:super') applied to thetspan containing '2'. The light-blue lines indicate the shift in baseline.

SVG further assumes that for each glyph in the font data for a font, there are two width values, two alignment-baselines and two alignment points, one each for horizontal writing-modes and the other for vertical writing-modes. (Even though it is specified as a width, for vertical writing-modes the width is used in the vertical direction.) Theinline-base direction position of the alignment point is on the start-edge of the glyph.

Additional information on baselines can be found in theCSS Inline Layout Module Level 3 specification. [css-inline-3] (Also see:CSS Writing Modes Level 3 specification. [css-writing-modes-3])

SVG 2 Requirement:Support text aligned to different baselines.
Resolution:SVG 2 will support glyphs being aligned to different baselines, perhaps by using existing or improved CSS properties.
Purpose:To allow glyphs in horizontal text to have different vertical alignments for stylistic effects.
Owner:Chris (no action)
Status:Done

A single line of text is laid out inside aline box. Multi-line text is produced by stacking these boxes. The height of aline box is determined by finding the maximum ascent and the maximum descent of all the glyphs in a line of text after applying the effect of theline-height property. The width of aline box is normally the width of the containing text block. In SVG, when the containing text block does not have a fixed geometry (as with pre-formatted text), theline box tightly wraps the glyph boxes within the box.

The sentence 'A big word.' where 'big' is in a larger font.

Example of determining the height of aline box. First each glyph box (small light-blue boxes) is extended vertically above and below according to theline-height property. In this case theline-height property is 125%. The larger glyphs have afont-size of 96px so their extra height is 24px (25% of 96px). The extra height is evenly divided above and below resulting in the red boxes. (For clarity, all glyphs in the same inline element have been grouped together). The finalline box (large light-blue box) is then found using the maximum extents of the red boxes above and below the baseline.

In order to support various international writing systems,line boxes may be orientated in a horizontal or vertical direction. Text within a verticalline box flows from top to bottom. Text within a horizontalline box may flow left-to-right (e.g., modern Latin scripts), right-to-left (e.g., Hebrew or Arabic), or a mixture of left-to-right and right-to-left (bidirectional text).

The processing model for bidirectional text is as follows:

While kerning or ligature processing might be font-specific, the preferred model is that kerning and ligature processing occurs between combinations of characters or glyphs after the characters have been re-ordered.

The orientation ofline boxes as well as the direction in which they are stacked (block-flow direction) is determined by thewriting-mode property. For horizontal text (writing-mode valuehorizontal-tb)line boxes are stacked from top to bottom. For vertical text,line boxes are stacked from right-to-left (writing-mode valuevertical-rl) or left-to-right (writing-mode valuevertical-lr).

11.2. The‘text’ and‘tspan’ elements

Thetext element defines a graphics element consisting of text. Thetspan element within atext or anothertspan element, allows one to switch the style and/or adjust the position of the rendered text inside thetspan element relative to the parent element.

The character data within thetext andtspan elements, along with relevant attributes and properties, and character-to-glyph mapping tables within the font itself, define the glyphs to be rendered. The attributes and properties on thetext andtspan elements indicate such things as the writing direction, font specification, and painting attributes which describe how exactly to render the characters. Subsequent sections of this chapter describe the relevant text-specific attributes and properties.

Sincetext andtspan elements are rendered using the same rendering methods as other graphics elements, all of the samepainting features that apply toshapes such aspaths andrectangles also apply totext andtspan elements, except formarkers. In addition,coordinate system transformations,clipping, andmasking can be applied to thetext element as a whole.

In CSS terms, thetext element acts as a block element. Thetspan,textPath, anda elements that are descended fromtext content elements act as inline elements.

It is possible to apply a gradient, pattern, clipping path, mask or filter to text. When one of these facilities is applied to text and keyword'objectBoundingBox' is used (seeObject bounding box units) to specify a graphical effect relative to the "object bounding box", then the object bounding box units are computed relative to the entiretext element in all cases, even when different effects are applied to differenttspan ortextPath elements within the sametext element.

Thetext element renders its first glyph (after bidirectionality reordering) at the initialcurrent text position (with possible adjustments due to the value of thetext-anchor property or thetext-align property). For pre-formatted text and for auto-wrapped text where thecontent area is determined by theinline-size property, the initialcurrent text position is determined by thex andy values of thetext ortspan element which contains the first rendered character. For auto-wrapped text in a shape or text on a path see theAuto-wrapped text orText on a path sections, respectively, to determine the initialcurrent text position. After the glyph(s) corresponding to the given character is (are) rendered, the current text position is updated for the next character. In the simplest case, the new current text position is the previous current text position plus the glyphs' advance value (horizontal or vertical). Seetext layout for a description of glyph placement and glyph advance.

The text stringHello, out there! is rendered onto the canvas using the Verdana font family with the glyphs filled with the color blue.

<?xml version="1.0" standalone="no"?><svg width="10cm" height="3cm" viewBox="0 0 1000 300"     xmlns="http://www.w3.org/2000/svg" version="1.1">  <text x="250" y="180"        font-family="Verdana" font-size="64" fill="blue" >    Hello, out there!  </text></svg>
Image showing the blue text.

Atspan is used to change the styling of the wordnot.

<?xml version="1.0" standalone="no"?><svg width="10cm" height="3cm" viewBox="0 0 1000 300"     xmlns="http://www.w3.org/2000/svg" version="1.1">  <g font-family="Verdana" font-size="64" >    <text x="160" y="180" fill="blue" >      You are      <tspan font-weight="bold" fill="red" >not</tspan>      a banana.    </text>  </g></svg>
Blue text except the word 'not' is red.

Twotspan elements are repositioned horizontally and vertically using thex andy attributes. Because all the text is within a singletext element, a user will be able to select through all the text and copy it to the system clipboard in user agents that supporttext selection and clipboard operations.

<?xml version="1.0" standalone="no"?><svg width="10cm" height="3cm" viewBox="0 0 1000 300"     xmlns="http://www.w3.org/2000/svg" version="1.1">  <g font-family="Verdana" font-size="64" >    <text x="100" y="180" fill="blue" >      But you      <tspan dx="2em" dy="-50" font-weight="bold" fill="red" >        are      </tspan>      <tspan dy="100">        a peach!      </tspan>    </text>  </g></svg>
A sentence with several shifted words.
text
Categories:
Graphics element,renderable element,text content element
Content model:
Any number of the following elements or character data, in any order:a,clipPath,marker,mask,script,style
Attributes:
DOM Interfaces:
SVG 2 Requirement:Allow transforms ontspan.
Resolution:SVG 2 will allow transforms on‘tspan’.
Purpose:Align with other elements such asa which already allow transforms.
Owner:Cameron (no action)
Status:Done

This decision was reversed. SeeGitHub Issue210. CSS/HTML does not allow transforms on inline elementsand no renderer supports transforms on thea elementwhen inline (in both SVG and HTML).

tspan
Categories:
Graphics element,renderable element,text content element,text content child element
Content model:
Any number of the following elements or character data, in any order:a,animate,script,set,style,tspan
Attributes:
DOM Interfaces:

11.2.1. Attributes

NameValueInitial valueAnimatable
x,y[ [<length-percentage> |<number> ]+ ]#0 fortext;
(none) fortspan
yes

If a single<length> is provided, then the value represents the new absolute X (Y) coordinate for thecurrent text position for rendering the glyphs that correspond to the first character within this element or any of its descendants.

If a comma- or space-separated list ofn<length>s is provided, then the values represent new absolute X (Y) coordinates for thecurrent text position for rendering the glyphs corresponding to each of the firstnaddressable characters within this element or any of its descendants.

If more<length>s are provided than characters, then the extra<length>s will have no effect on glyph positioning.

If more characters exist than<length>s, or if the attribute is not specified on atspan, then for each additional character:

  1. if an ancestortext ortspan element specifies an absolute X (Y) coordinate for the given character via an‘x’ (‘y’) attribute (nearest ancestor has precedence), then that absolute X (Y) coordinate is used as the starting X (Y) coordinate for that character, else
  2. the starting X (Y) coordinate for rendering the glyphs corresponding to the given character is the X (Y) coordinate of the resultingcurrent text position from the most recently rendered glyph for the currenttext element.

In SVG 2, thetext andtspanxandy attributes are not presentation attributesand cannot be set via CSS. This may change in a future versionof SVG.

NameValueInitial valueAnimatable
dx,dy[ [<length-percentage> |<number> ]+ ]#(none)yes

If a single<length> is provided, this value represents the new relative X (Y) coordinate for thecurrent text position for rendering the glyphs corresponding to the first character within this element or any of its descendants. Thecurrent text position is shifted along the x-axis (y-axis) of the current user coordinate system by<length> before the first character's glyphs are rendered.

If a comma- or space-separated list ofn<length>s is provided, then the values represent incremental shifts along the x-axis (y-axis) for thecurrent text position before rendering the glyphs corresponding to the firstnaddressable characters within this element or any of its descendants. Thus, before the glyphs are rendered corresponding to each character, thecurrent text position resulting from drawing the glyphs for the previous character within the currenttext element is shifted along the x-axis (y-axis) of the current user coordinate system by<length>.

If more<length>s are provided than characters, then any extra<length>s will have no effect on glyph positioning.

If more characters exist than<length>s, or if the attribute is not specified, then for each additional character:

  1. if an ancestortext ortspan element specifies a relative X (Y) coordinate for the given character via a‘dx’ (‘dy’) attribute (nearest ancestor has precedence), then thecurrent text position is shifted along the x-axis (y-axis) of the current user coordinate system by that amount, else
  2. no extra shift along the x-axis (y-axis) occurs.
NameValueInitial valueAnimatable
rotate[<number>+ ]#(none)yes (non-additive).

The supplemental rotation, in degrees, about thecurrent text position that will be applied to all of the glyphs corresponding to each character within this element.

If a comma- or space-separated list of<number>s 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<number>s are provided than there are characters, then the extra<number>s will be ignored.

If more characters are provided than<number>s, 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 of atspan element specifies a supplemental rotation for a given character via arotate attribute (nearest ancestor has precedence), then the given supplemental rotation is applied to the given character. If there are more characters than<number>s specified in the ancestor'srotate 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 whichcurrent text position is modified as glyphs get rendered and is supplemental to any rotation due totext on a path and totext-orientation,glyph-orientation-horizontal, orglyph-orientation-vertical.

NameValueInitial valueAnimatable
textLength<length-percentage> |<number>See belowyes

The author's computation of the total sum of all of the advance values that correspond to character data within this element, including the advance value on the glyph (horizontal or vertical), the effect of propertiesletter-spacing andword-spacing and adjustments due to attributesdx anddy on thistext ortspan element or any descendants. This value is used to calibrate the user agent's own calculations with that of the author.

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 oftextLength.

If attributetextLength is specified on a given element and also specified on an ancestor, the adjustments on all character data within this element are controlled by the value oftextLength on this element exclusively, with the possible side-effect that the adjustment ratio for the contents of this element might be different than the adjustment ratio used for other content that shares the same ancestor. The user agent must assume that the total advance values for the other content within that ancestor is the difference between the advance value on that ancestor and the advance value for this element.

This attribute is not intended for use to obtain effects suchas shrinking or expanding text.

A negative value is an error (seeError processing).

ThetextLength attribute is only applied when thewrapping area is not defined by theshape-inside ortheinline-size properties. It is also not applied foranytext ortspan element that has forced line breaks(due to awhite-space value ofpre orpre-line).

If the attribute is not specified anywhere within atext element, the effect is as if the author's computation exactly matched the value calculated by the user agent; thus, no advance adjustments are made. For the purpose ofreflecting the attribute in the DOM, theinitial value is the current user-agent calculated length, expressed in implicituser units.

NameValueInitial valueAnimatable
lengthAdjustspacing | spacingAndGlyphsspacingyes
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 theinline-base direction).

The user agent is required to achieve correct start and end positions for the text strings, but the locations of intermediate glyphs are not predictable because user agents might employ advanced algorithms to stretch or compress text strings in order to balance correct start and end positioning with optimal typography.

Note that, for a text string that containsn characters, the adjustments to the advance values often occur only forn−1 characters (see description of attributetextLength), whereas stretching or compressing of the glyphs will be applied to alln characters.

11.2.2. Notes on 'x', 'y', 'dx', 'dy' and 'rotate'

Thex,y,dx,dy, androtate on thetext andtspan elements are useful in high-end typography scenarios where individual glyphs require exact placement. These attributes are useful for minor positioning adjustments between characters or for major positioning adjustments, such as moving a section of text to a new location to achieve the visual effect of a new line of text (compatible with SVG 1.1). Note that thex,y,dx,dy, androtate attributes are ignored for auto-wrapped text (except for the initialcurrent text position when thecontent area is specified by theinline-size property).

It was decided at the 2015 Sydney F2F that 'dx', 'dy', and 'rotate' would be ignored for auto-wrapped text. (Technically, it is not difficult to apply them but it was not seen as being really useful.)

In situations where micro-level positioning adjustment are necessary for advanced typographic control, the SVG content designer needs to ensure that the necessary font will be available for all viewers of the document (e.g., package up the necessary font data in the form of an SVG font or an alternative WebFont format which is stored at the same Web site as the SVG content) and that the viewing software will process the font in the expected way (the capabilities, characteristics and font layout mechanisms vary greatly from system to system). If the SVG content containsx,y,dx, ordy attribute values which are meant to correspond to a particular font processed by a particular set of viewing software and either of these requirements is not met, then the text might display with poor quality.

The following additional rules apply to attributesx,y,dx,dy, androtate when they contain a list of numbers:

Example tspan04 uses therotate attribute on thetspan element to rotate the glyphs to be rendered. This example shows a single text string in atspan element that contains more characters than the number of values specified in therotate attribute. In this case the last value specified in therotate attribute of thetspan must be applied to the remaining characters in the string.

<?xml version="1.0" standalone="no"?><svg width="10cm" height="3cm" viewBox="0 0 1000 300"  xmlns="http://www.w3.org/2000/svg" version="1.1">  <desc>    Example tspan04 - The number of rotate values is less than the number of    characters in the string.  </desc>  <text font-family="Verdana" font-size="55" fill="blue" >    <tspan x="250" y="150" rotate="-30,0,30">      Hello, out there    </tspan>  </text>  <!-- Show outline of viewport using 'rect' element -->  <rect x="1" y="1" width="998" height="298"  fill="none" stroke="blue" stroke-width="2" /></svg>
Example tspan04 — simple rotation of characters in a tspan element

Example tspan04

View this example as SVG (SVG-enabled browsers only)

Example tspan05 specifies therotate attribute on thetext element and on all but one of the childtspan elements to rotate the glyphs to be rendered. The example demonstrates the propagation of therotate attribute.

<?xml version="1.0" standalone="no"?><svg width="100%" height="100%" viewBox="0 0 500 120"  xmlns="http://www.w3.org/2000/svg" version="1.1">  <desc>    Example tspan05 - propagation of rotation values to nested tspan elements.  </desc>  <text font-family="Arial, sans-serif" font-size="32" fill="red" x="40" y="40"    rotate="5,15,25,35,45,55">    Not    <tspan rotate="-10,-20,-30,-40" fill="orange">      all characters      <tspan rotate="70,60,50,40,30,20,10" fill="yellow">        in        <tspan>          the        </tspan>      </tspan>      <tspan fill="orange" x="40" y="90">        text      </tspan>      have a    </tspan>    <tspan rotate="-10" fill="blue">      specified    </tspan>    rotation  </text>  <!-- Show outline of viewport using 'rect' element -->  <rect x="1" y="1" width="498" height="118" fill="none"        stroke="blue" stroke-width="2" /></svg>
Example tspan05 — propagation of rotation values to nested tspan elements

Example tspan05

View this example as SVG (SVG-enabled browsers only)

Rotation of red text inside thetext element:

Rotation of the orange text inside the "child1"tspanelement:

Rotation of the yellow text inside the "child2"tspanelement:

Rotation of the blue text inside the "child5"tspan element:

The following diagram illustrates how the rotation values propagate totspan elements nested withing atext element:

Image that shows propagation of rotation values

11.3. Text layout – Introduction

SVG 2 Requirement:Include text layout improvements from SVG Tiny 1.2.
Resolution:SVG 2 will include the improved text from SVG Tiny 1.2 on characters and glyphs, text layout, text selection, text search.
Purpose:To include clearer descriptions of text layout; no functional change.
Owner:Chris (ACTION-3236)
SVG 2 Requirement:Support text in shapes.
Resolution:SVG 2 will require automatic text wrapping compatible with CSS.
Purpose:Text in flow charts, etc.
Owner:Tav (no action)

This section gives a short overview of SVG text layout. It is followed by sections that cover different aspects of text layout in more detail.

Text layout in SVG is a multi-stage process that takes as input atext element subtree and its property values and produces a sequence of glyphs to render and their positions in eachtext content element's coordinate system.

First, atext element and its descendants are laid out inside acontent area orwrapping area according to CSS, as if thetext were a block element and anytspan,textPath, anda descendants were inline elements. This layout takes into account all paragraph level and font related CSS properties described in this chapter.

Thecontent area may be explicitly declared by setting theinline-size property, or by setting theshape-inside property that defines or references an SVGshape. If acontent area is not declared, it defaults to a rectangle of infinite width and height.

Second, any positioning given byx,y,dx anddy attributes are applied to the resulting glyph positions from the CSS layout process. The rules for which transforms are allowed depend on if thecontent area was explicitly declared or not. If not explicitly declared, the rules define the layout ofpre-formatted text. If declared, the rules define the layout ofauto-wrapped text.

Third, the effect of thetext-anchor property is applied if necessary.

Finally, layout of glyphs for anytextPath elements is performed, convertingpre-formatted text totext-on-a-path.

Examples of the different types of text layout:

Pre-formatted:
For short strings of text (e.g. labels) or where exact placement of glyphs is required (e.g. hand-kerned titles).

An example of multi-line pre-formatted text.

<svg xmlns="http://www.w3.org/2000/svg"     width="300" height="100" viewBox="0 0 300 100">     <text x="20" y="45">       Example of multi-line,       <tspan x="20" y="75">pre-formatted text.</tspan>     </text></svg>
Image showing two lines of pre-formatted text.

Pre-formatted text where atspan element has been used to create multi-line text.

Wrapped text:
For long strings of text where automatic text wrapping is required.

An example of auto-wrapped text.

<svg xmlns="http://www.w3.org/2000/svg"     width="300" height="100" viewBox="0 0 300 100">  <text x="20" y="45">    Example of text auto-wrapped.</text></svg>
Image showing auto-wrapped text on two lines.

Auto-wrapped text. Theinline-size property defines a rectangular content area of infinite height (shown in light blue).

Text on path:
For text that follows a specified path.

An example of text on a path.

<svg xmlns="http://www.w3.org/2000/svg"     width="300" height="100" viewBox="0 0 300 100">  <path stroke="lightblue" fill="none"d="M 50,50 C 100,0 200,100 250,50"/>  <text>    <textPath href="#MyPath">Text on a path.</textPath>  </text></svg>
Image showing text following a path.

Text on a path. ThetextPath element references apath element (shown in light blue).

SVG 2 introduces the ability to automatically wrap text inside a rectangle or other shape by specifying acontent area. The design of SVG wrapped text is motivated by the desire that SVG text wrapping be as compatible as possible with text wrapping in CSS in order that renderers that support CSS text wrapping can implement SVG text wrapping easily (but without requiring non-HTML compatible SVG renderers to implement HTML). There are several differences between SVG and CSS text wrapping. The most important is that in SVG, acontent area must be explicitly provided as SVG does not have an automatic finite (or semi-finite)content area (provided in CSS by the box model). Another difference is that SVG does not have the <p></p> and <br/> elements which create line breaks. Instead, SVG relies on thepre andpre-line values ofwhite-space to provide line breaks. SVG wrapped text also allows a content-creation tool to provide a natural fallback for SVG 1.1 renderers that do not support wrapped text (by use ofx andy attributes in thetext andtspan elements, which are ignored by SVG 2 renderers for auto-wrapped text).

SVG's text layout options are designed to cover most general use cases. If more complex layout is required (bulleted lists, tables, etc.), text can be rendered in another XML namespace such as XHTML [HTML] embedded inline within aforeignObject element.

11.4. Text layout – Content Area

Acontent area is defined by specifying in atext element aninline-size property, or ashape-inside property that defines or references an SVGshape. If nocontent area is provided, thecontent area defaults to a rectangle of infinite width and height (see thepre-formatted text section). If both aninline-size property and ashape-inside property with value other than 'none' are given, theshape-inside property is used.

Wrapped text is laid out in awrapping area. Thewrapping area is normally the same as thecontent area. When thecontent area is defined using theshape-inside property, thewrapping area may be smaller due to the presence of ashape-subtract property and/or ashape-padding property. Theshape-subtract property (along with theshape-margin property) defines awrapping context. Thewrapping area is found by insetting thecontent area by theshape-padding distance, and then subtracting thewrapping context.

Once awrapping area is defined, the text is laid out inside thewrapping area according to the rules of CSS (respecting any special rules given in this section).

Constructing equivalent wrapping areas in SVG and HTML. The text inside the wrapping areas is rendered the same in both cases.

Image showing the creation of an hour glass shape           using a circle with two semicircles spaced out           horizontally. Text is wrapped in the circle after           the left and right semicircles exclude part of the           circle.

Defining awrapping area in SVG.Thetext element has both ashape-insideproperty and ashape-subtract property.Theshape-inside property references a circle thatdefines acontent area (dotted purple line). Theshape-subtract property referencing two semicirclesdefines awrapping context (dotted green line) which whensubtracted from thecontent area results inthewrapping area (light blue line).

Image showing the creation of an hour glass shape           using a circle with two semicircles spaced out           horizontally. Text is wrapped in the circle after           the left and right semicircles exclude part of the           circle.

Defining awrapping area in HTML.Awrapper <div> contains twofloat<div>s. The wrapper <div> defines a rectangularregion (solid purple line). Itsshape-inside propertydefines acontent area within the <div> (dottedpurple line). The two other <div>s define two floats,one on the left (solid green line) and the right (solid pinkline). The floats are rectangular in shape. Each float has ashape-outside property which defines thewrapping context for each float (dotted green and pink lines). The combinedwrapping context is subtracted from thecontent area to defined thewrapping area (light blue line).

11.4.1. The ‘inline-size’ property

'extent' added by resolution fromFebruary 12th, 2015. 'extent' replaces the 'width' and 'height' attributes, added by resolution from June 27th, 2013. Replaced by 'inline-size' presentation attribute per resolution fromLinkoping F2F, June 11, 2015.

Theinline-size property allows one to set thewrapping area to a rectangular shape. The computed value of the property sets the width of the rectangle for horizontal text and the height of the rectangle for vertical text. The other dimension (height for horizontal text, width for vertical text) is of infinite length. A value of zero disables the creation of awrapping area.

The initialcurrent text position is taken from thex andy attributes of thetext element (or first childtspan element if the attributes are not given on thetext element). For left-to-right text, the initialcurrent text position is at the left of the rectangle. For right-to-left text it is at the right of the rectangle. For vertical text, the initialcurrent text position is at the top of the rectangle.

The rectangle (wrapping area) is then anchored according to thetext-anchor property using the edges of thewrapping area to determine the start, middle, and end positions.

Theinline-size property method to wrap text is an extension to pre-formatted SVG text where the author simply gives a limit to the width or height of the block of text; thus the use of thex andy attributes along with thedirection andtext-anchor properties to position the first line of text. If full justification is needed, theshape-inside property should be used to create thewrapping area.

Name:inline-size
Value:<length-percentage>
Initial:0
Applies to:text elements
Inherited:no
Percentages:Refer to the width (for horizontal text) or height (for vertical text) of the current SVG viewport(seeUnits)
Media:visual
Computed value:absolute length or percentage
Animatable:yes

An example of usinginline-size for wrapping horizontal text.

<svg xmlns="http://www.w3.org/2000/svg"     width="300" height="100" viewBox="0 0 300 100">  <text x="50" y="30">    This text wraps at 200 pixels.  </text></svg>
Image showing English text wrapped into two lines.

Horizontal text wrapping. The light-blue lines indicate thelimits of thecontent area. Note that the contentarea is of infinite height. The red dot shows the initialcurrent text position.

An example of usinginline-size for wrapping right to left horizontal text.

<svg xmlns="http://www.w3.org/2000/svg"     width="300" height="100" viewBox="0 0 300 100">  <text x="250" y="30"style="font: 20px PakType Naqsh; inline-size: 200px; direction: rtl;">    هذا النص يلتف في 200 بكسل.</text></svg>
Image showing Arabic text wrapped into two lines.

Horizontal text wrapping for right to left text.The light-blue lines indicate thelimits of thecontent area. Note that the contentarea is of infinite height. The red dot shows the initialcurrent text position.

Some browser may not render this SVG 1.1 figure correctly. Batik and Firefox seems to get it right. Bug filed against Chrome.

An example of usinginline-size for wrapping vertical text.

<svg xmlns="http://www.w3.org/2000/svg"     width="100" height="300" viewBox="0 0 100 300">  <text x="62.5" y="25" inline-size="200"style="font: 25px IPAMincho; inline-size: 200px; writing-mode: vertical-rl;">    テキストは10文字後に折り返されます。</text></svg>
Image showing vertical Japanese text wrapped into two columns.

Vertical text wrapping. The light-blue lines indicate thelimits of thecontent area. Note that the contentarea is of infinite width. The red dot shows the initialcurrent text position.

This SVG 1.1 image doesn't work in Firefox, even nightly. Firefox does not support the presentation attribute 'writing-mode'. Bug filed against Firefox.

An example of usinginline-size for wrapping horizontal text, anchored in the middle.

<svg xmlns="http://www.w3.org/2000/svg"     width="300" height="100" viewBox="0 0 300 100">  <text x="50" y="30">    This text wraps at 200 pixels.  </text></svg>
Image showing English text wrapped into two lines, anchored in the center.

Horizontal text wrapping. The light-blue lines indicate thelimits of thecontent area. The text is anchored inthe middle. The red dot shows the initialcurrent text position.

11.4.2. The ‘shape-inside’ property

Theshape-inside property allows one to set thecontent area to aCSS basic shape or to an SVGshape.

In CSS/HTMLshape-inside applies to block-level elements and absolute and percentage values are defined relative to the block-level element. In SVG absolute and percentage values are defined relative to the currentuser coordinate system and theviewBox.

Name:shape-inside
Value:auto | [ <basic-shape> | <uri> ]+
Initial:auto
Applies to:text elements
Inherited:no
Percentages:Relative to theviewBox
Media:visual
Computed value:computed lengths for <shape>, the absolute URI for <uri>, otherwise as specified
Animatable:yes, seeInterpolation of Basic Shapes
auto
For the purposes of SVG, the 'auto' value indicates that the content area should be defined using theinline-size property or as for pre-formatted text.
<basic-shape>
The shape is computed based on the values of one of 'circle()', 'ellipse()' or 'polygon()'. The CSS value of 'inset()' is invalid for SVG.

An example of using a CSS basic-shape for wrapping horizontal text.

<svg xmlns="http://www.w3.org/2000/svg"     width="300" height="300" viewBox="0 0 300 300">  <text>    Lorem ipsum dolor sit amet, consec-tetuer adipiscing elit...</text></svg>
Image showing text wrapped inside a circle.

Horizontal text wrapping inside a CSS circle shape. The light-blue circle indicates the limit of thecontent area.

<uri>
If the <uri> references an SVGshape element, that element defines the shape. Otherwise, if the <uri> references an image, the shape is extracted and computed based on the alpha channel of the specified image using theshape-image-threshold. If the <uri> does not reference an SVG shape element or an image, the effect is as if the value ‘auto’ had been specified.

An example of using a reference to an SVGshape for wrapping horizontal text.

<svg xmlns="http://www.w3.org/2000/svg"     width="300" height="100" viewBox="0 0 300 100">  <defs>    <rect x="50" y="10" width="200" height="80"/>  </defs>  <text>    This text wraps in a rectangle.</text></svg>
Image showing text wrapped inside a rectangle.

Horizontal text wrapping inside an SVG rectangle shape. The light-blue lines indicate the limits of thecontent area.

The CSS values of 'outside-shape', 'shape-box', and 'display' are invalid for SVG.

SVG allows theshape-inside property to have a list of shapes. Each shape defines an independentcontent area. Text is first laid out in the content area of the first shape. If the text overflows the first shape, the overflow text is laid out in the next shape until all text is laid out or no more shapes are available.

The effect is similar to CSS columns, except that the columns can have arbitrary shapes.

It is recommended that anoverflow shape be provided to ensure the accessibility of all text in cases; for example, if a user increases the font size.

Except as noted, see the CSS Shapes Module Level 2 for the definition of'shape-inside'. [css-shapes-2]

'shape-inside' was removed when the CSS Exclusions and Shapes Module was split into separate Exclusions and Shapes modules. At the Tokyo joint SVG/CSS F2F meeting, it was agreed that it would reappear in CSS Shapes Module Level 2.

11.4.3. The ‘shape-subtract’ property

Theshape-subtract property allows one to exclude part of thecontent area from thewrapping area. The excluded area is the addition of all the areas defined in a list ofCSS basic shapes and/or SVGshapes.

It was resolved at the 2016 Sydney F2F that 'shape-subtract' should be uses instead of 'shape-outside' due to the different behavior required. ('shape-outside' reduces the area of an exclusion.)

Absolute and percentage values are defined relative to the currentuser coordinate system and theviewBox.

Name:shape-subtract
Value:none | [ <basic-shape>| <uri> ]+
Initial:none
Applies to:text elements
Inherited:no
Percentages:Relative to theviewBox
Media:visual
Computed value:computed lengths for any <basic-shape>, the absolute URI for <uri>, otherwise as specified
Animatable:yes, seeInterpolation of Basic Shapes
<basic-shape>
The shape is computed based on the values of one of 'circle()', 'ellipse()' or 'polygon()'.
<uri>
For any <uri> that references an SVGshape element, that element defines the contributing shape, expanded by the value of itsshape-margin distance. For any <uri> that references an image, the contributing shape is extracted and computed based on the alpha channel of the specified image using theshape-image-threshold. If an <uri> does not reference an SVG shape element or an image, that <uri> is ignored.

An example of usingshape-subtract.

.
<svg xmlns="http://www.w3.org/2000/svg"     width="450" height="300" viewBox="0 0 450 300">  <rect x="25"  y="25"  width="225" height="175" fill="white" stroke="black"/>  <rect x="200" y="125" width="225" height="150" fill="white" stroke="black"       />  <text>Lorem ipsum ...</text>  <text>Lorem ipsum ...</text></svg>
Image showing horizontal text wrapped inside two overlapping rectangles.

Horizontal text wrapping inside two overlapping rectanglesusingshape-subtract as well asshape-inside,shape-padding andshape-margin. The black rectangles showthecontent areas. The inner blue lines showthewrapping areas.

11.4.4. The ‘shape-image-threshold’ property

Theshape-image-threshold defines the alpha channel threshold used to extract the shape using an image. A value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque.

For the purposes of SVG, this property applies totext elements.

Except as noted, see the CSS Shapes Module Level 1 for the definition of'shape-image-threshold'. [css-shapes-1]

11.4.5. The ‘shape-margin’ property

Theshape-margin property adds a margin to a shape referenced withshape-subtract. It defines a new shape where every point is the specified distance from the original shape. This property takes on positive values only.

Name:shape-margin
Value:<length-percentage>
Initial:0
Applies to:text elements
Inherited:no
Percentages:N/A
Media:visual
Computed value:the absolute length
Animatable:yes

Except as noted, see the CSS Shapes Module Level 1 for the definition of See'shape-margin'. [css-shapes-1]

11.4.6. The ‘shape-padding’ property

Theshape-padding property can be used to offset the inline flow content wrapping on the inside of elements. Offsets created by the ‘wrap-padding’ property are offset from the content area of the element. This property takes on positive values only.

An example of usingshape-padding

.
<svg xmlns="http://www.w3.org/2000/svg"     width="300" height="300" viewBox="0 0 300 300">  <circle cx="150" cy="150" r="125" fill="none" stroke="black"/>  <text>This is an  example of wrapped text in SVG 2! There should  be 25 pixel padding around the text. The text is  justified on both sides. It looks good!</text></svg>
Image showing horizontal text wrapped inside a circle with a padding.

Horizontal text wrapping inside a circle withashape-padding. The outer black circle showsthecontent area. The inner blue circle showsthewrapping area.

This image is a PNG. Figure out how to make a good SVG. Note: Chrome supports 'textLength' on 'tspan' but Firefox does not.

Except as noted, see the CSS Shapes Module Level 2 for the definition of'shape-padding'.

11.5. Text layout – Algorithm

Text layout begins by passing to a CSS-based text renderer the content of thetext element which includes text data along with styling information and a description of one or more shapes to be filled. Thetext element is treated as a block element and its descendanttspan,textPath anda elements are treated as inline elements. The CSS renderer returns a set oftypographic characters with their positions resulting from laying out the text as if the text were absolutely positioned.

Atypographic character may contain more than oneglyph. It is assumed here the relative positioning of theglyphs inside atypographic character is encapsulated by thetypographic character and it is not user controllable.

Once acontent area has been defined, the following algorithm is used to determine thetypographic characters and their positions for a giventext element:

A number of CSS properties have no or limited effect on SVG text layout:

Various SVG attributes and properties may reposition thetypographic characters depending on how thecontent area is defined:

The following SVG text layout algorithm returns output information about each character in the DOM in thetext element's subtree. That information includes:

The arrays given in the SVG attributesx,y,dx,dy, androtate are indexed byaddressable characters. However, repositioning is applied totypographic characters. If atypographic character corresponds to more than one character (e.g. a ligature), only the array values corresponding to the first character are used in positioning thetypographic character. Array values corresponding to other characters in thetypographic character are skipped (forx andy), are accumulated and applied to the nexttypographic character (fordx anddy), or if it is the last value in the array, applied to the followingtypographic characters (forrotate). This ensures, for example, that attribute values are applied to the same characters regardless of whether or not a font has a particular ligature.

The SVG specific text layout algorithm is as follows:

  1. Setup
    1. Letroot be the result of generatingtypographic character positions for thetext element and its subtree, laid out as if it were an absolutely positioned element.

      This will be a single line of text unless thewhite-space property causes line breaks.

    2. Letcount be the number of DOMcharacters within thetext element's subtree.
    3. Letresult be an array of lengthcount whose entries contain the per-character information described above. Each entry is initialized as follows:
      • its global index number equal to its position in the array,
      • its "x" coordinate set to "unspecified",
      • its "y" coordinate set to "unspecified",
      • its "rotate" coordinate set to "unspecified",
      • its "hidden" flag is false,
      • its "addressable" flag is true,
      • its "middle" flag is false,
      • its "anchored chunk" flag is false.
      Ifresult is empty, then returnresult.
    4. LetCSS_positions be an array of lengthcount whose entries will be filled with thex andy positions of the correspondingtypographic character inroot. The array entries are initialized to (0, 0).
    5. Let "horizontal" be a flag, true if the writing mode oftext is horizontal, false otherwise.
  2. Set flags and assign initial positions

    For each array element with indexi inresult:

    1. Setaddressable to false if the character at indexi was:

      Since there is collapsible white space not addressable by glyph positioning attributes in the followingtext element (with a standard font), the "B" glyph will be placed at x=300.

      <text x="100 200 300">      A      B      </text>

      This is because the white space before the "A", and all but one white space character between the "A" and "B", is collapsed away or trimmed.

    2. Setmiddle to true if the character at indexi is the second or later character that corresponds to atypographic character.
    3. If the character at indexi corresponds to atypographic character at the beginning of a line, then set the "anchored chunk" flag ofresult[i] to true.

      This ensures chunks shifted bytext-anchor do not span multiple lines.

    4. Ifaddressable is true andmiddle is false then setCSS_positions[i] to the position of the correspondingtypographic character as determined by the CSS renderer. Otherwise, ifi > 0, then setCSS_positions[i] =CSS_positions[i − 1]
  3. Resolve character positioning

    Position adjustments (e.g values in ax attribute)specified by a node apply to all characters in that node includingcharacters in the node's descendants. Adjustments specified indescendant nodes, however, override adjustments from ancestornodes. This section resolves which adjustments are to be applied towhich characters. It also directly sets therotate coordinateofresult.

    1. Set up:
      1. Letresolve_x,resolve_y,resolve_dx, andresolve_dy be arrays of lengthcount whose entries are all initialized to "unspecified".
      2. Set "in_text_path" flag false.

        This flag will allowy (x)attribute values to be ignored for horizontal (vertical)text insidetextPath elements.

      3. Call the following procedure with thetext element node.
    2. Procedure:resolve character positioning:

      A recursive procedure that takes as input anode and whose steps are as follows:

      1. Ifnode is atext ortspan node:
        1. Letindex equal the "global index number" of the first character in the node.
        2. Letx,y,dx,dy androtate be the lists of values from the corresponding attributes onnode, or empty lists if the corresponding attribute was not specified or was invalid.
        3. If "in_text_path" flag is false:
          • Letnew_chunk_count = max(length ofx, length ofy).
          Else:
          • If the "horizontal" flag is true:
            • Letnew_chunk_count = length ofx.
          • Else:
            • Letnew_chunk_count = length ofy.
        4. Letlength be the number of DOM characters in the subtree rooted atnode.
        5. Leti = 0 andj = 0.

          i is an index ofaddressable characters in the node;j is an index of allcharacters in the node.

        6. Whilej <length, do:

          This loop applies thex,y,dx,dy androtate attributes to the content insidenode.

          1. If the "addressable" flag ofresult[index +j] is true, then:
            1. Ifi <new_check_count, then set the "anchored chunk" flag ofresult[index +j] to true. Else set the flag to false.

              Setting the flag to false ensures thatx andy attributes set in atext element don't create anchored chunk in atextPath element when they should not.

            2. Ifi < length ofx, then setresolve_x[index +j] tox[i].
            3. If "in_text_path" flag is true and the "horizontal" flag is false, unsetresolve_x[index].

              Thex attribute is ignored for vertical text on a path.

            4. Ifi < length ofy, then setresolve_y[index +j] toy[i].
            5. If "in_text_path" flag is true and the "horizontal" flag is true, unsetresolve_y[index].

              They attribute is ignored for horizontal text on a path.

            6. Ifi < length ofdx, then setresolve_dx[index +j] tody[i].
            7. Ifi < length ofdy, then setresolve_dy[index +j] tody[i].
            8. Ifi < length ofrotate, then set the angle value ofresult[index +j] torotate[i]. Otherwise, ifrotate is not empty, then setresult[index +j] toresult[index +j − 1].
            9. Seti =i + 1.
          2. Setj =j + 1.
      2. Ifnode is atextPath node:
        1. Letindex equal the global index number of the first character in the node (including descendant nodes).
        2. Set the "anchored chunk" flag ofresult[index] to true.

          AtextPath element always creates an anchored chunk.

        3. Setin_text_path flag true.
      3. For each child nodechild ofnode:
        1. Resolve glyph positioning ofchild.
      4. Ifnode is atextPath node:
        1. Set "in_text_path" flag false.
  4. Adjust positions: dx, dy

    Thedx anddy adjustments are appliedbefore adjustments due to thetextLength attribute whilethex,y androtateadjustments are applied after.

    1. Letshift be the cumulativex andy shifts due tox andy attributes, initialized to (0,0).
    2. For each array element with indexi in result:
      1. Ifresolve_x[i] is unspecified, set it to 0. Ifresolve_y[i] is unspecified, set it to 0.
      2. Letshift.x =shift.x +resolve_x[i] andshift.y =shift.y +resolve_y[i].
      3. Letresult[i].x = CSS_positions[i].x + shift.x andresult[i].y = CSS_positions[i].y + shift.y.
  5. ApplytextLength attribute
    1. Set up:
      1. Defineresolved descendant node as a descendant of node with a validtextLength attribute that is not itself a descendant node of a descendant node that has a validtextLength attribute.
      2. Call the following procedure with thetext element node.
    2. Procedure:resolve text length:

      A recursive procedure that takes as input anode and whose steps are as follows:

      1. For each child nodechild of node:
        1. Resolve text length of child.

          Child nodes are adjusted before parent nodes.

      2. Ifnode is atext ortspan node and if the node has a validtextLength attribute value:
        1. Leta = +∞ andb = −∞.
        2. Leti andj be the global index of the first character and last characters innode, respectively.
        3. For each indexk in the range [i,j] where the "addressable" flag ofresult[k] is true:

          This loop finds the left-(top-) most and right-(bottom-) most extents of thetypographic characters within the node and checks for forced line breaks.

          1. If the character atk is a linefeed or carriage return, return. No adjustments due totextLength are made to a node with a forced line break.
          2. Letpos = the x coordinate of the position inresult[k], if the "horizontal" flag is true, and the y coordinate otherwise.
          3. Letadvance = the advance of thetypographic character corresponding to characterk. [NOTE: This advance will be negative for RTL horizontal text.]
          4. Seta = min(a,pos,pos +advance).
          5. Setb = max(b,pos,pos +advance).
        4. Ifa ≠ +∞ then:
          1. Find the distancedelta =textLength computed value − (b − a).

            User agents are required to shift the lasttypographic character in the node bydelta, in the positivex directionif the "horizontal" flag is true and ifdirection islrt, in thenegativex direction if the "horizontal" flagis true anddirection isrtl, or in thepositivey direction otherwise. User agentsare free to adjust intermediatetypographic characters for optimaltypography. The next steps indicate one way toadjusttypographic characters whenthe value oflengthAdjust isspacing.

          2. Findn, the total number oftypographic characters in this node including any descendant nodes that are not resolved descendant nodes or within a resolved descendant node.
          3. Letn =n + number of resolved descendant nodes − 1.

            Each resolved descendant node is treated as if itwere a singletypographic character in thiscontext.

          4. Find the per-character adjustmentδ =delta/n.
          5. Letshift = 0.
          6. For each indexk in the range [i,j]:
            1. Add shift to thex coordinate of the position in result[k], if the "horizontal" flag is true, and to they coordinate otherwise.
            2. If the "middle" flag for result[k] is not true andk is not a character in a resolved descendant node other than the first character thenshift =shift +δ.
  6. Adjust positions: x, y

    This loop appliesx andy values,and ensures thattext-anchor chunks do not start inthe middle of atypographic character.

    1. Letshift be the current adjustment due to thex andy attributes, initialized to (0,0).
    2. Setindex = 1.
    3. Whileindex <count:
      1. Ifresolved_x[index] is set, then letshift.x =resolved_x[index] −result.x[index].
      2. Ifresolved_y[index] is set, then letshift.y =resolved_y[index] −result.y[index].
      3. Letresult.x[index] =result.x[index] + shift.x andresult.y[index] =result.y[index] + shift.y.
      4. If the "middle" and "anchored chunk" flags ofresult[index] are both true, then:
        1. Set the "anchored chunk" flag ofresult[index] to false.
        2. Ifindex + 1 <count, then set the "anchored chunk" flag ofresult[index + 1] to true.
      5. Setindex toindex + 1.
  7. Apply anchoring
    1. For each sliceresult[i..j] (inclusive of bothi andj), where:
      • the "anchored chunk" flag ofresult[i] is true,
      • the "anchored chunk" flags ofresult[k] wherei <kj are false, and
      • j =count − 1 or the "anchored chunk" flag ofresult[j + 1] is true;
      do:

      This loops over each anchored chunk.

      1. Leta = +∞ andb = −∞.
      2. For each indexk in the range [i,j] where the "addressable" flag ofresult[k] is true:

        This loop finds the left-(top-) most andright-(bottom-) most extents of thetypographic character within the anchored chunk.

        1. Letpos = the x coordinate of the position inresult[k], if the "horizontal" flag is true, and the y coordinate otherwise.
        2. Letadvance = the advance of thetypographic character corresponding to characterk. [NOTE: This advance will be negative for RTL horizontal text.]
        3. Seta = min(a,pos,pos +advance).
        4. Setb = max(b,pos,pos +advance).
      3. Ifa ≠ +∞, then:

        Here we perform the text anchoring.

        1. Letshift be the x coordinate ofresult[i], if the "horizontal" flag is true, and the y coordinate otherwise.
        2. Adjust shift based on the value oftext-anchor anddirection of the element the character at indexi is in:
          (start, ltr) or (end, rtl)
          Setshift =shifta.
          (start, rtl) or (end, ltr)
          Setshift =shiftb.
          (middle, ltr) or (middle, rtl)
          Setshift =shift − (a +b) / 2.
        3. For each indexk in the range [i,j]:
          1. Addshift to the x coordinate of the position inresult[k], if the "horizontal" flag is true, and to the y coordinate otherwise.
  8. Position on path
    1. Setindex = 0.
    2. Set the "in path" flag to false.
    3. Set the "after path" flag to false.
    4. Letpath_end be an offset for characters that follow atextPath element. Setpath_end to (0,0).
    5. Whileindex <count:
      1. If the character at indexi is within atextPath element and corresponds to atypographic character, then:
        1. Set "in path" flag to true.
        2. If the "middle" flag ofresult[index] is false, then:

          Here we applytextPath positioning.

          1. Letpath be theequivalent path of thebasic shape element referenced by thetextPath element, or an empty path if the reference is invalid.
          2. If theside attribute of thetextPath element is'right', then reversepath.
          3. Letlength be the length ofpath.
          4. Letoffset be the value of thetextPath element'sstartOffset attribute, adjusted due to anypathLength attribute on the referenced element.
          5. Letadvance = the advance of thetypographic character corresponding to characterk. [NOTE: This advance will be negative for RTL horizontal text.]
          6. Let (x,y) andangle be the position and angle inresult[index].
          7. Letmid be a coordinate value depending on the value of the "horizontal" flag:
            true
            mid isx +advance / 2 +offset
            false
            mid isy +advance / 2 +offset

            The user agent is free to make any additional adjustments tomid necessary to ensure high quality typesettingdue to aspacing value of'auto' or amethod value of'stretch'.

          8. Ifpath is not aclosed subpath andmid < 0 ormid >length, set the "hidden" flag ofresult[index] to true.
          9. Ifpath is aclosed subpath depending on the values oftext-anchor anddirection of the element the character atindex is in:

            This implements the special wrapping criteria for singleclosed subpaths.

            (start, ltr) or (end, rtl)
            Ifmidoffset < 0 ormidoffset >length, set the "hidden" flag ofresult[index] to true.
            (middle, ltr) or (middle, rtl)
            Ifmidoffset < −length/2 ormidoffset >length/2, set the "hidden" flag ofresult[index] to true.
            (start, rtl) or (end, ltr)
            Ifmidoffset < −length ormidoffset > 0, set the "hidden" flag ofresult[index] to true.

            Setmid =mid modlength.

          10. If thehidden flag is false:
            1. Letpoint be the position andt be the unit vector tangent to the pointmid distance alongpath.
            2. If the "horizontal" flag is
              true
              1. Letn be the normal unit vector pointing in the directiont + 90°.
              2. Leto be the horizontal distance from the vertical center line of the glyph to the alignment point.
              3. Then set the position inresult[index] topoint -o×t +y×n.
              4. Letr be the angle from the positive x-axis to the tangent.
              5. Set the angle value inresult[index] toangle +r.
              false
              1. Letn be the normal unit vector pointing in the directiont - 90°.
              2. Leto be the vertical distance from the horizontal center line of the glyph to the alignment point.
              3. Then set the position inresult[index] topoint -o×t +x×n.
              4. Letr be the angle from the positive y-axis to the tangent.
              5. Set the angle value inresult[index] toangle +r.
        3. Otherwise, the "middle" flag ofresult[index] is true:
          1. Set the position and angle values ofresult[index] to those inresult[index − 1].
      2. If the character at indexi is not within atextPath element and corresponds to atypographic character, then:

        This sets the starting point for rendering any characters thatoccur after atextPath element to the end of the path.

        1. If the "in path" flag is true:
          1. Set the "in path" flag to false.
          2. Set the "after path" flag to true.
          3. Setpath_end equal to the end point of the path referenced bytextPath − the position ofresult[index].
        2. If the "after path" is true.
          1. Ifanchored chunk ofresult[index] is true, set the "after path" flag to false.
          2. Else, letresult.x[index] =result.x[index] +path_end.x andresult.y[index] =result.y[index] +path_end.y.
      3. Setindex =index + 1.
  9. Returnresult

SVG 2 Requirement:Align with CSS for text layout functionality.
Resolution:SVG 2 Will use CSS3 definitions for text layout (white space, bidi, etc.) that is not specific to SVG.
Purpose:To facilitate shared specification and implementation of text layout in HTML and SVG.
Owner:Cameron and Chris (ACTION-3004,ACTION-3005)

11.6. Pre-formatted text

This option corresponds to basic SVG 1.1 text layout.

This is the default text layout method and is used in the absence of an explicitly definedcontent area. It is also used as a first step in laying outtext on a path (with slightly modified rules). In this layout method, no automatic line breaking or word wrapping is done. Nominally, the text is rendered as a single line inside a rectangularcontent area of infinite width and height. Multiple lines of text can be obtained by precomputing line breaks and using one of the following methods:

The following properties do not apply topre-formatted text:text-align,text-align-last,line-break,word-break,hyphens,word-wrap, andoverflow-wrap.

11.6.1. Multi-line text via 'white-space'

Multi-line pre-formatted text may be created by using thewhite-space valuespre orpre-line. In these cases, a line-feed or carriage return is preserved as a forced line break which creates a newline box. Theline boxes are stacked following the rules of CSS.

11.6.2. Repositioning Glyphs

After text is laid out according to the basic CSS text layout rules,typographic characters can be repositioned using SVG specific rules. Absolute repositioning can be prescribed by giving absolute coordinates in thex andy attributes or by forced line breaks. Absolute repositioning may be influenced by thetext-anchor property. Relative repositioning can be prescribed by giving relative coordinates in thedx anddy attributes. Thetypographic characters may be arbitrarily rotated by giving a list of values in therotate attribute. Absolute repositioning (including any adjustment due to thetext-anchor property) is done before relative repositioning and rotation.

11.7. Auto-wrapped text

Text is automatically wrapped when acontent area is specified in thetext element. Thecontent area defines the outermost container for wrapping text. Awrapping context (set of exclusion areas) may also be given. The actualwrapping area is defined by subtracting thewrapping context from thecontent area. Thewrapping context may also be reduced by the value of theshape-padding property. The effective area of an exclusion may be enlarged by the value of theshape-margin property.

In the case where thecontent area is defined by theinline-size property, thex andy attributes corresponding to the first renderedtypographic character define the initialcurrent text position. When thecontent area is inside ashape, the initialcurrent text position is determined from the position of the first renderedtypographic character after laying out the first line box inside the shape.

Except when used to determine the initialcurrent text position, all valuesx andy are ignored ontext, andtspan elements in auto-wrapped text.

The attributesx andy can provide a natural fallback mechanism for SVG1.1 renderers for wrapped text. Content producers may wish to pre-layout text by breaking up lines intotspan elements withx andy attributes. Then, for example, if a fallback font is used to render the text, an SVG2 renderer will ignore thex andy attributes and reflow the text using the font metrics of the fallback font. An SVG1.1 renderer will use thex andy attributes in rendering the text which will usually result in readable text even if the rendering doesn't match the shape. Many of the text wrapping examples in this section rely on this mechanism to render text in browsers that have not implemented text wrapping.

11.7.1. Notes on Text Wrapping

The following examples illustrate a few issues with laying out text in a shape.

11.7.1.1. First Line Positioning

Given an arbitrary shapedwrapping area, the firstline box may not fit flush against the top (or side for vertical text). In this case, the firstline box is shifted until it fits.

In CSS, the edge of a shape is treated as a series of 1 pixel × 1 pixel floats.

A future CSS specification may define a line grid that could be used to control the position of the first line of text to allow alignment of text between differentwrapping areas.

Image showing two lines of text, the first line is 'The' and              the next line is 'first line'.

The topline box (small light-blue rectangle), consisting of the smallest possible block of text, is moved down until theline box fits inside thewrapping area (light-blue path). Note, theline box includes the effect of theline-height property, here set to 1.25. The red rectangles tightly wrap the glyphs in eachline box.

This appears to be different from the SVG 1.2 draft in which the top of the wrapping area served as the origin of a line grid. The first line was moved down by the line height until it fit inside the shape.

11.7.1.2. Broken Lines

Given an arbitrary shapedwrapping area, a single line of text might be broken into more than one part. In this case, aline box for each part is created. The height of allline boxes in a single line of text must be the same (ensuring all parts have the same baseline). This height is calculated by looking at all glyphs in the line of text.

This default behavior was agreed to at the CSS/SVG joint working group meeting in Sydney 2016.

A future CSS specification may allow one to control which parts of a shape broken into different parts is filled (e.g, fill only the right most parts, fill only the left most parts, etc.).

Image showing text laidout inside a 'V' shape.

The top line is split into twoline boxes (light-blue rectangles), text in eachline box is centered inside the box (due to 'text-align:center').

11.8. Text on a path

SVG can place text along a path defined either by apath element or the path equivalent of abasic shape. This is specified by including text within atextPath element that has either anhref attribute with anURL reference pointing to apath element orbasic shape, or by specifying a value for thepath attribute that specifies the path data directly.

The ability to place text along a basic shape is new in SVG 2.

Placing text along a basic shape was resolved at theSydney (2015) meeting.

Directly using a 'd' attribute to specify the path was added to SVG 2. The 'd' attribute was renamed to 'path' by decision at theLondon (2016) editor's meeting at the same time 'd' was promoted to being a presentation attribute.

Text on a path is conceptionally like a single line ofpre-formatted text that is then transformed to follow the path. Except as indicated, all the properties that apply to pre-formatted text apply to text on a path.

11.8.1. The‘textPath’ element

textPath
Categories:
Graphics element,renderable element,text content element,text content child element
Content model:
Any number of the following elements or character data, in any order:a,animate,clipPath,marker,mask,script,set,style,tspan
Attributes:
DOM Interfaces:
SVG 2 Requirement:Have a more precise explanation of text path stretch methods.
Resolution:We will clarifymethod="stretch" on>'textPath' elements.
Purpose:Improve interoperability of the feature.
Owner:Cameron (no action)

Both thepath attribute and thehref attribute specify a path along which thetypographic characters will be rendered.

If both attributes are specified on atextPath element, the path that is used must follow the following order of precedence:

  1. path attribute
  2. href attribute
  3. xlink:href attribute

If thepath attribute contains an error, thehref attribute must be used.

11.8.2. Attributes

startOffset

An offset from the start of the path for the initial current text position, calculated using the user agent'sdistance along the path algorithm, after converting the path to thetextPath element's coordinate system.

If a<length> other than a percentage is given, then thestartOffset represents a distance along the path measured in the current user coordinate system for thetextPath element.

If a percentage is given, then thestartOffset represents a percentage distance along the entire path. Thus,startOffset="0%" indicates the start point of the path andstartOffset="100%" indicates the end point of the path.

Negative values and values larger than the path length(e.g. 150%) are allowed.

Limiting values to the range 0%-100% prevents easily creatingeffects like text moving along the path.

Anytypographic characters with mid-points thatare not on the path are not rendered.

Three paths with various values of 'startOffset' showing clipping  when glyphs are outside path region.

Rendering for different values of thestartOffset attribute. From top to bottom: default value, 50%, -50%.

The bottom path should show only "path." on the left side of the path. Chrome and Safari both do not handle offsets outside the range 0% to 100%. Chrome bug https://bugs.chromium.org/p/chromium/issues/detail?id=476554

For paths consisting of a singleclosed subpath(including an equivalent path for abasic shape),typographic characters are rendered alongone complete circuit of the path. The text is aligned as determined bythetext-anchor property to a position along the pathset by thestartOffset attribute. Forthestart(end) value, the text isrendered from the start (end) of the line until the initialposition along the path is reached again. For themiddle, the text is renderedfrom the middle point in both directions until a point on thepath equal distance in both directions from the initialposition on the path is reached.

Two circular path with different values of  'startOffset' showing that all glyphs are rendered.

Rendering for text on a path referencing acircle with different values of thestartOffset attribute. Left: 0. Right: 75% or -25%. The red circle marks the beginning of the path (after the canonical decomposition of the circle into a path).

Three circular path with different values of  'text-anchor' showing how glyphs are rendered.

Rendering for text on a path referencing acircle with different values of thetext-anchor attribute. Left: 'start'. Middle: 'middle'. Right: 'end'. The red circles marks the beginning of the path (after the canonical decomposition of the circle into a path). The blue square marks the reference point for the start of rendering (shifted from the path start by astartOffset value of 75%). The gray arrow(s) shows the direction oftypographic character placement and the point at whichtypographic character placement stops. The arrow(s) would be reversed if thedirection property has a value ofrtl.

Rendering all glyphs was agreed to for basic shapes at theSydney (2015) meeting (but missing in minutes). Limiting thewrapping to a path with a single closed sub-path and to oneloop, effected by the 'startOffset' attribute agreed to at theLondon (2016) Editor's Meeting.

Value
<length-percentage> |<number>
initial value
0
Animatable
yes
method

Indicates the method by which text should be rendered along the path.

A value ofalign indicates that thetypographic character should be rendered using simple 2×3 matrix transformations such that there is no stretching/warping of thetypographic characters. Typically, supplemental rotation, scaling and translation transformations are done for eachtypographic characters to be rendered. As a result, withalign, in fonts where thetypographic characters are designed to be connected (e.g., cursive fonts), the connections may not align properly when text is rendered along a path.

A value ofstretch indicates that thetypographic character outlines will be converted into paths, and then all end points and control points will be adjusted to be along the perpendicular vectors from the path, thereby stretching and possibly warping the glyphs. With this approach, connectedtypographic characters, such as in cursive scripts, will maintain their connections. (Non-vertical straight path segments should be converted to Bézier curves in such a way that horizontal straight paths have an (approximately) constant offset from the path along which thetypographic characters are rendered.)

English and Arabic text on arcs.

Rendering of text on a path for differentmethod values: Left: 'align'. Right: 'stretch'.

Value
align | stretch
initial value
align
Animatable
yes
spacing

Indicates how the user agent should determine the spacing betweentypographic characters that are to be rendered along a path.

A value ofexact indicates that thetypographic characters should be rendered exactly according to the spacing rules as specified inText on a path layout rules.

A value ofauto indicates that the user agent should use text-on-a-path layout algorithms to adjust the spacing betweentypographic characters in order to achieve visually appealing results.

Value
auto | exact
initial value
exact
Animatable
yes
side

Determines the side of the path the text is placed on(relative to the path direction). Specifying a valueofright effectively reversesthe path.

Two circular path with different values of 'side'  showing glyphs rendered outside the circle for  'left' and inside the circle for 'right'.

Rendering for text on a path referencing acircle with different values of theside attribute. Left:left. Right:right.

Added in SVG 2 to allow text either inside or outsideclosed subpaths andbasic shapes (e.g. rectangles,circles, and ellipses).

Adding 'side' was resolved at theSydney (2015) meeting.

Value
left | right
initial value
left
Animatable
yes
path

Apath data string describing the path onto which thetypographic characterswill be rendered. An empty string indicates that there is no path data for the element. This means that the text within thetextPath does not render or contribute to thebounding box of thetext element. If the attribute is not specified, the path specified withhref is used instead.

Value
path data
initial value
(none)
Animatable
yes
href

AnURL reference to thepath element orbasic shape element onto which the glyphs will be rendered, if nopath attribute is provided. If the attribute is used, and the <url> is an invalid reference (e.g., no such element exists, or the referenced element is not apath element) orbasic shape, then thetextPath element is in error and its entire contents shall not be rendered by the user agent.

Refer to the common handling defined forURL reference attributes anddeprecated XLink attributes.

Value
URL[URL]
initial value
See above.
Animatable
yes

The path data coordinates within the referencedpath element orbasic shape element are assumed to be in the same coordinate system as the currenttext element, not in the coordinate system where thepath element is defined. Thetransform attribute on the referencedpath element orbasic shape element represents a supplemental transformation relative to the current user coordinate system for the currenttext element, including any adjustments to the current user coordinate system due to a possibletransform property on the currenttext element. For example, the following fragment of SVG content:

<svg xmlns="http://www.w3.org/2000/svg">  <gtransform="translate(25,25)">    <defs>      <pathtransform="scale(2)" path="M0,10 L40,20 80,10" fill="none" stroke="red"/>    </defs>  </g>  <texttransform="rotate(45)">    <textPath href="#path1">Text on a path</textPath>  </text></svg>

should have the same effect as the following:

<svg xmlns="http://www.w3.org/2000/svg">  <gtransform="rotate(45)">    <defs>      <pathtransform="scale(2)" path="M0,10 L40,20 80,10" fill="none" stroke="red"/>    </defs>    <text>      <textPath href="#path1">Text on a path</textPath>    </text>  </g></svg>

and be equivalent to:

<svg xmlns="http://www.w3.org/2000/svg">  <texttransform="rotate(45)">    <textPathpath="M0,20 L80,40 160,20"            >Text on a path</textPath>  </text></svg>

Note that thetransform="translate(25,25)" has no effect on thetextPath element, whereas thetransform="rotate(45)" applies to both thetext and the use of thepath element as the referenced shape for text on a path. Further note that thetransform="scale(2)" scales the path (equivalent to multiplying every coordinate by 2 for simple linear paths), but does not scale the text placed along the path.

Example toap01 provides a simple example of text on a path:

<?xml version="1.0" standalone="no"?><svg width="12cm" height="3.6cm" viewBox="0 0 1000 300" version="1.1"     xmlns="http://www.w3.org/2000/svg">  <defs>    <path          d="M 100 200             C 200 100 300   0 400 100             C 500 200 600 300 700 200             C 800 100 900 100 900 100" />  </defs>  <desc>Example toap01 - simple text on a path</desc>  <use href="#MyPath" fill="none" stroke="red"  />  <text font-family="Verdana" font-size="42.5" fill="blue" >    <textPath href="#MyPath">      We go up, then we go down, then up again    </textPath>  </text>  <!-- Show outline of viewport using 'rect' element -->  <rect x="1" y="1" width="998" height="298"        fill="none" stroke="blue" stroke-width="2" /></svg>
Example toap01 — simple text on a path

Example toap01

View this example as SVG (SVG-enabled browsers only)

Example toap02 shows howtspan elements can be included withintextPath elements to adjust styling attributes and adjust the current text position before rendering a particular glyph. The first occurrence of the word "up" is filled with the color red. Attributedy is used to lift the word "up" from the baseline.

Thex,y,dx,dy, androtate attributes can only be specified ontext andtspan elements (but may effect the rendering of glyphs in text on a path — seetext on a path layout rules).

<?xml version="1.0" standalone="no"?><svg width="12cm" height="3.6cm" viewBox="0 0 1000 300" version="1.1"     xmlns="http://www.w3.org/2000/svg">  <defs>    <path          d="M 100 200             C 200 100 300   0 400 100             C 500 200 600 300 700 200             C 800 100 900 100 900 100" />  </defs>  <desc>Example toap02 - tspan within textPath</desc>  <use href="#MyPath" fill="none" stroke="red"  />  <text font-family="Verdana" font-size="42.5" fill="blue" >    <textPath href="#MyPath">      We go      <tspan dy="-30" fill="red" >        up      </tspan>      <tspan dy="30">        ,      </tspan>      then we go down, then up again    </textPath>  </text>  <!-- Show outline of viewport using 'rect' element -->  <rect x="1" y="1" width="998" height="298"        fill="none" stroke="blue" stroke-width="2" /></svg>
Example toap02 — tspan within textPath

Example toap02

View this example as SVG (SVG-enabled browsers only)

Example toap03 demonstrates the use of thestartOffset attribute on thetextPath element to specify the start position of the text string as a particular position along the path. Notice that glyphs that fall off the end of the path are not rendered (seetext on a path layout rules).

<?xml version="1.0" standalone="no"?><svg width="12cm" height="3.6cm" viewBox="0 0 1000 300" version="1.1"     xmlns="http://www.w3.org/2000/svg">  <defs>    <path          d="M 100 200             C 200 100 300   0 400 100             C 500 200 600 300 700 200             C 800 100 900 100 900 100" />  </defs>  <desc>Example toap03 - text on a path with startOffset attribute</desc>  <use href="#MyPath" fill="none" stroke="red"  />  <text font-family="Verdana" font-size="42.5" fill="blue" >    <textPath href="#MyPath" startOffset="80%">      We go up, then we go down, then up again    </textPath>  </text>  <!-- Show outline of viewport using 'rect' element -->  <rect x="1" y="1" width="998" height="298"        fill="none" stroke="blue" stroke-width="2" /></svg>
Example toap03 — text on a path with startOffset attribute

Example toap03

View this example as SVG (SVG-enabled browsers only)

11.8.3. Text on a path layout rules

Conceptually, for text on a path the target path is stretched out into either a horizontal or vertical straight line segment. For horizontal text layout flows, the path is stretched out into a hypothetical horizontal line segment such that the start of the path is mapped to the left of the line segment. For vertical text layout flows, the path is stretched out into a hypothetical vertical line segment such that the start of the path is mapped to the top of the line segment. The standardtext layout rules are applied to the hypothetical straight line segment and the result is mapped back onto the target path. Vertical and bidirectionaltext layout rules also apply to text on a path.

The orientation of each glyph along a path is determined individually. For horizontal text layout flows, the default orientation (theup direction) for a given glyph is along the vector that starts at the intersection point on the path to which the glyph is attached and which points in the direction 90 degrees counter-clockwise from the angle of the curve at the intersection point. For vertical text layout flows, the default orientation for a given glyph is along the vector that starts at the intersection point on the path to which the glyph is attached and which points in the direction 180 degrees from the angle of the curve at the intersection point.

Left, horizontal text with the character 'A' on a path.      Right, vertical text with the character '字' on a path.

Default glyph orientation along a path. Left, horizontal text. Right: vertical text.

Example toap04 will be used to illustrate the particular layout rules for text on a path that supplement the basictext layout rules for straight line horizontal or vertical text.

<?xml version="1.0" standalone="no"?><svg width="12cm" height="3.6cm" viewBox="0 0 1000 300" version="1.1"     xmlns="http://www.w3.org/2000/svg">  <defs>    <path          d="M 100 125             C 150 125 250 175 300 175             C 350 175 450 125 500 125             C 550 125 650 175 700 175             C 750 175 850 125 900 125" />  </defs>  <desc>Example toap04 - text on a path layout rules</desc>  <use href="#MyPath" fill="none" stroke="red"  />  <text font-family="Verdana" font-size="60" fill="blue" letter-spacing="2" >    <textPath href="#MyPath">      Choose shame or get war    </textPath>  </text>  <!-- Show outline of viewport using 'rect' element -->  <rect x="1" y="1" width="998" height="298"        fill="none" stroke="blue" stroke-width="2" /></svg>
Example toap04 — text on a path layout rules

Example toap04

View this example as SVG (SVG-enabled browsers only)

The following picture does an initial zoom in on the first glyph in thetext element.

Image that shows text    on a path

The small dot above shows the point at which the glyph is attached to the path. The box around the glyph shows the glyph is rotated such that its horizontal axis is parallel to the tangent of the curve at the point at which the glyph is attached to the path. The box also shows the glyph'scharwidth (i.e., the amount which the current text position advances horizontally when the glyph is drawn using horizontal text layout).

The next picture zooms in further to demonstrate the detailed layout rules.

Image that shows text on a path

For left-to-right horizontal text layout along a path (i.e., when the glyph orientation is perpendicular to theinline-base direction the layout rules are as follows:

Comparable rules are used for top-to-bottom vertical text layout along a path (i.e., when the glyph orientation is parallel with theinline-base direction, the layout rules are as follows:

In the calculations above, if either the startpoint-on-the-path or the endpoint-on-the-path is off the end of the path, then extend the path beyond its end points with a straight line that is parallel to the tangent at the path at its end point so that the midpoint-on-the-path can still be calculated.

When theinline-base direction is horizontal, then any‘x’ attributes ontext ortspan elements represent new absolute offsets along the path, thus providing explicit new values for startpoint-on-the-path. Any‘y’ attributes ontext ortspan elements are ignored. When theinline-base direction is vertical, then any‘y’ attributes ontext ortspan elements represent new absolute offsets along the path, thus providing explicit new values for startpoint-on-the-path. Any‘x’ attributes ontext ortspan elements are ignored.

After positioning all characters within thetextPath, thecurrent text position is set to the end point of the path, after adjusting for thestartOffset in the case of paths that are a single closed loop. In other words, text that follows atextPath element (but is still inside atext element) that does not have explicit positioning information (x andy attributes) is positioned from the end of the path.

Text on a path showing the starting point for      rendering text after the <textPath> element.

The starting point for text after thetextPath element without explicit positioning information is at the end of the path (red dot).

The choice of the end of the path over the position of the last character was chosen as it is more author predictable (not depending on font, etc.) Decided at theLondon (2016) editor's meeting. See alsoGitHub Issue 84.

11.9. Text rendering order

Atext element is rendered in one or more chunks.Each chunk (as produced by thetext layout algorithm)is rendered, one after the other, in document order. Eachrendered chunk, which consists of one or more glyphs,is filled and stroked as if it were a single path.

This means that all glyphs in the chunk should be filled, then all glyphs stroked at once, or the reverse according to the value of thepaint-order property.

For the purposes of painting, atext has zero, one, or moreequivalent paths, one for each chunk. Each equivalent pathconsists of one subpath per glyph within that chunk.

Since thefill-rule property does not applyto SVG text elements, the specific order of the subpaths withintheequivalent path does not matter.

The specific position of the start of each subpath, and the directionthat the path progresses around glyph shape, is not defined.However, user agents should be consistent for a given font and glyph.

This means that dashed strokes on text may not placethe dash pattern at the same positions across different implementations.

11.10. Properties and pseudo-elements

CSS offers a multitude of properties for styling text. In general, only two sets of properties are applicable to SVG: those that determine which glyphs are to be rendered (font-family,font-style, etc.) and those that apply at theparagraph level (direction,writing-mode,line-height,letter-spacing, etc.).

The list of CSS properties that must be supported on SVG text elements can be found in theStyling chapter.

Additionally, the @font-face rule must be supported for font selection as well as the ::first-line and ::first-letter pseudo-elements must be supported ontext elements. In interactive modes, the ::selection pseudo-element must also be supported.

Other CSS properties that affect text layout and rendering may also be supported by an SVG user agent; their effect should be taken into account as part of the CSS text layout step of the overall SVG text layout process.

For example, while SVG 2 does not require support for thetext-combine-upright property, its behavior in an SVG context should be obvious.

A number of CSS properties must not have any effect on SVG text elements:

Additionally, the ::before and ::after generated content pseudo-elements must not apply to SVG text elements.

A future specification may introduce support for the ::before and ::after generated content pseudo-elements; authors should not rely on them being ignored.

11.10.1. SVG properties

This section covers properties that are not covered elsewhere in this specification and that are specific to SVG.

11.10.1.1. Text alignment, the ‘text-anchor’ property

Thetext-anchor property is used to align (start-, middle- or end-alignment) a string ofpre-formatted text orauto-wrapped text where thewrapping area is determined from theinline-size property relative to a given point. It is not applicable to other types ofauto-wrapped text, see insteadtext-align. For multi-line text, the alignment takes place for each line.

Thetext-anchor property is applied to each individualtext chunk within a giventext element. Each text chunk has an initialcurrent text position, which represents the point in the user coordinate system resulting from (depending on context) application of thex andy attributes on thetext element, anyx ory attribute values on atspan element assigned explicitly to the first rendered character in a text chunk, or determination of the initial current text position for atextPath element. Each text chunk also has a finalcurrent text position which is thecurrent text position after placing the last glyph in thetext chunk. The positions are determined before applying thetext-anchor property.

Name:text-anchor
Value:start | middle | end
Initial:start
Applies to:text content elements
Inherited:yes
Percentages:N/A
Media:visual
Computed value:as specified
Animatable:yes

Values have the following meanings:

start
The rendered characters are aligned such that the start of the resulting rendered text is at the initial current text position. For an element with adirection property value of"ltr" (typical for most European languages), the left side of the text is rendered at the initial text position. For an element with adirection property value of"rtl" (typical for Arabic and Hebrew), the right side of the text is rendered at the initial text position. For an element with a vertical primary text direction (often typical for Asian text), the top side of the text is rendered at the initial text position.
middle
The rendered characters are shifted such that the geometric middle of the resulting rendered text (determined from the initial and finalcurrent text position before applying thetext-anchor property) is at the initial current text position.
end
The rendered characters are shifted such that the end of the resulting rendered text (finalcurrent text position before applying thetext-anchor property) is at the initial current text position. For an element with adirection property value of"ltr" (typical for most European languages), the right side of the text is rendered at the initial text position. For an element with adirection property value of"rtl" (typical for Arabic and Hebrew), the left side of the text is rendered at the initial text position. For an element with a vertical primary text direction (often typical for Asian text), the bottom of the text is rendered at the initial text position.

An example of usingtext-anchor on multi-line text.

<svg xmlns="http://www.w3.org/2000/svg"     width="300" height="100" viewBox="0 0 300 100">  <text x="150" y="30">    This multi-line text is    anchored to the middle.</text></svg>
Image showing two lines of text centered via text-anchor.

The preserved line-feed creates twotext chunks, eachanchored independently.

Another example of usingtext-anchor on multi-line text.

<svg xmlns="http://www.w3.org/2000/svg"     width="200" height="150" viewBox="0 0 200 150">  <path d="m 100,0 0,150"/>  <text x="100 100 100" y="50 95 140"style="font-size: 42px; text-anchor: middle">I❤SVG</text></svg>
Image showing three lines of text divided as 'I', '❤', 'SVG'.

The text is divided into threetext chunks (due to thethree coordinates in thex andyattributes). Eachtext chunk is independently anchored.

11.10.1.2. The ‘glyph-orientation-horizontal’ property

This property has been removed in SVG 2.

11.10.1.3. The ‘glyph-orientation-vertical’ property

This property applies only to vertical text. It has been obsoleted in SVG 2 and partially replaced by thetext-orientation property of CSS Writing Modes Level 3. The following SVG 1.1 values must still be supported by aliasing the property as a shorthand totext-orientation as follows:

Any other values must be treated as invalid.

11.10.1.4. The ‘kerning’ property

The ‘kerning’ property has been removed in SVG 2.

SVG 1.1 uses the 'kerning' property to determine if the font kerning tables should be used to adjust inter-glyph spacing. It also allows a<length> value which if given is added to the spacing between glyphs (supplemental to any from theletter-spacing property). This property is replaced in SVG 2 by the CSSfont-kerning property which solely controls turning on/off the use of the font kerning tables.

Chrome's UseCounter data showed a use of 0.01% in 2014. See GitHub issue 80.

11.10.2. SVG adaptions

This section covers CSS properties that are not covered elsewhere in this specification and have either SVG specific adaptions or are significantly altered from SVG 1.1.

SVG 2 Requirement:Reference CSS3 Fonts.
Resolution:SVG 2 will depend on CSS3 Fonts.
Purpose:Alignment with CSS 2.1 and CSS3 for Web font functionality, and to provide access to advanced typographic features of fonts.
Owner:Chris (ACTION-3123)

11.10.2.1. The ‘font-variant’ property

CSS Font Module Level 3 changes the meaning of the'font-variant' property from that defined by CSS 2.1. It has been repurposed (and its functionality greatly expanded) as a shorthand for selecting font variants from within a single font.

SVG 2 requires allfont-variant subproperties to be implemented (e.g.font-variant-ligatures).

11.10.2.2. The ‘line-height’ property

SVG uses theline-height property to determine the amount of leading space which is added between lines in multi-line text (both for horizontal and vertical text). It is not applicable to text on a path.

Except for the additional information provided here, thenormative definition of theline-height property is in the CSS 2.1 specification ([CSS2]).

TheCSS Inline Module Level 3 may update the definition of 'line-height'.

11.10.2.3. The ‘writing-mode’ property

This property sets theblock-flow direction; or in-other-words, the direction in which lines of text are stacked. As a consequence it also determines if the text has a horizontal or vertical orientation.

SVG 2 referencesCSS Writing Modes Level 3 for the definition of the'writing-mode' property. That specification introduces new values for the property. The SVG 1.1 values are obsolete but must still be supported by converting the specified values to computed values as follows:

In SVG 1.0, this property could be interpreted as to also setting theinline-base direction leading to confusion about its role relative to thedirection property. SVG 1.1 was a bit more specific about the role ofdirection (e.g. thatdirection set the reference point for thetext-anchor property) but still was open to interpretation. The fact that neither SVG 1.0 nor SVG 1.1 allowed multi-line text added to the confusion.

Except for the additional information provided here, thenormative definition of thewriting-mode property is in CSS Writing Modes Level 3 ([css-writing-modes-3]).

11.10.2.4. The ‘direction’ property

The property specifies theinline-base direction of atext ortspan element. It defines thestart andend points of a line of text as used by thetext-anchor andinline-size properties. It also may affect the direction in which characters are positioned if theunicode-bidi property's value is eitherembed orbidi-override.

Thedirection property applies only to glyphs oriented perpendicular to theinline-base direction, which includes the usual case of horizontally-oriented Latin or Arabic text and the case of narrow-cell Latin or Arabic characters rotated 90 degrees clockwise relative to a top-to-bottominline-base direction.

Reviewers, please take special care to ensure this agrees with CSS3 Writing modes.

Except for the additional information provided here, thenormative definition of thedirection property is in CSS Writing Modes Level 3 ([css-writing-modes-3]).

In many cases, the bidirectional algorithm from Unicode [UNICODE] produces the desired result automatically, and in such cases the author does not need to use these properties. For other cases, such as when using right-to-left languages, it may be sufficient to add thedirection property to theoutermost svg element, and allow that direction to inherit to all text elements, as in the following example (which may be used as a template):

<svg xmlns="http://www.w3.org/2000/svg"     width="100%" height="100%" viewBox="0 0 600 72"     direction="rtl" xml:lang="fa">  <title direction="ltr" xml:lang="en">Right-to-left Text</title>  <desc direction="ltr" xml:lang="en">    A simple example for using the 'direction' property in documents    that predominantly use right-to-left languages.  </desc>  <text x="300" y="50" text-anchor="middle" font-size="36">داستان SVG 1.1 SE طولا ني است.</text></svg>
Example

Example

View this example as SVG (SVG-enabled browsers only)

Below is another example, where where implicit bidi reordering is not sufficient:

<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg"     width="100%" height="100%" viewBox="0 0 600 72"     direction="rtl" xml:lang="he">  <title direction="ltr" xml:lang="en">Right-to-left Text</title>  <desc direction="ltr" xml:lang="en">    An example for using the 'direction' and 'unicode-bidi' properties    in documents that predominantly use right-to-left languages.  </desc>  <text x="300" y="50" text-anchor="middle" font-size="36"> כתובת MAC:&#x200F;    <tspan direction="ltr" unicode-bidi="embed">00-24-AF-2A-55-FC</tspan>  </text></svg>
Example

Example

View this example as SVG (SVG-enabled browsers only)

11.10.2.5. The ‘dominant-baseline’ property

This property is defined in the CSS Line Layout Module 3 specification. See'dominant-baseline'. [css-inline-3]

SVG 2 introduces some changes to the definition of this property. In particular:

SVG uses the value of thedominant-baseline property to align glyphs relative to thex andy attributes. For thetext-orientation valuesideways, theauto value fordominant-baseline isalphabetic; however, for backwards compatibility, the glyphs should be aligned to thex andy attributes using the valuecentral.

We are interested in any actual use where one would prefer the old behavior.

11.10.2.6. The ‘alignment-baseline’ property

This property is defined in the CSS Line Layout Module 3 specification. See'alignment-baseline'. [css-inline-3]

Thevertical-align property shorthand should be preferred in new content.

SVG 2 introduces some changes to the definition of this property. In particular: the values 'auto', 'before-edge', and 'after-edge' have been removed. For backwards compatibility, 'text-before-edge' should be mapped to 'text-top' and 'text-after-edge' should be mapped to 'text-bottom'. Neither 'text-before-edge' nor 'text-after-edge' should be used with thevertical-align property.

11.10.2.7. The ‘baseline-shift’ property

This property is defined in the CSS Line Layout Module 3 specification. See'baseline-shift'. [css-inline-3]

Thevertical-align property shorthand should be preferred in new content.

The SVG 1.1 initial value 'baseline' has been removed from SVG 2. User agentsmay support this value as computing to '0' if necessary to support legacy SVG content.

The 'baseline' value was removed with the conversion of 'vertical-align' to a shorthand for 'alignment-baseline' and 'baseline-shift' as it is also a value for 'alignment-baseline' and it is redundant with a length value of '0'.

SVG 2 Requirement:Align with CSS for baseline alignment functionality.
Resolution:SVG 2 will deprecate ‘baseline-shift’ and use ‘vertical-align’ instead.
Purpose:To align with CSS.
Owner:Cameron (ACTION-3281)

'baseline-shift' is important for aligning subscripts and superscripts (Inkscape relies on it for this purpose). It remains in the CSS Inline Layout Module Level 3.'vertical-align' is a shorthand for changing multiple properties at once, including 'baseline-shift'.

11.10.2.8. The ‘letter-spacing’ property

SVG 2 removes percentage values from theletter-spacing property.

Except as noted, see CSS Text Level 3 for the definition of theletter-spacing.([css-text-3]).

Percentage values based on the SVG viewport are not seen as useful. This brings the definition of 'letter-spacing' in line with CSS.

11.10.2.9. The ‘word-spacing’ property

SVG 2 changes the meaning of percentage values for theword-spacing property. In SVG 1.1, percentages define additional spacing as a percentage of theSVG viewport size. In SVG 2, following CSS Text Level 3, percentages define additional spacing as a percentage of the affected character's width.

Except as noted, see CSS Text Level 3 for the definition of theword-spacing.([css-text-3]).

Percentage values based on the SVG viewport are not seen as useful. This brings the definition of 'word-spacing' in line with CSS.

11.10.2.10. The ‘text-overflow’ property

SVG 2 Requirement:Addtext-overflow functionality.
Resolution:We will add text-overflow in SVG 2.
Purpose:To align with CSS, allow indicating that not all text is shown.
Owner:Erik (ACTION-3003)

New in SVG 2. Added to allow user agents to handle text strings that overflow a predefined wrapping area in a more useful way. Aligns SVG and HTML/CSS text processing.

See the CSS3 UI specification for the definition of'text-overflow'. [css-ui-3]

SVG uses thetext-overflow property to control howtext content block elements render when text overflowsline boxes as, for example, can happen when thewhite-space property has the valuenowrap. The property does not apply to pre-formatted text or text-on-a-path.

In SVGtext-overflow has an effect if there is a validly specifiedwrapping area, regardless of the computed value of theoverflow property on thetext content block element.

If thetext-overflow property has the valueellipsis then if the text that is to be rendered overflows thewrapping area an ellipsis is rendered such that it fits within the given area. For the purposes of rendering, the ellipsis is treated as if it replaced the characters at the point where it is inserted.

If thetext-overflow property has the valueclip then any text that overflows thewrapping area is clipped. Characters may be partially rendered.

Any other value fortext-overflow is treated as if it wasn't specified.

Note that the effect oftext-overflow is purely visual, the ellipsis itself does not become part of the DOM. For all the DOM methods it is as iftext-overflow was not applied, and as if thewrapping area did not constrain the text.

The following example shows the use oftext-overflow. The top line shows text as it would normally be rendered (text overflows due towhite-space valuepre and is displayed due tooverflow valuevisible). The middle line shows text withtext-overflow valueclip, and the bottom line shows text withtext-overflow valueellipsis.

<svg xmlns="http://www.w3.org/2000/svg"     width="300" height="150" viewBox="0 0 300 150">  <style>    text { font: 25px sans-serif; white-space: pre; }    path { fill: none; stroke: #add8e6; }  </style>  <path d="m  50,0 0,150"/>  <path d="m 200,0 0,150"/>  <text x="50" y="35"  inline-size="100">SVG is awesome</text>  <text x="50" y="85"  inline-size="100">SVG is awesome</text>  <text x="50" y="135" inline-size="100">SVG is awesome</text></svg>
Image showing the use of the text-overflow property.

Thetext-overflow property used on text elements, the bottom line showing text with an ellipsis applied.

It has been argued that this property is useless. It would be of more use if coupled with a mechanism that would expose the hidden text (tool-tip on hovering over ellipses?). The text-overflow property only deals with text that overflows off the end of a line. It does not deal with text that overflows the off the end of the wrapping area.

11.10.3. White space

New in SVG 2. Addedwhite-space to allow a more useful way to control white-space handling. Aligns SVG and HTML/CSS text processing.xml:space deprecated in new content, retained for backwards compatibility.

11.10.3.1. SVG 2 Preferred white space handling, the ‘white-space’ property

Rendering of white space in SVG 2 is controlled by thewhite-space property. This specifies two things:

Values and their meanings are defined inCSS Text Module Level 3.[css-text-3]

An example of using thewhite-space valuepre-line.

<svg xmlns="http://www.w3.org/2000/svg">     width="200" height="200" viewBox="0 0 200 200">     <text x="150" y="30">       千利奴流乎和加       餘多連曽津祢那       良牟有為能於久       耶万計不己衣天       阿佐伎喩女美之       恵比毛勢須</text></svg>
Japanese poem showing traditional line-breaking after every seven kanji.

Example of multi-line vertical text with line breaks. The textis from the Japanese poemIroha. The lines are brokenat traditional places.

11.10.3.2. Legacy white-space handling, the ‘xml:space’ property

For compatibility, SVG 2 also supports the XML attributexml:space to specify the handling of white space characters within a giventext element's character data. New content should not usexml:space but instead, use thewhite-space property.

This section should be simplified to limit the discussion of xml:space and instead define it in the user agent style sheet using thewhite-space property. TheCSS Text 4 specification'spreserve-spaces value for the'white-space-collapse' property is intended to matchxml:space=preserve. (fantasai agreed to add an appropriate value forwhite-space to match SVG 1.1's odd xml:space="preserve" behavior.)

Note that any child element of atext element may also have anxml:space attribute which will apply to that child element's text content. The SVG user agent has special processing rules associated with this attribute as described below. These are behaviors that occur subsequent to XML parsing [XML] and any construction of a DOM.

xml:space is an inheritable attribute which can have one of two values:

'default'
(The initial/default value forxml:space.) Whenxml:space="default", the SVG user agent will do the following using a copy of the original character data content. First, it will remove all newline characters. Then it will convert all tab characters into space characters. Then, it will strip off all leading and trailing space characters. Then, all contiguous space characters will be consolidated.
'preserve'
Whenxml:space="preserve", the SVG user agent will do the following using a copy of the original character data content. It will convert all newline and tab characters into space characters. Then, it will draw all space characters, including leading, trailing and multiple contiguous space characters. Thus, when drawn withxml:space="preserve", the string"a   b" (three spaces between "a" and "b") will produce a larger separation between "a" and "b" than"a b" (one space between "a" and "b").

The following example illustrates that line indentation can be important when usingxml:space="default". The fragment below show two pairs of similartext elements, with bothtext elements usingxml:space="default". For these examples, there is no extra white space at the end of any of the lines (i.e., the line break occurs immediately after the last visible character).

[01]  <text xml:space='default'>[02]    WS example[03]    indented lines[04]  </text>[05]  <text xml:space='preserve'>WS example indented lines</text>[06][07]  <text xml:space='default'>[08]WS example[09]non-indented lines[10]  </text>[11]  <text xml:space='preserve'>WS examplenon-indented lines</text>

The first pair oftext elements above show the effect of indented character data. The attributexml:space="default" in the firsttext element instructs the user agent to:

The second pair oftext elements above show the effect of non-indented character data. The attributexml:space="default" in the thirdtext element instructs the user agent to:

Note that XML parsers are required to convert the standard representations for a newline indicator (e.g., the literal two-character sequence "U+000D U+000A", CARRIAGE-RETURN LINE-FEED or the stand-alone literals U+000D or U+000A) into the single character U+000A before passing character data to the application. Thus, each newline in SVG will be represented by the single character U+000A, no matter what representation for newlines might have been used in the original resource. (SeeXML end-of-line handling.)

Any features in the SVG language or the SVG DOM that are based on character position number, such as thex,y,dx,dy androtate attributes on thetext andtspan elements, are based on character position after applying the white space handling rules described here. In particular, ifxml:space="default", it is often the case that white space characters are removed as part of processing. Character position numbers index into the text string after the white space characters have been removed per the rules in this section.

Note that a glyph corresponding to a white-space character should only be displayed as a visible but blank space, even if the glyph itself happens to be non-blank. Seedisplay of unsupported characters [UNICODE].

Thexml:space attribute is:

    Animatable: no.

11.10.3.3. Duplicate white-space directives

Older, SVG 1.1 content will usexml:space. New content, and older content that is being reworked, will usewhite-space and remove any existingxml:space. However, user agents may come across content which uses both methods on the same element. If thewhite-space property is set on any element, then the value ofxml:space is ignored.

11.11. Text decoration

Text in SVG can bedecorated with an underline, overline, and/or strike-through. The position and style of the decoration is determined respectively by thetext-decoration-line andtext-decoration-style properties, or by thetext-decoration shorthand property as defined in theLine Decoration section of theCSS Text Decoration Module Level 3 [(css-text-decor-3)] specification. The fill and stroke of the decoration are given by thetext-decoration-fill andtext-decoration-stroke properties. If a color value is specified either by thetext-decoration-color property or by thetext-decoration shorthand, and notext-decoration-fill property is specified, it is interpreted as if thetext-decoration-fill property were specified with that color value.

If the fill or stroke of the text decoration are not explicitly specified (viatext-decoration,text-decoration-color,text-decoration-fill, ortext-decoration-stroke), they are given by the fill and stroke of the text at the point where the text decoration is declared (see example below).

Thetext-decoration-line andtext-decoration-style properties are new in SVG 2. The SVG 1.1/CSS 2.1text-decoration property is transformed in a backwards compatible way to a short hand for these properties.text-decoration-fill andtext-decoration-stroke are SVG specific properties which may be added to a future level of the CSS Text Decoration specification.

The order in which the text and decorations are drawn is defined by thePainting Order of Text Decorations section ofCSS Text Decoration Module Level 3. The paint order of the text decoration itself (fill/stroke) is determined by the value of thepaint-order property at the point where the text decoration is declared.

Example textdecoration01 provides examples fortext-decoration. The first line of text has no value fortext-decoration, so the initial value oftext-decoration:none is used. The second line showstext-decoration:line-through. The third line showstext-decoration:underline. The fourth line illustrates the rule whereby decorations are rendered using the same fill and stroke properties as are present on the element for which thetext-decoration is specified. Sincetext-decoration is specified on thetext element, all text within thetext element has its underline rendered with the same fill and stroke properties as exist on thetext element (i.e., blue fill, red stroke), even though the various words have different fill and stroke property values. However, the word "different" explicitly specifies a value fortext-decoration; thus, its underline is rendered using the fill and stroke properties as thetspan element that surrounds the word "different" (i.e., yellow fill, darkgreen stroke):

<?xml version="1.0" standalone="no"?><svg width="12cm" height="4cm" viewBox="0 0 1200 400"     xmlns="http://www.w3.org/2000/svg" version="1.1">  <desc>Example textdecoration01 - behavior of 'text-decoration' property</desc>  <rect x="1" y="1" width="1198" height="398" fill="none" stroke="blue" stroke-width="2" />  <g font-size="60" fill="blue" stroke="red" stroke-width="1" >    <text x="100" y="75">Normal text</text>    <text x="100" y="165" text-decoration="line-through" >Text with line-through</text>    <text x="100" y="255" text-decoration="underline" >Underlined text</text>    <text x="100" y="345" text-decoration="underline" >      <tspan>One </tspan>      <tspan fill="yellow" stroke="purple" >word </tspan>      <tspan fill="yellow" stroke="black" >has </tspan>      <tspan fill="yellow" stroke="darkgreen" text-decoration="underline" >different </tspan>      <tspan fill="yellow" stroke="blue" >underlining</tspan>    </text>  </g></svg>
Example textdecoration01 — behavior of 'text-decoration' property

Example textdecoration01

View this example as SVG (SVG-enabled browsers only)

11.11.1. The ‘text-decoration-fill’ and ‘text-decoration-stroke’ properties

The CSS working group agreed to the SVG specification of the 'text-decoration-fill' and 'text-decoration-stroke' properties at the joint CSS/SVG 2014 TPAC meeting. They again endorsed the use of these properties at the joint 2015 Sydney meeting. They expressed their intention to extend CSS text decoration to include these properties at the same time they allow 'fill' and 'stroke' properties on text.

Name:text-decoration-fill
Value:<paint>
Initial:See prose.
Applies to:text content elements
Inherited:See prose.
Percentages:N/A
Media:visual
Computed value:as specified, but with<color> values computed and<url> values made absolute.
Animatable:yes
Name:text-decoration-stroke
Value:<paint>
Initial:See prose.
Applies to:text content elements
Inherited:See prose.
Percentages:N/A
Media:visual
Computed value:as specified, but with<color> values computed and<url> values made absolute.
Animatable:yes

11.12. Text selection and clipboard operations

Conforming SVG viewers on systems which have the capacity for text selection (e.g., systems which are equipped with a pointer device such as a mouse) and which have system clipboards for copy/paste operations are required to support:

A text selection operation starts when all of the following occur:

As the text selection operation proceeds (e.g., the user continues to press the given mouse button), all associated events with other graphics elements are ignored (i.e., the text selection operation is modal) and the SVG user agent shall dynamically indicate which characters are selected by applying styles for the::selection pseudo-class. As the pointer is moved during the text selection process, the end glyph for the text selection operation is the glyph within the sametext element whose glyph cell is closest to the pointer. All characters within thetext element whose position within thetext element is between the start of selection and end of selection shall be highlighted, regardless of position on the canvas and regardless of any graphics elements that might be above the end of selection point.

Once the text selection operation ends (e.g., the user releases the given mouse button), the selected text will stay highlighted until an event occurs which cancels text selection, such as a pointer device activation event (e.g., pressing a mouse button).

Detailed rules for determining which characters to highlight during a text selection operation are provided inText selection implementation notes.

For systems which have system clipboards, the SVG user agent is required to provide a user interface for initiating a copy of the currently selected text to the system clipboard. It is sufficient for the SVG user agent to post the selected text string in the system's appropriate clipboard format for plain text, but it is preferable if the SVG user agent also posts a rich text alternative which captures the various font properties associated with the given text string.

For bidirectional text, the user agent must support text selection in logical order, which will result in discontinuous highlighting of glyphs due to the bidirectional reordering of characters. User agents can provide an alternative ability to select bidirectional text in visual rendering order (i.e., after bidirectional text layout algorithms have been applied), with the result that selected character data might be discontinuous logically. In this case, if the user requests that bidirectional text be copied to the clipboard, then the user agent is required to make appropriate adjustments to copy only the visually selected characters to the clipboard.

SVG authors andSVG generators should order their text strings to facilitate properly ordered text selection within SVG viewing applications such as Web browsers; in other words, the DOM order of the text should match the natural reading order of the text.

11.12.1. Text selection implementation notes

The following implementation notes describe the algorithmfor deciding which characters are selected during atext selectionoperation.

As the text selection operation occurs (e.g., while the userclicks and drags the mouse to identify the selection), the useragent determines astart selection position and anend selection position, each of which represents aposition in the text string between two characters. Afterdetermining start selection position and end selectionposition, the user agent selects the appropriate characters,where the resulting text selection consists of either:

On systems with pointer devices, to determine thestartselection position, the SVG user agent determines whichboundary between characters corresponding to rendered glyphs isthe best target (e.g., closest) based on the current pointerlocation at the time of the event that initiates the selectionoperation (e.g., the mouse down event). The user agent thentracks the completion of the selection operation (e.g., themouse drag, followed ultimately by the mouse up). At the end ofthe selection operation, the user agent determines whichboundary between characters is the best target (e.g., closest)for theend selection position.

If no character reordering has occurred due to bidirectionality,then the selection consists of all characters between thestart selection position andend selectionposition. For example, if atext element contains thestring "abcdef" and the start selection position and endselection positions are 0 and 3 respectively (assuming the leftside of the "a" is position zero), then the selection willconsist of "abc".

When the user agent is implementing selection ofbidirectional text, and when the selection starts (or ends)between characters which are not contiguous in logical order,then there might be multiple potential combinations ofcharacters that can be considered part of the selection. Thealgorithms to choose among the combinations of potentialselection options shall choose the selection option which mostclosely matches the text string's visual rendering order.

When multiple characters map inseparably to a given set ofone or more glyphs, the user agent can either disallow theselection to start in the middle of the glyph set or canattempt to allocate portions of the area taken up by the glyphset to the characters that correspond to the glyph.

For systems which support pointer devices such as a mouse,the user agent is required to provide a mechanism for selectingtext even when the given text has associated event handlers orlinks, which might block text selection due to event processingprecedence rules (seePointer events).One implementation option: For platforms which support a pointerdevice such as a mouse, the user agent may provide for a smalladditional region around character cells which initiates textselection operations but does not initiate event handlers orlinks.

11.13. DOM interfaces

SVG 2 Requirement:Have a DOM method to convert atext element to outline path data.
Resolution:We will add a DOM method to convert a‘text’ element to outline path data, possibly moving the functionality to the FXTF.
Purpose:To allow manipulation of text as a path.
Owner:Cameron (ACTION-3076)
Status:Future wish list

11.13.1. Interface SVGTextContentElement

TheSVGTextContentElement interface is implemented by elementsthat support rendering child text content.

For the methods on this interface that refer to an index to acharacter or a number of characters, these references are to beinterpreted as an index to a UTF-16 code unit or a number ofUTF-16 code units, respectively. This is for consistency with DOMLevel 2 Core, where methods on theCharacterData interfaceuse UTF-16 code units as indexes and counts within the characterdata. Thus for example, if the text content of atextelement is a single non-BMP character, such as U+10000, theninvokinggetNumberOfChars on thatelement will return 2 since there are two UTF-16 code units (thesurrogate pair) used to represent that one character.

[Exposed=Window]interfaceSVGTextContentElement :SVGGraphicsElement {  // lengthAdjust Types  const unsigned shortLENGTHADJUST_UNKNOWN = 0;  const unsigned shortLENGTHADJUST_SPACING = 1;  const unsigned shortLENGTHADJUST_SPACINGANDGLYPHS = 2;  [SameObject] readonly attributeSVGAnimatedLengthtextLength;  [SameObject] readonly attributeSVGAnimatedEnumerationlengthAdjust;  longgetNumberOfChars();  floatgetComputedTextLength();  floatgetSubStringLength(unsigned long charnum, unsigned long nchars);DOMPointgetStartPositionOfChar(unsigned long charnum);DOMPointgetEndPositionOfChar(unsigned long charnum);DOMRectgetExtentOfChar(unsigned long charnum);  floatgetRotationOfChar(unsigned long charnum);  longgetCharNumAtPosition(optionalDOMPointInit point);  voidselectSubString(unsigned long charnum, unsigned long nchars);};

The numeric length adjustment type constants defined onSVGTextContentElementare used to represent the keyword values that thelengthAdjust attributecan take. Their meanings are as follows:

ConstantMeaning
LENGTHADJUST_SPACINGThespacing keyword.
LENGTHADJUST_SPACINGANDGLYPHSThespacingAndGlyphs keyword.
LENGTHADJUST_UNKNOWNSome other value.

ThetextLength IDL attributereflects thetextLength content attribute.

The initial value of thetextLength content attributeis defined to equal the user-agent's calculated length for the element.In other words, when the content attribute is not present,the IDL property is initialized with a base length equal tothe return-value ofgetComputedTextLengthon the same element, as a length in user units.

ThelengthAdjust IDL attributereflects thelengthAdjust content attribute. Thenumeric type valuesforlengthAdjust are as described above in the numeric length adjust typeconstant table.

ThegetNumberOfCharsmethod returns the total number ofaddressable characters available forrendering within the current element, regardless of whether they will be rendered.When getNumberOfChars() is called, the following steps are run:

  1. Letnode be the element or node upon which this method was called
  2. Ifnode is a DOM text node, return the length of the text content ofnode, after normalizing whitespace according to the value of thewhite-space property on its parent element.
  3. Ifnode is anElement:
    • If the element isnot rendered (e.g., because thedisplay property has the used valuenone), then return 0;
    • Otherwise, setcount to 0, and for each child ofnode:
      • Recursively call this algorithm and add the returned value tocount.
      Returncount.
  4. For all other node types (e.g., DOM comments), return 0.

ThegetComputedTextLengthmethod is used to compute a "length" for the text within the element.When getComputedTextLength() is called, the following steps are run:

  1. Letcount be the value that would be returned if thegetNumberOfChars method were called on this element.
  2. Letlength be the value that would be returned if thegetSubStringLength method were called on this element, passing 0 andcount as arguments.
  3. Returnlength.

ThegetSubStringLengthmethod is used to compute the formatted text advance distance for a substring of text within theelement. When getSubStringLength(charnum,nchars)is called, the following steps are run:

  1. Assign an index to eachaddressable character in the DOM within this element, where the first character has index 0.
  2. Ifcharnum is greater than the highest index assigned to a character or ifnchars is negative, thenthrow anIndexSizeError.
  3. Letlength be a length in user units, initialized to 0.
  4. For eachaddressable character in the DOM within this element that has an index such thatcharnum ≤ index < (charnum +nchars):
    1. If the character corresponds to atypographic character and it is the first character in document order to correspond to thattypographic character, then:
      1. Add the advance of thetypographic character tolength, adjusted for any font kerning in effect.
      2. If theletter-spacing orword-spacing properties contributed space just after thetypographic character, then add that space tolength.

      This means that, for example, if there is a ligature that is only partly included in the substring, then the advance of thetypographic character and any subsequentletter-spacing orword-spacing space will be assigned to the first character's text length.

  5. Returnlength.

Previous versions of SVG required that this method andgetComputedTextLength also include positioning adjustments in the inline direction due todx ordy on child elements, so that the returned value would be equivalent to the user agent's calculation fortextLength. However, it was poorly specified, poorly implemented, and of dubious benefit, so has been simplified to match implementations.

Change to text length methodsresolved at August 2015 Paris face-to-face.

Tofind the typographiccharacter for a character at indexindex within anelementelement, the following steps are run:

  1. Assign an index to eachaddressable character in the DOM within this element, where the first character has index 0.
  2. Letlast be the highest index assigned to a character.
  3. Whilecharnum <last and the character at indexcharnum does not correspond to atypographic character:
    1. Setcharnum tocharnum + 1.
  4. Ifcharnum is greater than the highest index assigned to a character or, then return null.
  5. Otherwise, return thetypographic character that corresponds tocharnum.

ThegetStartPositionOfCharmethod is used to get the position of atypographic character after textlayout has been performed. When getStartPositionOfChar(charnum) iscalled, the following steps are run:

  1. Letcluster be the result offinding the typographic character for the character at indexcharnum within the current element.
  2. Ifcluster is null, thenthrow anIndexSizeError.
  3. Letp be thealignment point of thetypographic character that correspond to the character at indexcharnum, in the coordinate system of the current element.
  4. Return a newly created,detachedDOMPoint object representing the pointp.

ThegetEndPositionOfCharmethod is used to get the trailing position of atypographic character after textlayout has been performed. When getEndPositionOfChar(charnum) iscalled, the following steps are run:

  1. Letcluster be the result offinding the typographic character for the character at indexcharnum within the current element.
  2. Ifcluster is null, thenthrow anIndexSizeError.
  3. Letp be thealignment point ofcluster that correspond to the character at indexcharnum, in the coordinate system of the current element.
  4. Letdirection be a unit vector in the direction of thecluster's advance. This direction takes into account the writing mode being used, the direction of the character, thetext-orientation,glyph-orientation-horizontal andglyph-orientation-vertical properties, anyrotate value that applies tocluster, and any rotation applied to due atextPath.
  5. Letadvance becluster's advance.
  6. Setp top +advance ·direction.
  7. Return a newly created,detachedDOMPoint object representing the pointp.

ThegetExtentOfCharmethod is used to compute a tight bounding box of the glyph cellthat corresponds to a giventypographic character. When getExtentOfChar(charnum)is called, the following steps are run:

  1. Letcluster be the result offinding the typographic character for the character at indexcharnum within the current element.
  2. Ifcluster is null, thenthrow anIndexSizeError.
  3. Letquad be the potentially rotated rectangle in the current element's coordinate system that is the glyph cell forcluster.
  4. Letrect be the rectangle that forms the tightest bounding box aroundquad in the current element's coordinate system.
  5. Return a newly createdDOMRect object representing the rectanglerect.

ThegetRotationOfCharmethod is used to get the rotation oftypographic character. WhengetRotationOfChar(charnum) is called, the following steps are run:

  1. Letcluster be the result offinding the typograhic character for the character at indexcharnum within the current element.
  2. Ifcluster is null, thenthrow anIndexSizeError.
  3. Letdirection be the angle in degrees that represents the direction of thecluster's advance. This direction takes into account the writing mode being used, the direction of the character, thetext-orientation,glyph-orientation-horizontal andglyph-orientation-vertical properties, anyrotate value that applies tocluster, and any rotation applied to due atextPath.
  4. Returndirection.

ThegetCharNumAtPositionmethod is used to find which character caused a text glyph tobe rendered at a given position in the coordinate system.Because the relationship between characters and glyphs is not one-to-one,only the first character of the relevanttypographic character is returnedWhen getCharNumAtPosition(point)is called, the following steps are run:

  1. Assign an index to each character in the DOM within this element, where the first character has index 0.
  2. Letlast be the highest index assigned to a character.
  3. Letcharnum be 0.
  4. Letresult be -1.
  5. Whilecharnum <last:
    1. If the character at indexcharnum corresponds to atypographic character and it is the first character in document order to correspond to thattypographic character, andpoint in this element's coordinate system is within the glyph cell for thetypographic character, then setresult tocharnum.
  6. Returnresult.

TheselectSubStringmethod is used to select text within the element. WhenselectSubString(charnum,nchars) is called, thefollowing steps are run:

Selects a substring of the text in this element, beginning at characterindexcharnum and extending forwardsncharscharacters. The following steps must be followed when this method is called:

  1. Letnode be this text content element.
  2. Letcount be the number of characters in this text content element.
  3. Letend =charnum +nchars.
  4. Ifcharnumcount orendcount, thenthrow anIndexSizeError.
  5. Remove allranges from the document'sselection. [DOM][EDITING]
  6. Set theselection'sdirection to forwards.
  7. Add to theselection a newrange whosestart is theboundary point tuple (node,charnum) andend is theboundary point tuple (node,end).

Ignoring the argument checking and exception throwing, this is equivalent to performing the following:

var selection = document.getSelection();selection.removeAllRanges();var range = new Range();range.setStart(textContentElement, charnum);range.setEnd(textContentElement, charnum + nchars);selection.addRange(range);

This method is deprecated, as it duplicates functionality from the Selection API.

11.13.2. Interface SVGTextPositioningElement

TheSVGTextPositioningElement interface is implemented by elementsthat support attributes that position individual text glyphs. It is inherited bySVGTextElement andSVGTSpanElement.

[Exposed=Window]interfaceSVGTextPositioningElement :SVGTextContentElement {  [SameObject] readonly attributeSVGAnimatedLengthListx;  [SameObject] readonly attributeSVGAnimatedLengthListy;  [SameObject] readonly attributeSVGAnimatedLengthListdx;  [SameObject] readonly attributeSVGAnimatedLengthListdy;  [SameObject] readonly attributeSVGAnimatedNumberListrotate;};

Thex,y,dx,dy androtate IDL attributesreflect thex,y,dx,dy androtatecontent attributes, respectively.

11.13.3. Interface SVGTextElement

AnSVGTextElement object represents atext element in the DOM.

[Exposed=Window]interfaceSVGTextElement :SVGTextPositioningElement {};

11.13.4. Interface SVGTSpanElement

AnSVGTSpanElement object represents atspan element in the DOM.

[Exposed=Window]interfaceSVGTSpanElement :SVGTextPositioningElement {};

11.13.5. Interface SVGTextPathElement

AnSVGTextPathElement object represents atextPath element in the DOM.

[Exposed=Window]interfaceSVGTextPathElement :SVGTextContentElement {  // textPath Method Types  const unsigned shortTEXTPATH_METHODTYPE_UNKNOWN = 0;  const unsigned shortTEXTPATH_METHODTYPE_ALIGN = 1;  const unsigned shortTEXTPATH_METHODTYPE_STRETCH = 2;  // textPath Spacing Types  const unsigned shortTEXTPATH_SPACINGTYPE_UNKNOWN = 0;  const unsigned shortTEXTPATH_SPACINGTYPE_AUTO = 1;  const unsigned shortTEXTPATH_SPACINGTYPE_EXACT = 2;  [SameObject] readonly attributeSVGAnimatedLengthstartOffset;  [SameObject] readonly attributeSVGAnimatedEnumerationmethod;  [SameObject] readonly attributeSVGAnimatedEnumerationspacing;};SVGTextPathElement includesSVGURIReference;

The numeric method type constants defined onSVGTextPathElementare used to represent the keyword values that themethodattribute can take. Their meanings are as follows:

ConstantMeaning
TEXTPATH_METHODTYPE_ALIGNThealign keyword.
TEXTPATH_METHODTYPE_STRETCHThestretch keyword.
TEXTPATH_METHODTYPE_UNKNOWNSome other value.

The numeric spacing type constants defined onSVGTextPathElementare used to represent the keyword values that thespacingattribute can take. Their meanings are as follows:

ConstantMeaning
TEXTPATH_SPACINGTYPE_AUTOTheauto keyword.
TEXTPATH_SPACINGTYPE_EXACTTheexact keyword.
TEXTPATH_SPACINGTYPE_UNKNOWNSome other value.

ThestartOffset IDL attributereflects thestartOffset content attribute.

Themethod IDL attributereflects themethod content attribute. Thenumeric type values formethod are as describedabove in the numeric method type constant table.

Thespacing IDL attributereflects thespacing content attribute. Thenumeric type values forspacing are as describedabove in the numeric spacing type constant table.


[8]ページ先頭

©2009-2025 Movatter.jp