Kimtaro / kanjivg2svg

Ruby script to convert SVG data from the KanjiVG project
60 stars 10 forks source link

Problems with relative move command - e.g. 23526_frames.svg #5

Open b0tlike0 opened 3 years ago

b0tlike0 commented 3 years ago

I really like your projects (jisho.org especially) and this script here helps me a lot with learning Kanji. I wrote my own little script to format these svg differently (rearrange them into colums) to make them fit a smartphone screen better and I encountered an error:

In, for example 23526_frames.svg, the fourth stroke is not drawn. It does have a relative move coordinate, but the coordinates seem to be wrong anyway, when looking at the circle drawn right after.

<path d="M378.84000000000003,9.06c0.91,0.29,2.2,1.74,2.18,2.59c-0.07,2.68-0.07,5.87-0.07,8.31" style="fill:none;stroke:#999;stroke-width:3" />
<path d="M348.32,20.33c0,3.08-2.45,11.55-3.57,13.61" style="fill:none;stroke:#999;stroke-width:3" />
<path d="M348.2,22.38c8.69-0.9,57.53-3.52,64.59-3.8c8.46-0.33,2.17,5.28-0.57,7.21" style="fill:none;stroke:#999;stroke-width:3" />
<path d="m34.83,26.81c0.81,0.33,1.37,1.56,1.31,2.55-0.3,4.68-1.28,13.59-2.68,17.44-0.52,1.41-0.07,2.08,1.36,1.85,9.6,-1.54,23.93,-2.65,36.87,-2.61" style="fill:none;stroke:black;stroke-width:3" />
<circle cx="361.83" cy="26.81" r="5" stroke-width="0" fill="#FF2A00" opacity="0.7" />

As the Kanji is correctly drawn on Jisho - 實, it seems you either already corrected this or use new svg's now. Is there a possible fix for this? Thank you :)

Kimtaro commented 3 years ago

Hi @b0tlike0, thanks for the kind words!

This repository was used for the kanji stroke order diagrams on the old Jisho site. On the current site I use the raw source files from https://kanjivg.tagaini.net without running them through this script.

I'm not very good with SVG syntax, but this might be a mistake in the KanjiVG file. If I change the lowercase m to uppercase M at the start of the fourth path then the stroke is printed when using this script.

I hope this helps.