https://github.com/emmiegit/canji
Procedural kanji generator
https://github.com/emmiegit/canji
kanji kanjivg svg
Last synced: 10 months ago
JSON representation
Procedural kanji generator
- Host: GitHub
- URL: https://github.com/emmiegit/canji
- Owner: emmiegit
- License: lgpl-2.1
- Created: 2023-12-20T23:51:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-24T13:00:40.000Z (over 2 years ago)
- Last Synced: 2025-03-29T23:41:16.651Z (about 1 year ago)
- Topics: kanji, kanjivg, svg
- Language: Python
- Homepage:
- Size: 146 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## 缶(かん) 字(じ)
(Read like "kanji")
A system to procedurally generate plausible but nonexistant kanji.
### Execution
This system is set up as a series of scripts to perform each of the requisite steps. These scripts target Python 3.
First we need to initialize the KanjiVG submodule since that's what we use as the basis for our SVG files.
```sh
git submodule init
```
Now we need to install pip dependencies. On my machine, I need to create a virtual environment and install the dependencies there. Alternatively, you can get the dependencies through another means.
```sh
python -m venv env
source env/bin/activate
pip install -r requirements.txt
```
Presently, however, all the dependencies are purely cosmetic and thus optional. Scripts will work fine without them.
Then, we need to extract and process radicals as separate SVGs. This involves both pulling out component radicals (e.g. 亻or 糹), it also copies full characters like 頑.
```sh
./extract_radicals.py
```
Now we can generate some kanji! Since there are a few options, consult `--help` to see everything, but the basic usage pattern is:
```sh
./build_kanji.py -o output_dir -c 100
```
If you need to start over, you can wipe the output data.
```sh
./clean.sh
```
### Development
These scripts are formatted using [Black](https://github.com/psf/black).
### License
Available under the terms of the [GNU Lesser General Public License](LICENSE.md), v2.1 only. All generated SVG files are licensed as [Creative Commons Attribution-ShareAlike 3.0](https://creativecommons.org/licenses/by-sa/3.0/).