The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Kanji::KanjiVG - parse KanjiVG kanji data.

parse

    parse (
        file_name => $file_name,
        callback => $callback,
        callback_data => $callback_data,
    );

Parse the file specified by $file_name. As a complete piece of kanji data is achieved, call $callback in the following form:

    &{$callback} ($callback_data, $kanji);

Possible arguments are

file_name

Give the name of the file to parse.

callback

Give a function to call back each time a complete piece of kanji information is parsed.

callback_data

An optional piece of data to pass to the callback function.

flatten

A boolean. If it is false (or if it is omitted), the kanji information is sent as a complete hash reference. If it is true, the kanji information is sent as an array reference containing the paths.

If the data is not flattened using flatten, $kanji is a hash reference containing the following fields:

id

The identification number of the kanji.

g

A group of strokes of the kanji. This contains the following sub-fields:

paths

An array reference to strokes or groups of strokes. Each element contains its type and attributes.

Each path is a single stroke of the kanji. This hash reference contains the following sub-fields:

id

The stroke's identification number.

type

The type of the stroke, a field describing the general shape of the stroke.

d

The SVG path information. This information is a string. To parse it, the module Image::SVG::Path may be useful.