1
0
mirror of https://github.com/KanjiVG/kanjivg.git synced 2026-04-20 04:20:44 +02:00

Fixed reversed 0x7886 kanji

This commit is contained in:
Ben Bullock
2011-07-13 15:11:41 +09:00
parent 2c9ab3d338
commit 47e262f741
2 changed files with 81 additions and 5 deletions

View File

@@ -42,11 +42,6 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. -->
<text transform="matrix(1 0 0 1 43.5835 94.1465)">13</text>
</g>
<g id="StrokePaths" style="fill:none;stroke:#404040;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;">
<path d="M22.23,67.71c1.24,0.29,4.01,0.36,5.25,0.29c15.55-1,39.15-3.37,57.8-3.53c2.07-0.02,3.31,0.13,4.35,0.28"/>
<path d="M44.18,67.04c0.08,0.61,0.17,1.58-0.16,2.46C42.03,74.68,30.61,86.06,15,93.03"/>
<path d="M38.3,80.07c0.49,0.39,1.09,1.98,1.17,2.5c0.61,3.74,1.71,9.89,2.54,16.97"/>
<path d="M39.26,81.55c8.97-0.77,31.89-3.35,38.01-3.47c2.53-0.05,2.97,1.99,2.68,3.14C79,84.93,77.3,88.75,76,95.32"/>
<path d="M41.81,97.4c7.17-0.31,27.9-1.84,37.05-1.93"/>
<path d="M25.25,12.2c3.68,1.29,9.51,4.45,10.42,6.48"/>
<path d="M20.13,26.31c3.81,1.1,9.83,4.99,10.78,6.69"/>
<path d="M18.75,55.99c1.67,1.16,3.68,1.2,4.73-0.22c3.06-4.16,6.73-10.81,9.51-16.12"/>
@@ -55,5 +50,10 @@ See http://creativecommons.org/licenses/by-sa/3.0/ for more details. -->
<path d="M64.66,8.23c0.89,0.32,1.42,1.45,1.6,2.1c0.18,0.65-0.06,13.62-0.06,20.24"/>
<path d="M54.78,33.14c0.89,0.2,1.46,0.14,3.26-0.07c2.67-0.3,14.95-3.01,16.58-2.69s3.48,0.88,1.88,3.32c-4.75,7.25-17.19,21.01-30,24"/>
<path d="M53.98,38.4c4.77,0.05,21.52,11.3,33.61,15.66c1.68,0.6,3.05,0.72,4.69,0.97"/>
<path d="M22.23,67.71c1.24,0.29,4.01,0.36,5.25,0.29c15.55-1,39.15-3.37,57.8-3.53c2.07-0.02,3.31,0.13,4.35,0.28"/>
<path d="M44.18,67.04c0.08,0.61,0.17,1.58-0.16,2.46C42.03,74.68,30.61,86.06,15,93.03"/>
<path d="M38.3,80.07c0.49,0.39,1.09,1.98,1.17,2.5c0.61,3.74,1.71,9.89,2.54,16.97"/>
<path d="M39.26,81.55c8.97-0.77,31.89-3.35,38.01-3.47c2.53-0.05,2.97,1.99,2.68,3.14C79,84.93,77.3,88.75,76,95.32"/>
<path d="M41.81,97.4c7.17-0.31,27.9-1.84,37.05-1.93"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

76
find-radical.pl Executable file
View File

@@ -0,0 +1,76 @@
#!/home/ben/software/install/bin/perl
use warnings;
use strict;
use FindBin;
use XML::Parser;
use Image::SVG::Path 'extract_path_info';
use utf8;
my $string = qr/kanjivg:element="氵"/;
my @files = <$FindBin::Bin/kanjivg/*.svg>;
my @matches;
for my $file (@files) {
open my $in, "<:encoding(utf8)", $file
or die $!;
while (<$in>) {
if (/$string/) {
push @matches, $file;
# print "$file matches.\n";
}
}
close $in or die $!;
}
my $start;
my $count;
my %global;
my $parser = XML::Parser->new (
Handlers => {
Start => \& handle_start
},
);
binmode STDOUT, "utf8";
for my $file (@matches) {
# print "Parsing '$file'.\n";
$global{file} = $file;
$parser->parsefile ($file);
}
sub handle_start
{
my ($parser, $element, %attr) = @_;
if ($element eq 'g') {
my $kvg = $attr{'kanjivg:element'};
if ($kvg) {
if ($kvg eq '氵') {
#print "Found '$kvg' in '$global{file}'\n";
$start = 1;
$count = 0;
}
}
else {
$start = undef;
$count = 0;
}
}
if ($start && $element eq 'path') {
$count++;
if ($count == 3) {
my $d = $attr{d};
my @values = extract_path_info ($d, {
no_shortcuts => 1,
absolute => 1,
});
my @start = @{$values[0]->{point}};
my @end = @{$values[-1]->{end}};
my $x_diff = $end[0] - $start[0];
my $y_diff = $end[1] - $start[1];
if ($x_diff < 0 || $y_diff > 0) {
printf ("file $global{file}: %d %d\n", $x_diff, $y_diff);
}
}
}
}