1default namespace = "http://www.w3.org/2000/svg"
2namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
3
4
5##
6##     SVG 1.1 Text Module
7##     file: svg-text.rng
8##
9##     This is SVG, a language for describing two-dimensional graphics in XML.
10##     Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved.
11##
12##     $Id: svg-text.rng,v 1.1 2003/07/15 07:11:10 dean Exp $
13##
14
15##
16##     Text
17##
18##         text, tspan, tref, textPath, altGlyph, altGlyphDef, altGlyphItem,
19##         glyphRef
20##
21##     This module declares markup to provide support for alternate glyph.
22##
23[ xml:lang = "en" ]
24grammar {
25  include "svg-basic-text.rnc"
26  a:documentation [ "\x{a}" ~ "    Datatypes\x{a}" ~ "  " ]
27  BaselineShiftValue.datatype = xsd:string
28  FontSizeAdjustValue.datatype = xsd:string
29  GlyphOrientationHorizontalValue.datatype = xsd:string
30  GlyphOrientationVerticalValue.datatype = xsd:string
31  KerningValue.datatype = xsd:string
32  SpacingValue.datatype = xsd:string
33  TextDecorationValue.datatype = xsd:string
34  a:documentation [ "\x{a}" ~ "    SVG.Text.attrib\x{a}" ~ "  " ]
35  SVG.Text.extra.attrib = empty
36  SVG.Text.attrib &=
37    attribute writing-mode {
38      "lr-tb" | "rl-tb" | "tb-rl" | "lr" | "rl" | "tb" | "inherit"
39    }?,
40    SVG.Text.extra.attrib
41  a:documentation [ "\x{a}" ~ "    SVG.TextContent.attrib\x{a}" ~ "  " ]
42  SVG.TextContent.extra.attrib = empty
43  SVG.TextContent.attrib &=
44    attribute alignment-baseline {
45      "auto"
46      | "baseline"
47      | "before-edge"
48      | "text-before-edge"
49      | "middle"
50      | "central"
51      | "after-edge"
52      | "text-after-edge"
53      | "ideographic"
54      | "alphabetic"
55      | "hanging"
56      | "mathematical"
57      | "inherit"
58    }?,
59    attribute baseline-shift { BaselineShiftValue.datatype }?,
60    attribute direction { "ltr" | "rtl" | "inherit" }?,
61    attribute dominant-baseline {
62      "auto"
63      | "use-script"
64      | "no-change"
65      | "reset-size"
66      | "ideographic"
67      | "alphabetic"
68      | "hanging"
69      | "mathematical"
70      | "central"
71      | "middle"
72      | "text-after-edge"
73      | "text-before-edge"
74      | "inherit"
75    }?,
76    attribute glyph-orientation-horizontal {
77      GlyphOrientationHorizontalValue.datatype
78    }?,
79    attribute glyph-orientation-vertical {
80      GlyphOrientationVerticalValue.datatype
81    }?,
82    attribute kerning { KerningValue.datatype }?,
83    attribute letter-spacing { SpacingValue.datatype }?,
84    attribute text-anchor { "start" | "middle" | "end" | "inherit" }?,
85    attribute text-decoration { TextDecorationValue.datatype }?,
86    attribute unicode-bidi {
87      "normal" | "embed" | "bidi-override" | "inherit"
88    }?,
89    attribute word-spacing { SpacingValue.datatype }?,
90    SVG.TextContent.extra.attrib
91  SVG.Font.attrib &=
92    attribute font-size-adjust { FontSizeAdjustValue.datatype }?,
93    attribute font-stretch {
94      "normal"
95      | "wider"
96      | "narrower"
97      | "ultra-condensed"
98      | "extra-condensed"
99      | "condensed"
100      | "semi-condensed"
101      | "semi-expanded"
102      | "expanded"
103      | "extra-expanded"
104      | "ultra-expanded"
105      | "inherit"
106    }?,
107    attribute font-variant { "normal" | "small-caps" | "inherit" }?
108
109  ##
110  ##       extend SVG.Text.class
111  ##
112  SVG.Text.class |= altGlyphDef
113
114  ##
115  ##       extend SVG.TextContent.class
116  ##
117  SVG.TextContent.class |= tspan | tref | textPath
118  a:documentation [ "\x{a}" ~ "    text: Text Element\x{a}" ~ "  " ]
119  SVG.text.class |= SVG.TextContent.class
120  attlist.text &=
121    SVG.Text.attrib,
122    SVG.TextContent.attrib,
123    attribute dx { Lengths.datatype }?,
124    attribute dy { Lengths.datatype }?,
125    attribute textLength { Length.datatype }?,
126    attribute lengthAdjust { "spacing" | "spacingAndGlyphs" }?
127  a:documentation [
128    "\x{a}" ~
129    "    tspan: Text Span Element\x{a}" ~
130    "  "
131  ]
132  SVG.tspan.content =
133    (text
134     | tspan
135     | tref
136     | altGlyph
137     | animate
138     | set
139     | animateColor
140     | SVG.Description.class
141     | SVG.Hyperlink.class)*
142  tspan = element tspan { attlist.tspan, SVG.tspan.content }
143  attlist.tspan &=
144    SVG.Core.attrib,
145    SVG.Conditional.attrib,
146    SVG.Style.attrib,
147    SVG.TextContent.attrib,
148    SVG.Font.attrib,
149    SVG.Paint.attrib,
150    SVG.Color.attrib,
151    SVG.Opacity.attrib,
152    SVG.Graphics.attrib,
153    SVG.Clip.attrib,
154    SVG.Mask.attrib,
155    SVG.Filter.attrib,
156    SVG.GraphicalEvents.attrib,
157    SVG.Cursor.attrib,
158    SVG.External.attrib,
159    attribute x { Coordinates.datatype }?,
160    attribute y { Coordinates.datatype }?,
161    attribute dx { Lengths.datatype }?,
162    attribute dy { Lengths.datatype }?,
163    attribute rotate { Numbers.datatype }?,
164    attribute textLength { Length.datatype }?,
165    attribute lengthAdjust { "spacing" | "spacingAndGlyphs" }?
166  a:documentation [
167    "\x{a}" ~
168    "    tref: Text Reference Element\x{a}" ~
169    "  "
170  ]
171  SVG.tref.content =
172    (animate | set | animateColor | SVG.Description.class)*
173  tref = element tref { attlist.tref, SVG.tref.content }
174  attlist.tref &=
175    SVG.Core.attrib,
176    SVG.Conditional.attrib,
177    SVG.Style.attrib,
178    SVG.TextContent.attrib,
179    SVG.Font.attrib,
180    SVG.Paint.attrib,
181    SVG.Color.attrib,
182    SVG.Opacity.attrib,
183    SVG.Graphics.attrib,
184    SVG.Clip.attrib,
185    SVG.Mask.attrib,
186    SVG.Filter.attrib,
187    SVG.GraphicalEvents.attrib,
188    SVG.Cursor.attrib,
189    SVG.XLinkRequired.attrib,
190    SVG.External.attrib,
191    attribute x { Coordinates.datatype }?,
192    attribute y { Coordinates.datatype }?,
193    attribute dx { Lengths.datatype }?,
194    attribute dy { Lengths.datatype }?,
195    attribute rotate { Numbers.datatype }?,
196    attribute textLength { Length.datatype }?,
197    attribute lengthAdjust { "spacing" | "spacingAndGlyphs" }?
198  a:documentation [
199    "\x{a}" ~
200    "    textPath: Text Path Element\x{a}" ~
201    "  "
202  ]
203  SVG.textPath.content =
204    (text
205     | tspan
206     | tref
207     | altGlyph
208     | animate
209     | set
210     | animateColor
211     | SVG.Description.class
212     | SVG.Hyperlink.class)*
213  textPath = element textPath { attlist.textPath, SVG.textPath.content }
214  attlist.textPath &=
215    SVG.Core.attrib,
216    SVG.Conditional.attrib,
217    SVG.Style.attrib,
218    SVG.TextContent.attrib,
219    SVG.Font.attrib,
220    SVG.Paint.attrib,
221    SVG.Color.attrib,
222    SVG.Opacity.attrib,
223    SVG.Graphics.attrib,
224    SVG.Clip.attrib,
225    SVG.Mask.attrib,
226    SVG.Filter.attrib,
227    SVG.GraphicalEvents.attrib,
228    SVG.Cursor.attrib,
229    SVG.XLinkRequired.attrib,
230    SVG.External.attrib,
231    attribute startOffset { Length.datatype }?,
232    attribute textLength { Length.datatype }?,
233    attribute lengthAdjust { "spacing" | "spacingAndGlyphs" }?,
234    attribute method { "align" | "stretch" }?,
235    attribute spacing { "auto" | "exact" }?
236  a:documentation [
237    "\x{a}" ~
238    "    altGlyph: Alternate Glyph Element\x{a}" ~
239    "  "
240  ]
241  attlist.altGlyph &=
242    SVG.TextContent.attrib,
243    attribute x { Coordinates.datatype }?,
244    attribute y { Coordinates.datatype }?,
245    attribute dx { Lengths.datatype }?,
246    attribute dy { Lengths.datatype }?,
247    attribute rotate { Numbers.datatype }?
248  a:documentation [
249    "\x{a}" ~
250    "    altGlyphDef: Alternate Glyph Definition Element\x{a}" ~
251    "  "
252  ]
253  SVG.altGlyphDef.content |= altGlyphItem+
254  a:documentation [
255    "\x{a}" ~
256    "    altGlyphItem: Alternate Glyph Item Element\x{a}" ~
257    "  "
258  ]
259  SVG.altGlyphItem.content = glyphRef+
260  altGlyphItem =
261    element altGlyphItem {
262      attlist.altGlyphItem, SVG.altGlyphItem.content
263    }
264  attlist.altGlyphItem &= SVG.Core.attrib
265  a:documentation [
266    "\x{a}" ~
267    "    glyphRef: Glyph Reference Element\x{a}" ~
268    "  "
269  ]
270  attlist.glyphRef &=
271    attribute x { Number.datatype }?,
272    attribute y { Number.datatype }?,
273    attribute dx { Number.datatype }?,
274    attribute dy { Number.datatype }?
275}
276