- JavaScript 96.8%
- CSS 3.1%
| bin | ||
| data | ||
| docs | ||
| scripts | ||
| src | ||
| .gitignore | ||
| AGENTS.md | ||
| LICENSE | ||
| org.spacecruft.HanziDraw.json | ||
| README.md | ||
| spike.js | ||
| test-logic.js | ||
| UPSTREAM.md | ||
HanziDraw GJS
HanziDraw is a native GTK 4/libadwaita port of the HanziDraw web app, written in GJS for GNOME mobile and the Purism Librem 5. Draw a Chinese character to get recognition candidates, CC-CEDICT English definitions with tone-colored pinyin, and stroke-order animation. Direct hanzi and pinyin lookup are also supported. Recognition and lookup work fully offline; the Flatpak has no network permission.
The application source and bundled data are self-contained in this repository; building its Flatpak does not require a separate upstream checkout.
Development run
Install GJS, GTK 4, libadwaita, and GLib development tools. Development runs use the host's CJK fonts. From the workspace root:
glib-compile-resources data/org.spacecruft.HanziDraw.gresource.xml \
--sourcedir=data --sourcedir=src \
--target=data/org.spacecruft.HanziDraw.gresource
gjs -m src/main.js
Flatpak
Install flatpak, flatpak-builder, and the GNOME 48 runtime and SDK:
flatpak install org.gnome.Platform//48 org.gnome.Sdk//48
Build and install the app for the current user, then run it (from the workspace root):
flatpak-builder --user --install --force-clean build org.spacecruft.HanziDraw.json
flatpak run org.spacecruft.HanziDraw
Validate the store metadata and inspect the sandbox permissions with:
appstreamcli validate data/org.spacecruft.HanziDraw.metainfo.xml
flatpak info --show-permissions org.spacecruft.HanziDraw
The manifest deliberately grants only Wayland, fallback X11, and session-bus sockets. It does not grant network access. The pinned Noto Sans CJK SC font is downloaded at build time and bundled in the Flatpak.
Tests
Run the ported logic tests from the workspace root:
gjs -m test-logic.js
Source layout
src/— application, widgets, recognition, dictionary, and drawing.data/— committed runtime data, generated stroke shards, GResource definition, desktop/AppStream metadata, icon, and licenses.bin/— installed Flatpak launcher.scripts/build-strokes-shards.mjs— deterministic shard generator.docs/— port plan and phase specifications.
License and provenance
The port is licensed under GNU GPL v3 or later; see LICENSE.
Bundled third-party code, data, and the font retain their own licenses. See
UPSTREAM.md for complete provenance and
data/licenses/ for the redistributed notices.