TEI to SVG

=A Quick Look Through the TEI Figures Module=

Module: figures (Tables, Formulae, and Graphics, P5 chapter 22)

Elements Defined: table row cell formula figure figDesc graphic binaryObject

The "figure" module really contains three related - but very different - aspects.

 &lt;figure> may also contain &lt;head> (providing a title or heading for the image) &lt;figDesc> (a description of the image) and &lt;p> (commentary or caption, not a description of the image).
 * 1) Tables Elements: table row cell I don't immediately see anything corresponding to this in SVG. It wouldn't make sense, anyway - tables are really for organizing textual material. Anything else?
 * 2) Formulae Elements: formula Formula already allows for the inclusion of elements from outside the TEI, although the examples in the guidelines do not use namespaces, and namespaces are not mentioned in the text. Should we recommend that require namespaces for elements pulled in from elsewhere? If so, what about (as in the first two examples) when the notation is non-XML? Is @notation really enough? "By default, a is assumed to contain character data which is not validated in any way" Is this really a good idea? It seems then that it can't contain namespaces at all (rather, it doesn't matter what you put in there).
 * 3) Graphic Images Elements: figure graphic binaryObject figDesc The element is used to contain images, captions, and textual descriptions of the pictures. The images themselves are specified using the element, whose url attribute provides the location of an image.

"Where the graphic itself contains large amounts of text, perhaps with a complex structure, and perhaps difficult to distinguish from the graphic, the encoder should choose whether to regard the graphic as containing the text (in which case, a nested &lt;text> element may be included within the &lt;figure> element) or to regard the enclosed text as being a separate division of the &lt;text> element in which the graphic appears. In this latter case, an appropriate divn class element may be used for the text represented within the graphic, and the &lt;figure> element embedded within it. The choice will depend to a large degree on the encoder's understanding of the relationship between the graphic and the surrounding text."

So &lt;figure> may also contain &lt;text>.

=TEI Elements and their SVG Equivalents (approx.)=

tei:graphic
tei:graphic "indicates the location of an inline graphic, illustration, or figure."

attributes: (In addition to global attributes) width 	The display width of the image Status: Mandatory when applicable Datatype: data.outputMeasurement height 	The display height of the image Status: Mandatory when applicable Datatype: data.outputMeasurement scale 	A scale factor to be applied to the image to make it the desired display size Status: Mandatory when applicable Datatype: data.probability url 	The target URL Status: Mandatory when applicable Datatype: data.pointer Values: The name of a URL which provides the image. mimeType 	The MIME type Status: Mandatory when applicable Datatype: data.word Values: The MIME type to be used for the object when it is decoded  Figure One: The View from the Bridge A Whistleresque view showing four or five sailing boats in the foreground, and a series of buoys strung out between them.

svg:image
svg:image "indicates that the contents of a complete file are to be rendered into a given rectangle within the current user coordinate system. The 'image' element can refer to raster image files such as PNG or JPEG or to files with MIME type of "image/svg+xml""

attributes: x = " " The x-axis coordinate of one corner of the rectangular region into which the referenced document is placed. If the attribute is not specified, the effect is as if a value of "0" were specified. Animatable: yes. y = " " The y-axis coordinate of one corner of the rectangular region into which the referenced document is placed. If the attribute is not specified, the effect is as if a value of "0" were specified. Animatable: yes. width = " " The width of the rectangular region into which the referenced document is placed. A negative value is an error (see Error processing). A value of zero disables rendering of    the element. Animatable: yes. height = " " The height of the rectangular region into which the referenced document is placed. A negative value is an error (see Error processing). A value of zero disables rendering of    the element. Animatable: yes. xlink:href = " " A URI reference. Animatable: yes.


 * Are x and y necessary?
 * xlink:href instead of url = this is nice.

 Figure One: The View from the Bridge A Whistleresque view showing four or five sailing boats in the foreground, and a series of buoys strung out between them.

Thoughts
If we were to recommend a module to import all of SVG, it would be preferable to use only svg:image and to drop tei:graphic entirely (if svg:image does indeed do everything we would need it to do in TEI). But if we don't want to "modulate" SVG (if we just say that we will refer to external SVG files if we need them), do we still want to maintain a separate tei:graphic element?

