aboutsummaryrefslogtreecommitdiff
path: root/src/SVG/SVG2zinc.pm
diff options
context:
space:
mode:
Diffstat (limited to 'src/SVG/SVG2zinc.pm')
-rw-r--r--src/SVG/SVG2zinc.pm19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/SVG/SVG2zinc.pm b/src/SVG/SVG2zinc.pm
index 54c369c..75e1429 100644
--- a/src/SVG/SVG2zinc.pm
+++ b/src/SVG/SVG2zinc.pm
@@ -1164,12 +1164,19 @@ my %save_current_context = ();
my $theText = join ('', @texts);
$res .= ", -text => '$theText', -priority => 10);";
my @ascent;
+ if ($current_font_key =~ /^XLFD/) {
+ my $fontname = $current_font_key;
+ $fontname =~ s/^XLFD//;
+ push (@ascent, "\$ascent = int(\`xlsfonts -l -fn '$fontname' |tail -1|cut -c 31-33\`);");
+ } else {
+ push (@ascent, "\$ascent = -> fontMetrics (\$fonts{\"$current_font_key\"}, -ascent);");
+ }
if ($text_x != 0 || $text_y != 0)
{
- push (@ascent, "-> translate(\$previous, $text_x, $text_y);");
+ push (@ascent, "-> translate(\$previous, $text_x, $text_y - \$ascent);");
+ } else {
+ push (@ascent, "-> translate(\$previous,0, -\$ascent);");
}
- push (@ascent, "\$ascent = -> fontMetrics (\$fonts{\"$current_font_key\"}, -ascent);");
- push (@ascent, "-> translate(\$previous,0, -\$ascent);");
&ddisplay ($res, @ascent, @transforms);
@@ -1745,7 +1752,7 @@ sub analyze_text_style_hash
foreach my $key (keys %keyvalues)
{
my $value = $keyvalues{$key};
- next if (!defined $value); # in this case, the SVG code is invalide (TBC)
+ next if (!defined $value); # in this case, the SVG code is invalid (TBC)
if ($key eq 'text-anchor')
{
if ($value eq 'start')
@@ -1771,7 +1778,7 @@ sub analyze_text_style_hash
elsif ($key eq 'visibility')
{
## BUG? if a "not-visible" <g> group contains a visible graphic element
- ## this element WILL NOT be visible in TkZinc , but should be visible in SVG!!
+ ## this element WILL NOT be visible in TkZinc, but should be visible in SVG!!
## Cf specif svg p. 284
if ($value eq 'hidden' or $value eq 'collapse')
{
@@ -1781,7 +1788,7 @@ sub analyze_text_style_hash
}
elsif ($key eq 'font-family')
{
- $value =~ s/\'//g; # on removing quotes around the fonte name
+ $value =~ s/\'//g; # on removing quotes around the font name
$fontFamily = $value;
}
elsif ($key eq 'font-size')