chanind / hanzi-writer

Chinese character stroke order animations and practice quizzes
https://hanziwriter.org
MIT License
3.55k stars 555 forks source link

Localisation of starting point for numbering ? #61

Open hugolpz opened 6 years ago

hugolpz commented 6 years ago

A common practice is to do numbering upon stroke order images or animations (screenshot of ongoing animation below).

screenshot from 2018-02-19 15-23-24

chanind commented 6 years ago

I think the tricky part is finding a location to write each number that's not overlapped by another stroke and that's clear which stroke is being labeled. The first point in medians for each stroke from the Make me a Hanzi data is where the stroke starts, so that part isn't hard. Do you just need Hanzi Writer to expose an API method that will let you know info about the strokes, like starting position? If so that's not hard. If Hanzi Writer needs to find ideal locations for each number and render the numbers that would be trickier I think, but should be possible.

hugolpz commented 6 years ago

Barbarian 'in-stroke' approach

I was thinking of something more barbarian than the example above. Like a small white number within the first 'inch' of each stroke at first. Otherwise it needs a whole handwork project, or intelligent force repulsion.

screenshot from 2018-02-22 10-57-23

Kanjivg data

Also, I just remembered that KanjiVG do record a [x,y] location for such numbered information. contrast-hon download 4

But it then become a longer shoot, and with conflicting license (I guess).