Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixes #33

Closed
wants to merge 17 commits into from

1 participant

@ospalh
Collaborator

I think these should be rather uncontorversal:

  • Two, the changes to 蝿 and 挸,refer to problems mentioned in issue reports #29 and #30.
  • For the changes to the two 驫s, i didn’t file an issue report. I spotted those when i looked at the record kanji, those with the most strokes.

For the changes to 嘘,re issue report #28, i’m not quite sure about the exact positions. I’m not sure which way the stroke 5 is written, and the order of strokes 6 and 7 seems a bit weird to me, but i didn’t touch those.

ospalh added some commits
@ospalh ospalh Move some files to auxiliary directory 6c875a7
@ospalh ospalh Cleanup
Don’t import the licence string, use a local copy.
Also, clean up import.
3020f26
@ospalh ospalh Move another file 4d195a5
@ospalh ospalh Sketch of the new code.
Some thoughts rather than working code how i think the xml builder should look.
9056803
@ospalh ospalh Fixes to a number of stroke numbers in 驫. e756fa2
@ospalh ospalh Fixes to a number of stroke numbers in 驫-Vt6. 758bff3
@ospalh ospalh Moved stroke number 6 to beginning of that stroke in 蝿. 610ce89
@ospalh ospalh Swapped stroke numbers 2 and 3 to match the strokes in 挸. 2d4c518
@ospalh ospalh Added stroke numbers to 嘘.
This needs review. I’m not sure which way stroke 5 is written.
And i wonder if the srokes 6 and 7 shouldn’t be swapped, but i didn’t touch the strokes.
a87f135
@ospalh
Collaborator

'the order of strokes 6 and 7 seems a bit wired':
1. weird, not wired
2. Looks like that is only me. Seems to be correct with the vertical before the horizontal.

@ospalh
Collaborator

Oh dear, some commits that i didn't mean to be here sneaked in.
Sorry about that.

@ospalh ospalh closed this
@ospalh ospalh referenced this pull request
Merged

A few fixes. #45

@ospalh ospalh deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 18, 2012
  1. @ospalh
  2. @ospalh

    Cleanup

    ospalh authored
    Don’t import the licence string, use a local copy.
    Also, clean up import.
  3. @ospalh

    Move another file

    ospalh authored
  4. @ospalh

    Sketch of the new code.

    ospalh authored
    Some thoughts rather than working code how i think the xml builder should look.
Commits on May 19, 2012
  1. @ospalh
  2. @ospalh
  3. @ospalh
  4. @ospalh
  5. @ospalh

    Added stroke numbers to 嘘.

    ospalh authored
    This needs review. I’m not sure which way stroke 5 is written.
    And i wonder if the srokes 6 and 7 shouldn’t be swapped, but i didn’t touch the strokes.
  6. @ospalh

    Some more code snipets

    ospalh authored
  7. @ospalh

    ce

    ospalh authored
  8. @ospalh
Commits on May 20, 2012
  1. @ospalh
Commits on May 23, 2012
  1. @ospalh
Commits on Dec 6, 2012
  1. @ospalh
  2. @ospalh

    Swap stroke numbers 20/21 on 竸 and 竸-Kaisho.

    ospalh authored
    The strokes themselves look OK.
Commits on Dec 8, 2012
  1. @ospalh

    Fix 冥-Kaisho:

    ospalh authored
    Rearrange stroke data to match other info
    (numbers, types, data in plain 冥)
