kanjivg 0.1.0 kanjivg: ^0.1.0 copied to clipboard
Dart implementation of a parser for resources from the Kanji Vector Graphics project.
kanjivg #
kanjivg
provides a simple way of interacting with data from the KanjiVG (Kanji Vector Graphics) project. This package is a pure Dart implementation of a parser for SVG files with extensions added by the maintainers of KanjiVG. It provides metadata like stroke count, original radical forms (e.g. 人 for 亻), position of radicals and more.
This package is neither supported nor related to the creators of the KanjiVG project.
Getting started #
- Add this package to your dependencies.
dependencies:
kanjivg: latest_version
- Get the dependencies.
dart pub get
Usage #
The library doesn't include kanji data as there are over 10,000 files and it would be quite wasteful if you want to fetch them at runtime. You can either:
- download SVG files from project's GitHub page,
- self-host them and get SVG data from your server.
import 'package:kanjivg/kanjivg.dart';
void main() {
const source = '<?xml version="1.0" encoding="UTF-8"?> ... </svg>';
const parser = KanjiParser();
// Returns an instance of `KvgData` with `id`, `character`, `radicals` and `strokes`.
final data = parser.parse(source);
}
Additional information #
- This package requires at least Dart 3.5 to work.
- If there are any issues feel free to go to GitHub Issues and report a bug.