This page is still under construction an@d describes the KanjiVG's new format

The KanjiVG is designed as an extension of SVG. This means that any KanjiVG file is 100% SVG-compliant and can be opened by one's favorite SVG viewer/editor to be seen as-is.

However, the SVG file is organized in such a way that it reflects the structure and stroke order of the kanji. Furthermore, several additional attributes are added in order to provide extra information about the kanji's structure.

Groups

Kanji are often made of several components, and KanjiVG uses SVG groups to reflect this organization. For instance, can be seen as a combination of on its left and on its right. SVG groups provide an elegant way to bind strokes to a given group.

There are two root SVG groups. The StrokePaths group is a set of standard SVG paths that gives the strokes of the kanji in the right order, and describes the structure of the kanji as explained above with extra attributes. The StrokeNumbers group is an optional group that gives a convenient position for stroke-order numbers, useful for displaying in printed material for instance. The rest of this page explains the additional SVG attributes used in StrokePaths that describe the kanji structure.

Additional group attributes

All these attributes are placed under the kvg namespace.

element
Specifies which kanji best represents the group physically. It should be the unicode character that resembles the group as much as possible.
original
Specifies which kanji represents the group from a semantic point of view. For instance, the ninben () component is a variation of when in some kanji. This attribute only needs to be present if there is a difference between the semantic and physical representation of the group.

It can therefore be guessed that the kanji will be defined by two groups: the left one will have for element attribute, and for original attribute, whereas the right one will have for element and no original attribute.

position
Defines where this groups is located with respect to the other groups with the same parent. Possible values are left, right, top, bottom, nyo, tare, kamae, kamae1, kamae2.
variant
Should be present and set to true if the group is actually slightly different from the element attribute.
partial
Should be present and set to true if the group only represents the element attribute partially, i.e. if not all its strokes are present.
part
Is used if all the strokes of a component do not all come in a row. In this case, two or more identical groups need to be defined, and the part attribute allows to number these groups and defined them as being part of the same component. TODO: remove as it is redundant with the number attribute
number
Allows to identify a group if the element it includes is represented several times in the kanji. For instance,
radical
Defines if this group is considered as a radical of the kanji, and by which reference. Possible values: general, nelson, tradit.
phon
TBD
tradForm
TBD
radicalForm
TBD

Strokes

KanjiVG is designed to be easily parsed, and uses XML to achieve this. The properties and shape of every kanji is hierarchically described by XML attributes. The shape of each stroke is described as a SVG path on an area of size 109x109.

Additional stroke attributes

type
The shape of the stroke. It can be used to know how the stroke should be rendered.