This page is out of date. Refresh to see the latest.
View
0  check-1.0 → auxiliary/check-1.0
File renamed without changes
View
0  check-all-strokes.pl → auxiliary/check-all-strokes.pl
File renamed without changes
View
0  find-ie.pl → auxiliary/find-ie.pl
File renamed without changes
View
0  find-radical.pl → auxiliary/find-radical.pl
File renamed without changes
View
0  find-sanzui.pl → auxiliary/find-sanzui.pl
File renamed without changes
View
0  harmonize-svg.py → auxiliary/harmonize-svg.py
File renamed without changes
View
0  kanjivg.py → auxiliary/kanjivg.py
File renamed without changes
View
0  listmissingcomponents.py → auxiliary/listmissingcomponents.py
File renamed without changes
View
0  viewer.py → auxiliary/viewer.py
File renamed without changes
View
0  xmlhandler.py → auxiliary/xmlhandler.py
File renamed without changes
View
87 build_kanji_data_xml.py
@@ -0,0 +1,87 @@
+#/bin/env python
+# -*- mode: Python ; coding: utf-8 -*-
+# Copyright © 2012 Roland Sieker ( ospalh@gmail.com )
+# Based on work by Alexandre Courbot, Copyright (C) 2011
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+'''Write the information in the kanjivg SVG files to a single xml
+file, including variants and the stroke numbers.
+'''
+
+import xml.etree.ElementTree as ET
+
+
+# Sample licence header
+licenseString = """Copyright (C) 2009/2010/2011 Ulrich Apel.
+This work is distributed under the conditions of the Creative Commons
+Attribution-Share Alike 3.0 Licence. This means you are free:
+* to Share - to copy, distribute and transmit the work
+* to Remix - to adapt the work
+
+Under the following conditions:
+* Attribution. You must attribute the work by stating your use of KanjiVG in
+ your own copyright header and linking to KanjiVG's website
+ (http://kanjivg.tagaini.net)
+* Share Alike. If you alter, transform, or build upon this work, you may
+ distribute the resulting work only under the same or similar license to this
+ one.
+
+See http://creativecommons.org/licenses/by-sa/3.0/ for more details."""
+
+
+svgNs = "http://www.w3.org/2000/svg"
+kvgNs = "http://kanjivg.tagaini.net"
+
+
+
+def addKanjiToTree(kanjiFn, tree):
+ '''For each kanji where we have an SVG file, add a general element
+to the XML tree and call addKanjiVariant fore each svg file, at least
+once, more times when there are non-standard variants.'''
+
+ pass
+
+def addKanjiVariantToKanjiElement(kanjiElement, kanjiFn):
+ '''Add the svg element of the kanjiVariant, wraped in an
+identifying element, to the kanjiElement. This is the function that
+actually reads the svg files.'''
+ pass
+
+def kanjiVgXmlTree(indir=u'kanji'):
+ '''Create the outer structure of the Xml ElementTree, than add all
+the data through addKanjiToTree. Return that tree.'''
+
+ # Stuff to set up general inforamtion
+ ET.register_namespace('svg', svgNs)
+ ET.register_namespace('kvg', kvgNs)
+ kanjiTree = ET.ElementTree()
+
+ for kanjiFName in os.listdir(indir):
+ # Only add a kanji entry when we have a ‘standard’ variant.
+ if 9 == len(kanjiFName) and kanjiFName.endswith('.svg'):
+ addKanjiToTree(kanjiFName, kanjiTree)
+
+def writeKanjiData(indir=u'kanji', outFile='kanji_data.xml'):
+ kanjiXmlTree = kanjiVgXmlTree(indir)
+ ET.writeXml(kanjiXmlTree, outFile)
+
+
+
+if __name__ == '__main__':
+ # No command line options at the moment. If you want to other
+ # input or output, call writeKajiData yourself, from another
+ # script or the python console.
+ writeKanjiData()
View
22 kanji/051a5-Kaisho.svg
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2009/2010/2011 Ulrich Apel.
-This work is distributed under the conditions of the Creative Commons
+This work is distributed under the conditions of the Creative Commons
Attribution-Share Alike 3.0 Licence. This means you are free:
* to Share - to copy, distribute and transmit the work
* to Remix - to adapt the work
@@ -38,24 +38,24 @@ kvg:type CDATA #IMPLIED >
<g id="kvg:StrokePaths_051a5-Kaisho" style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;">
<g id="kvg:051a5-Kaisho" kvg:element="">
<g id="kvg:051a5-Kaisho-g1" kvg:element="" kvg:position="top" kvg:radical="general">
- <path id="kvg:051a5-Kaisho-s1" kvg:type="" d="M50.42,59c2.13,0.87,5.07,4.28,5.62,5.95"/>
- <path id="kvg:051a5-Kaisho-s2" kvg:type="㇖b" d="M18.5,73.45c1.23,0.1,4.03,0.66,5.22,0.55c12.9-1.1,49.3-6.07,64.36-5.37c2.03,0.09,3.06,0.05,4.57,0.7"/>
+ <path id="kvg:051a5-Kaisho-s1" kvg:type="" d="M20.66,15.88c0,4.1-3.55,15.38-5.16,18.12"/>
+ <path id="kvg:051a5-Kaisho-s2" kvg:type="㇖b" d="M20.74,18.24c9.51-0.99,56.74-4.53,64.45-4.9c12.05-0.59,2.55,7.16-0.45,9.28"/>
</g>
<g id="kvg:051a5-Kaisho-g2" kvg:position="bottom">
<g id="kvg:051a5-Kaisho-g3" kvg:element="">
- <path id="kvg:051a5-Kaisho-s3" kvg:type="" d="M43.6,79.49c0.59,0.84,0.31,3.06-0.7,4.07c-5.49,5.47-12.92,9.93-24.3,14.69"/>
- <path id="kvg:051a5-Kaisho-s4" kvg:type="㇕a" d="M66.47,78.86c9.35,5.33,17.07,11.48,21.75,17.95"/>
- <path id="kvg:051a5-Kaisho-s5" kvg:type="㇐a" d="M20.66,15.88c0,4.1-3.55,15.38-5.16,18.12"/>
- <path id="kvg:051a5-Kaisho-s6" kvg:type="㇐a" d="M20.74,18.24c9.51-0.99,56.74-4.53,64.45-4.9c12.05-0.59,2.55,7.16-0.45,9.28"/>
+ <path id="kvg:051a5-Kaisho-s3" kvg:type="" d="M32.32,30.7c0.19,0.25,0.66,1.22,0.98,2.19c1.38,4.19,2.67,14.26,3.52,22.07"/>
+ <path id="kvg:051a5-Kaisho-s4" kvg:type="㇕a" d="M34.25,31.76c10.66-1.05,29.94-2.84,37.9-3.73c2.92-0.33,4.42,0.82,4.27,1.98c-0.55,4.22-2.42,15.74-5.25,23.77"/>
+ <path id="kvg:051a5-Kaisho-s5" kvg:type="㇐a" d="M36.24,42.59c6.44-0.76,12.94-1.12,19.4-1.64c2.2-0.18,4.39-0.35,6.47-0.51"/>
+ <path id="kvg:051a5-Kaisho-s6" kvg:type="㇐a" d="M36.88,54.32c7.68-0.45,24.2-2.32,34.8-3.06"/>
</g>
<g id="kvg:051a5-Kaisho-g4" kvg:element="">
<g id="kvg:051a5-Kaisho-g5" kvg:element="" kvg:position="top">
- <path id="kvg:051a5-Kaisho-s7" kvg:type="㇑a" d="M32.32,30.7c0.19,0.25,0.66,1.22,0.98,2.19c1.38,4.19,2.67,14.26,3.52,22.07"/>
- <path id="kvg:051a5-Kaisho-s8" kvg:type="" d="M34.25,31.76c10.66-1.05,29.94-2.84,37.9-3.73c2.92-0.33,4.42,0.82,4.27,1.98c-0.55,4.22-2.42,15.74-5.25,23.77"/>
+ <path id="kvg:051a5-Kaisho-s7" kvg:type="㇑a" d="M50.42,59c2.13,0.87,5.07,4.28,5.62,5.95"/>
+ <path id="kvg:051a5-Kaisho-s8" kvg:type="" d="M18.5,73.45c1.23,0.1,4.03,0.66,5.22,0.55c12.9-1.1,49.3-6.07,64.36-5.37c2.03,0.09,3.06,0.05,4.57,0.7"/>
</g>
<g id="kvg:051a5-Kaisho-g6" kvg:element="" kvg:position="bottom">
- <path id="kvg:051a5-Kaisho-s9" kvg:type="" d="M36.24,42.59c6.44-0.76,12.94-1.12,19.4-1.64c2.2-0.18,4.39-0.35,6.47-0.51"/>
- <path id="kvg:051a5-Kaisho-s10" kvg:type="" d="M36.88,54.32c7.68-0.45,24.2-2.32,34.8-3.06"/>
+ <path id="kvg:051a5-Kaisho-s9" kvg:type="" d="M43.6,79.49c0.59,0.84,0.31,3.06-0.7,4.07c-5.49,5.47-12.92,9.93-24.3,14.69"/>
+ <path id="kvg:051a5-Kaisho-s10" kvg:type="" d="M66.47,78.86c9.35,5.33,17.07,11.48,21.75,17.95"/>
</g>
</g>
</g>
View
14 kanji/05618.svg
@@ -66,5 +66,19 @@ kvg:type CDATA #IMPLIED >
</g>
</g>
<g id="kvg:StrokeNumbers_05618" style="font-size:8;fill:#808080">
+ <text transform="matrix(1 0 0 1 6 42)">1</text>
+ <text transform="matrix(1 0 0 1 17 32)">2</text>
+ <text transform="matrix(1 0 0 1 19 54)">3</text>
+ <text transform="matrix(1 0 0 1 55 16)">4</text>
+ <text transform="matrix(1 0 0 1 68 17)">5</text>
+ <text transform="matrix(1 0 0 1 39 39)">6</text>
+ <text transform="matrix(1 0 0 1 42 29)">7</text>
+ <text transform="matrix(1 0 0 1 50 41)">8</text>
+ <text transform="matrix(1 0 0 1 67 38)">9</text>
+ <text transform="matrix(1 0 0 1 55 57)">10</text>
+ <text transform="matrix(1 0 0 1 76 62)">11</text>
+ <text transform="matrix(1 0 0 1 48 68)">12</text>
+ <text transform="matrix(1 0 0 1 93 69)">13</text>
+ <text transform="matrix(1 0 0 1 38 92)">14</text>
</g>
</svg>
View
8 kanji/05ac1-Kaisho.svg
@@ -67,12 +67,12 @@ kvg:type CDATA #IMPLIED >
<text transform="matrix(1 0 0 1 56.25 13.50)">4</text>
<text transform="matrix(1 0 0 1 42.75 28.55)">5</text>
<text transform="matrix(1 0 0 1 51.75 25.63)">6</text>
- <text transform="matrix(1 0 0 1 70.50 52.63)">7</text>
+ <text transform="matrix(1 0 0 1 55.50 39.50)">7</text>
<text transform="matrix(1 0 0 1 53.50 51.50)">8</text>
- <text transform="matrix(1 0 0 1 55.50 39.50)">9</text>
+ <text transform="matrix(1 0 0 1 70.50 52.63)">9</text>
<text transform="matrix(1 0 0 1 52.00 63.50)">10</text>
- <text transform="matrix(1 0 0 1 81.50 67.63)">11</text>
+ <text transform="matrix(1 0 0 1 53.50 75.80)">11</text>
<text transform="matrix(1 0 0 1 76.50 47.50)">12</text>
- <text transform="matrix(1 0 0 1 53.50 75.80)">13</text>
+ <text transform="matrix(1 0 0 1 81.50 67.63)">13</text>
</g>
</svg>
View
4 kanji/06388.svg
@@ -64,8 +64,8 @@ kvg:type CDATA #IMPLIED >
</g>
<g id="kvg:StrokeNumbers_06388" style="font-size:8;fill:#808080">
<text transform="matrix(1 0 0 1 6.50 39.50)">1</text>
- <text transform="matrix(1 0 0 1 4.50 68.50)">2</text>
- <text transform="matrix(1 0 0 1 19.50 16.50)">3</text>
+ <text transform="matrix(1 0 0 1 19.50 16.50)">2</text>
+ <text transform="matrix(1 0 0 1 4.50 68.50)">3</text>
<text transform="matrix(1 0 0 1 65.50 13.50)">4</text>
<text transform="matrix(1 0 0 1 44.25 37.50)">5</text>
<text transform="matrix(1 0 0 1 57.75 34.50)">6</text>
View
6 kanji/07af8-Kaisho.svg
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2009/2010/2011 Ulrich Apel.
-This work is distributed under the conditions of the Creative Commons
+This work is distributed under the conditions of the Creative Commons
Attribution-Share Alike 3.0 Licence. This means you are free:
* to Share - to copy, distribute and transmit the work
* to Remix - to adapt the work
@@ -129,8 +129,8 @@ kvg:type CDATA #IMPLIED >
<text transform="matrix(1 0 0 1 50.50 55.50)">17</text>
<text transform="matrix(1 0 0 1 60.50 45.50)">18</text>
<text transform="matrix(1 0 0 1 62.50 53.50)">19</text>
- <text transform="matrix(1 0 0 1 56.50 74.50)">20</text>
- <text transform="matrix(1 0 0 1 63.50 62.50)">21</text>
+ <text transform="matrix(1 0 0 1 63.50 62.50)">20</text>
+ <text transform="matrix(1 0 0 1 56.50 74.50)">21</text>
<text transform="matrix(1 0 0 1 80.50 73.50)">22</text>
</g>
</svg>
View
6 kanji/07af8.svg
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2009/2010/2011 Ulrich Apel.
-This work is distributed under the conditions of the Creative Commons
+This work is distributed under the conditions of the Creative Commons
Attribution-Share Alike 3.0 Licence. This means you are free:
* to Share - to copy, distribute and transmit the work
* to Remix - to adapt the work
@@ -129,8 +129,8 @@ kvg:type CDATA #IMPLIED >
<text transform="matrix(1 0 0 1 50.50 55.50)">17</text>
<text transform="matrix(1 0 0 1 60.50 45.50)">18</text>
<text transform="matrix(1 0 0 1 62.50 53.50)">19</text>
- <text transform="matrix(1 0 0 1 56.50 74.50)">20</text>
- <text transform="matrix(1 0 0 1 63.50 62.50)">21</text>
+ <text transform="matrix(1 0 0 1 63.50 62.50)">20</text>
+ <text transform="matrix(1 0 0 1 56.50 74.50)">21</text>
<text transform="matrix(1 0 0 1 80.50 73.50)">22</text>
</g>
</svg>
View
2  kanji/0877f.svg
@@ -74,7 +74,7 @@ kvg:type CDATA #IMPLIED >
<text transform="matrix(1 0 0 1 19.50 55.50)">3</text>
<text transform="matrix(1 0 0 1 17.50 16.50)">4</text>
<text transform="matrix(1 0 0 1 3.72 89.50)">5</text>
- <text transform="matrix(1 0 0 1 11.58 91.85)">6</text>
+ <text transform="matrix(1 0 0 1 31.5 67.0)">6</text>
<text transform="matrix(1 0 0 1 42.50 25.50)">7</text>
<text transform="matrix(1 0 0 1 54.50 16.50)">8</text>
<text transform="matrix(1 0 0 1 56.50 26.50)">9</text>
View
12 kanji/09a6b-Vt6.svg
@@ -103,16 +103,16 @@ kvg:type CDATA #IMPLIED >
<text transform="matrix(1 0 0 1 4.50 90.50)">17</text>
<text transform="matrix(1 0 0 1 13.50 95.50)">18</text>
<text transform="matrix(1 0 0 1 21.50 92.50)">19</text>
- <text transform="matrix(1 0 0 1 51.50 65.50)">20</text>
- <text transform="matrix(1 0 0 1 64.34 65.50)">21</text>
+ <text transform="matrix(1 0 0 1 30.25 89.50)">20</text>
+ <text transform="matrix(1 0 0 1 51.50 65.50)">21</text>
<text transform="matrix(1 0 0 1 62.50 55.50)">22</text>
<text transform="matrix(1 0 0 1 78.00 62.50)">23</text>
- <text transform="matrix(1 0 0 1 64.50 73.13)">24</text>
- <text transform="matrix(1 0 0 1 57.50 96.38)">25</text>
+ <text transform="matrix(1 0 0 1 64.34 65.50)">24</text>
+ <text transform="matrix(1 0 0 1 64.50 73.13)">25</text>
<text transform="matrix(1 0 0 1 64.38 81.50)">26</text>
<text transform="matrix(1 0 0 1 51.25 89.50)">27</text>
- <text transform="matrix(1 0 0 1 67.25 93.50)">28</text>
- <text transform="matrix(1 0 0 1 30.25 89.50)">29</text>
+ <text transform="matrix(1 0 0 1 57.50 96.38)">28</text>
+ <text transform="matrix(1 0 0 1 67.25 93.50)">29</text>
<text transform="matrix(1 0 0 1 75.25 90.50)">30</text>
</g>
</svg>
View
6 kanji/09a6b.svg
@@ -103,15 +103,15 @@ kvg:type CDATA #IMPLIED >
<text transform="matrix(1 0 0 1 4.50 90.50)">17</text>
<text transform="matrix(1 0 0 1 13.50 95.50)">18</text>
<text transform="matrix(1 0 0 1 21.50 92.50)">19</text>
- <text transform="matrix(1 0 0 1 64.34 65.50)">20</text>
+ <text transform="matrix(1 0 0 1 30.25 89.50)">20</text>
<text transform="matrix(1 0 0 1 51.50 65.50)">21</text>
<text transform="matrix(1 0 0 1 62.50 55.50)">22</text>
<text transform="matrix(1 0 0 1 78.00 62.50)">23</text>
- <text transform="matrix(1 0 0 1 57.50 96.38)">24</text>
+ <text transform="matrix(1 0 0 1 64.34 65.50)">24</text>
<text transform="matrix(1 0 0 1 64.50 73.13)">25</text>
<text transform="matrix(1 0 0 1 64.38 81.50)">26</text>
<text transform="matrix(1 0 0 1 51.25 89.50)">27</text>
- <text transform="matrix(1 0 0 1 30.25 89.50)">28</text>
+ <text transform="matrix(1 0 0 1 57.50 96.38)">28</text>
<text transform="matrix(1 0 0 1 67.25 93.50)">29</text>
<text transform="matrix(1 0 0 1 75.25 90.50)">30</text>
</g>
View
21 kvg.py
@@ -16,8 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os, os.path, sys, codecs, re, datetime
-from kanjivg import licenseString
+import os, sys, codecs, re, datetime
pathre = re.compile(r'<path .*d="([^"]*)".*/>')
@@ -27,6 +26,24 @@
merge file1 [ file2 ... ] merge path data from -paths suffixed file
release create single release file""" % (sys.argv[0],)
+
+licenseString = """Copyright (C) 2009/2010/2011 Ulrich Apel.
+This work is distributed under the conditions of the Creative Commons
+Attribution-Share Alike 3.0 Licence. This means you are free:
+* to Share - to copy, distribute and transmit the work
+* to Remix - to adapt the work
+
+Under the following conditions:
+* Attribution. You must attribute the work by stating your use of KanjiVG in
+ your own copyright header and linking to KanjiVG's website
+ (http://kanjivg.tagaini.net)
+* Share Alike. If you alter, transform, or build upon this work, you may
+ distribute the resulting work only under the same or similar license to this
+ one.
+
+See http://creativecommons.org/licenses/by-sa/3.0/ for more details."""
+
+
def createPathsSVG(f):
s = codecs.open(f, "r", "utf-8").read()
paths = pathre.findall(s)
Something went wrong with that request. Please try again.