aboutsummaryrefslogtreecommitdiff
path: root/src/SVG/SVG2zinc/Conversions.pm
diff options
context:
space:
mode:
Diffstat (limited to 'src/SVG/SVG2zinc/Conversions.pm')
-rw-r--r--src/SVG/SVG2zinc/Conversions.pm64
1 files changed, 36 insertions, 28 deletions
diff --git a/src/SVG/SVG2zinc/Conversions.pm b/src/SVG/SVG2zinc/Conversions.pm
index fccd4ae..ad3abeb 100644
--- a/src/SVG/SVG2zinc/Conversions.pm
+++ b/src/SVG/SVG2zinc/Conversions.pm
@@ -112,38 +112,46 @@ sub createNamedFont {
$last_key = $fullFamily;
}
my $family = lc($fullFamily);
-
- $weight = "normal" unless $weight;
- if ( $size =~ /(.*)pt/ )
- {
- $size = -$1;
- }
- elsif ( $size =~ /(.*)px/ )
- {
- $size = -$1;
- }
- elsif ( $size =~ /(\d*(.\d*)?)\s*$/ )
- {
- $size = -$1;
- }
+
+ my ($fontName, $fontKey);
+ if ($family =~ /^-[^-]*-([^-]*)-([^-]*)-[^-]*-[^-]*-[^-]*-([^-]*)-[^-]*-[^-]*-[^-]*-[^-]*-[^-]*-[^-]*-[^-]*$/ ) {
+ $weight = $2;
+ $size = $3;
+ $fontKey = "XLFD$family";
+ $fontName = $family;
+ $family = $1;
+ } else {
+ $weight = "normal" unless $weight;
+ if ( $size =~ /(.*)pt/ )
+ {
+ $size = -$1;
+ }
+ elsif ( $size =~ /(.*)px/ )
+ {
+ $size = -$1;
+ }
+ elsif ( $size =~ /(\d*(.\d*)?)\s*$/ )
+ {
+ $size = -$1;
+ }
# $size = &float2int($size); # I round the font size, at least until we have vectorial font in Tk::Zinc
$family = $fontsMapping{$family} if defined $fontsMapping{$family};
- if ( $family =~ /(\w*)-bold/ )
- {
- $family = $1;
- $weight = "bold";
- }
- else
- {
- if ($weight eq '') {
- $weight = "medium";
- }
- }
+ if ( $family =~ /(\w*)-bold/ )
+ {
+ $family = $1;
+ $weight = "bold";
+ }
+ else
+ {
+ if ($weight eq '') {
+ $weight = "medium";
+ }
+ }
- my $fontKey = join "_", ($family, $size, $weight);
- my $fontName = $family;
- $fontKey =~ s/^-/XLFD-/;
+ $fontKey = join "_", ($family, $size, $weight);
+ $fontName = $family;
+ }
if (!defined $fonts{$fontKey})
{
$fonts{$fontKey} = $fontKey;