tei:figure/tei:graphic|tei:head|tei:figDesc

 * figure "contains a block containing graphics, illustrations, or figures."
 * graphic "indicates the location of an inline graphic, illustration, or figure."
 * head "contains any type of heading, for example the title of a section, or the heading of a list, glossary, manuscript description, etc."
 * figDesc "(Description of Figure) contains a brief prose description of the appearance or content of a graphic figure, for use when documenting an image without displaying it."

May map to the SVG:

svg:g/svg:image|svg:title|svg:desc

 * "The 'g' element is a container element for grouping together related graphics elements."
 * "The 'image' element indicates that the contents of a complete file are to be rendered into a given rectangle within the current user coordinate system. The 'image' element can refer to raster image files such as PNG or JPEG or to files with MIME type of "image/svg+xml""
 * "Each container element or graphics element in an SVG drawing can supply a 'desc' and/or a 'title' description string where the description is text-only."
 * "The 'title' child element to an ... element serves the purposes of identifying the content of the given SVG document fragment."

Examples
  Figure One: The View from the Bridge A Whistleresque view showing four or five sailing boats in the foreground, and a series of buoys strung out between them.   Figure One: The View from the Bridge A Whistleresque view showing four or five sailing boats in the foreground, and a series of buoys strung out between them.</svg:desc> </svg:g>

Mapping attributes
@tei:coords (modelled on @mets:coords)

As described in the METS documentation: COORDS: an optional string attribute listing a set of visual coordinates within an image (still image or video frame). The COORDS attribute should be used as in HTML 4.

And in HTML 4.01: This attribute specifies the position and shape on the screen. The number and order of values depends on the shape being defined. Possible combinations:
 * rect: left-x, top-y, right-x, bottom-y.
 * circle: center-x, center-y, radius. Note. When the radius value is a percentage value, user agents should calculate the final radius value based on the associated object's width and height. The radius should be the smaller value of the two.
 * poly: x1, y1, x2, y2, ..., xN, yN. The first x and y coordinate pair and the last should be the same to close the polygon. When these coordinate values are not the same, user agents should infer an additional coordinate pair to close the polygon.

Coordinates are relative to the top, left corner of the object. All values are lengths. All values are separated by commas.

METS defines @mets:coords on. For TEI, it would be nice to have a similar attribute available to "regular" elements, not to a special element. The reasoning is that in many cases, especially when dealing with primary source texts, TEI elements refer not to a text in general but to the text as it appears in a specific physical document. It may not make sense to allow @mets:coords on &lt;p>, but it may make perfect sense to allow it on those elements described in Chapter 18 Transcription of Primary Sources that relate to a specific physical occurrance: <hi> <fw>

SVG defines various attribute values for coordinates. The system is based on a shape (identified by the element), but the attributes vary, so one could use the same attributes in the same element in various combinations to achieve the same result:

rectangle: @svg:x = length @svg:y = length (rounded edges: @svg:rx = length @svg:ry = length) circle: @svg:cx = " " The x-axis coordinate of the center of the circle. @svg:cy = " " The y-axis coordinate of the center of the circle. @svg:r = " " The radius of the circle.

ellipse: @svg:cx = " " The x-axis coordinate of the center of the ellipse. @svg:cy = " " The y-axis coordinate of the center of the ellipse. @svg:rx = " " The x-axis radius of the ellipse. @svg:ry = " " The y-axis radius of the ellipse.

polygon: @svg:points = "<list-of-points>" The points that make up the polygon. All coordinate values are in the user coordinate system.

@svg:points seems to me to be very similar to @mets:coords, except that it cannot be used to form a circle (only boundaries with straight edges)

I think that I would prefer to use @mets:coords (or something similar) in TEI, rather than trying to take advantage of the various SVG attributes, at least for the more simple cases.

In more complex instances, I think we need to continue looking at SVG, whether we want to be able to import it in a module or link to external files. Or both.

tei:binaryObject
I don't see an equivalent in SVG, but it may be because I don't know where to look.