kanjivg

Package Publisher kanjivg - Checks MIT License

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

  1. Add this package to your dependencies.
dependencies:
  kanjivg: ^0.0.1
  1. 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:

  1. download SVG files from project's GitHub page,
  2. 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.1 to work.
  • If there are any issues feel free to go to GitHub Issues and report a bug.

Maintainers

Libraries

kanjivg