diff --git a/SVG/200a4.svg b/SVG/200a4.svg new file mode 100644 index 000000000..2d3e62270 --- /dev/null +++ b/SVG/200a4.svg @@ -0,0 +1,45 @@ + + + + + + + + + + + + + 𠂤 + + + 1 + 2 + 3 + 4 + 5 + 6 + + + + + + + + + + diff --git a/SVG/342c.svg b/SVG/342c.svg new file mode 100644 index 000000000..569e3dd63 --- /dev/null +++ b/SVG/342c.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + + + + + + + + + + diff --git a/SVG/5345.svg b/SVG/5345.svg index 9f07937c9..eccf8442a 100644 --- a/SVG/5345.svg +++ b/SVG/5345.svg @@ -33,9 +33,9 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> 4 + - diff --git a/SVG/5c03.svg b/SVG/5c03.svg new file mode 100644 index 000000000..41d9fddb6 --- /dev/null +++ b/SVG/5c03.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + + + + + + + + + + + + diff --git a/SVG/852c.svg b/SVG/852c.svg index 8a319fbfb..fc2d4b693 100644 --- a/SVG/852c.svg +++ b/SVG/852c.svg @@ -47,6 +47,11 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> + + + + + @@ -54,10 +59,5 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - - - - - diff --git a/SVG/9766.svg b/SVG/9766.svg index e399e6040..0a612aac6 100644 --- a/SVG/9766.svg +++ b/SVG/9766.svg @@ -45,13 +45,6 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> 16 - - - - - - - diff --git a/XML/200a4.xml b/XML/200a4.xml new file mode 100644 index 000000000..a138b9250 --- /dev/null +++ b/XML/200a4.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + diff --git a/XML/342c.xml b/XML/342c.xml new file mode 100644 index 000000000..12a5c9f23 --- /dev/null +++ b/XML/342c.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/XML/4e17.xml b/XML/4e17.xml index c0d858f25..9174cea38 100644 --- a/XML/4e17.xml +++ b/XML/4e17.xml @@ -40,7 +40,7 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - + diff --git a/XML/5345.xml b/XML/5345.xml index 1e6fdb074..164a4ab37 100644 --- a/XML/5345.xml +++ b/XML/5345.xml @@ -31,7 +31,7 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - + diff --git a/XML/57e0.xml b/XML/57e0.xml index 7b6aea127..bc27c36f4 100644 --- a/XML/57e0.xml +++ b/XML/57e0.xml @@ -22,13 +22,15 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - - + + + + - - - - + + + + diff --git a/XML/5c02.xml b/XML/5c02.xml index 9e810dd41..a60411c2c 100644 --- a/XML/5c02.xml +++ b/XML/5c02.xml @@ -27,9 +27,9 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - - - + + + diff --git a/XML/5c03.xml b/XML/5c03.xml new file mode 100644 index 000000000..2478840a3 --- /dev/null +++ b/XML/5c03.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XML/65d2.xml b/XML/65d2.xml index 2a9dbf41a..f32d4aa4a 100644 --- a/XML/65d2.xml +++ b/XML/65d2.xml @@ -29,21 +29,23 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - - - - + + + + + + + + + + - - - + + + + - - - - - diff --git a/XML/68b3.xml b/XML/68b3.xml index 49797522d..c97f4762f 100644 --- a/XML/68b3.xml +++ b/XML/68b3.xml @@ -22,7 +22,7 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - + diff --git a/XML/68c4.xml b/XML/68c4.xml index b60231722..1ba18446e 100644 --- a/XML/68c4.xml +++ b/XML/68c4.xml @@ -16,44 +16,46 @@ Under the following conditions: See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XML/6bd3.xml b/XML/6bd3.xml index 4e689a555..e4a0def91 100644 --- a/XML/6bd3.xml +++ b/XML/6bd3.xml @@ -31,7 +31,7 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - + diff --git a/XML/6d41.xml b/XML/6d41.xml index ff50d9e94..25c5c4f45 100644 --- a/XML/6d41.xml +++ b/XML/6d41.xml @@ -21,16 +21,18 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - - - - + + + + + + + + + + - - - - - + diff --git a/XML/6ede.xml b/XML/6ede.xml index 9082e2ae8..8de7a2d70 100644 --- a/XML/6ede.xml +++ b/XML/6ede.xml @@ -45,7 +45,7 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - + diff --git a/XML/7409.xml b/XML/7409.xml index 2facbdde0..7cd92315f 100644 --- a/XML/7409.xml +++ b/XML/7409.xml @@ -22,7 +22,7 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - + diff --git a/XML/758f.xml b/XML/758f.xml index 87b9d95e5..e3b570f56 100644 --- a/XML/758f.xml +++ b/XML/758f.xml @@ -27,7 +27,7 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - + diff --git a/XML/852c.xml b/XML/852c.xml index 14e7aaca7..49736ebee 100644 --- a/XML/852c.xml +++ b/XML/852c.xml @@ -33,7 +33,7 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - + @@ -50,6 +50,6 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - + diff --git a/XML/91af.xml b/XML/91af.xml index 3127c3827..a62d2994f 100644 --- a/XML/91af.xml +++ b/XML/91af.xml @@ -33,21 +33,23 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - - - - + + + + + + + + + + - - - + + + + - - - - - diff --git a/XML/961c.xml b/XML/961c.xml index aec3cc2c6..a9feae427 100644 --- a/XML/961c.xml +++ b/XML/961c.xml @@ -15,14 +15,16 @@ Under the following conditions: See http://creativecommons.org/licenses/by-sa/3.0/ for more details. --> - - - + + + + + - - - - + + + + diff --git a/kanjivg.py b/kanjivg.py index c3c93af97..52487a0a4 100644 --- a/kanjivg.py +++ b/kanjivg.py @@ -34,8 +34,7 @@ Under the following conditions: See http://creativecommons.org/licenses/by-sa/3.0/ for more details.""" -def isKanji(c): - v = realord(c) +def isKanji(v): return (v >= 0x4E00 and v <= 0x9FC3) or (v >= 0x3400 and v <= 0x4DBF) or (v >= 0xF900 and v <= 0xFAD9) or (v >= 0x2E80 and v <= 0x2EFF) or (v >= 0x20000 and v <= 0x2A6DF) # Returns the unicode of a character in a unicode string, taking surrogate pairs into account @@ -252,6 +251,17 @@ class StructuredKanji: stk = [] self.__buildStructure(kanji.root, stk, None) + def __mostCommonAncestor(self, np, npp): + # Update the parent to the most common parent of all parts + npSave = np + if np != None: + while np != npp: + np = np.parent + if np == None: + npp = npp.parent + np = npSave + return np + def __buildStructure(self, group, stk, parent): # Find the component if it exists already, or create it as needed # Number exists and part is > 1, we must find a component which number matches. @@ -260,6 +270,7 @@ class StructuredKanji: for component in self.components: if component.element == group.element and component.number == group.number: newParent = component + component.parent = self.__mostCommonAncestor(component.parent, parent) break # Should never happen if not newParent: raise Exception("Unable to find component!") @@ -268,6 +279,7 @@ class StructuredKanji: for component in self.components: if component.element == group.element: newParent = component + component.parent = self.__mostCommonAncestor(component.parent, parent) break if not newParent: raise Exception("Unable to find component!") # Either a single part component or a first part - we need to create the component