CdlUtils.CdlChar

This class corresponds to a char or component tag in CDL XML

new CdlUtils.CdlChar(char, unicode, components, points, radical, variant)

char is the character, ex '你', corresponding to the "char" attribute in XML.

unicode is the unicode hex for the character, ex '4F60', corresponding to the "uni" attribute in XML.

components is an array of subcharacters and strokes in order corresponding to the body of the tags in XML.

points is an array of CdlUtils.Point corresponding to the "points" attribute in XML.

radical is a string corresponding to the "radical" attribute in XML.

variant is an int corresponding to the "variant" attribute in XML.

attribute: char

The char passed in the constructor

attribute: unicode

The unicode passed in the constructor

attribute: components

The list of components passed in the constructor

attribute: points

The list of points passed in the constructor

attribute: radical

The radical passed in the constructor

attribute: variant

The variant passed in the constructor

method: getNumStrokes()

returns the number of strokes in this character

method: toXml(options = {})

options has only 1 attribute, "recursive" which controls whether or not to nest the CDL for each sub-character

char.toXml(); // return just the CDL XML for this character
char.toXml({recursive: true}); // return nested CDL XML