summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6302669)
raw | patch | inline | side by side (parent: 6302669)
author | JazzyNico <nicoduf@yahoo.fr> | |
Thu, 23 Dec 2010 18:46:43 +0000 (19:46 +0100) | ||
committer | JazzyNico <nicoduf@yahoo.fr> | |
Thu, 23 Dec 2010 18:46:43 +0000 (19:46 +0100) |
Extensions. FXG export extension improvements and clean-up (Bug #625140, Support export to FXG).
index d67430c6032ef3db8c34179e2ff0e77a2735c0f5..2422482a77b64d86cb33f2749d900a0734bdc73a 100644 (file)
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
- <_name>Color Markers to Match Stroke</_name>
- <id>org.ekips.filter.markers.strokepaint</id>
- <dependency type="executable" location="extensions">markers_strokepaint.py</dependency>
- <dependency type="executable" location="extensions">inkex.py</dependency>
- <param name="type" type="enum" _gui-text="Replace marker fill with:">
- <_item value="stroke">stroke color</_item>
- <_item value="fill">fill color</_item>
- <_item value="white">opaque white</_item>
- <_item value="transparency">transparency</_item>
- </param>
- <param name="alpha" type="boolean" _gui-text="Assign alpha">true</param>
- <effect>
- <object-type>all</object-type>
- <effects-menu>
- <submenu _name="Modify Path"/>
- </effects-menu>
- </effect>
- <script>
- <command reldir="extensions" interpreter="python">markers_strokepaint.py</command>
- </script>
+ <_name>Color Markers</_name>
+ <id>org.ekips.filter.markers.strokepaint</id>
+ <dependency type="executable" location="extensions">markers_strokepaint.py</dependency>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+
+ <param name='tab' type="notebook">
+ <page name='object' _gui-text="From object">
+ <param name="type" type="enum" _gui-text="Marker type:">
+ <_item value="solid">solid</_item>
+ <_item value="filled">filled</_item>
+ </param>
+ <param name="invert" type="boolean" _gui-text="Invert fill and stroke colors">false</param>
+ <param name="alpha" type="boolean" _gui-text="Assign alpha">true</param>
+ </page>
+ <page name='custom' _gui-text="Custom">
+ <param name="colortab" type="notebook">
+ <page name="fill_page" _gui-text="Fill">
+ <param name="assign_fill" type="boolean" _gui-text="Assign fill color">true</param>
+ <param name="fill_color" gui-text="Fill color" type="color">-1</param>
+ </page>
+ <page name="stroke_page" _gui-text="Stroke">
+ <param name="assign_stroke" type="boolean" _gui-text="Assign stroke color">true</param>
+ <param name="stroke_color" gui-text="Stroke color" type="color">255</param>
+ </page>
+ </param>
+ </page>
+ </param>
+
+ <effect>
+ <object-type>all</object-type>
+ <effects-menu>
+ <submenu _name="Modify Path"/>
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">markers_strokepaint.py</command>
+ </script>
</inkscape-extension>
index bf5b530351f690b817f6c7fb4ff22f5d166e0d1d..e37c816561b6992729ef2797ca64d1de85c795b8 100644 (file)
#!/usr/bin/env python
'''
Copyright (C) 2006 Aaron Spike, aaron@ekips.org
+Copyright (C) 2010 Nicolas Dufour, nicoduf@yahoo.fr (color options)
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
self.OptionParser.add_option("-t", "--type",
action="store", type="string",
dest="fill_type", default="stroke",
- help="Replace the marker fill with the object stroke or fill color")
+ help="Replace the markers' fill with the object stroke or fill color")
self.OptionParser.add_option("-a", "--alpha",
action="store", type="inkbool",
dest="assign_alpha", default=True,
- help="Assign the object fill and stroke alpha to the marker")
+ help="Assign the object fill and stroke alpha to the markers")
+ self.OptionParser.add_option("-i", "--invert",
+ action="store", type="inkbool",
+ dest="invert", default=False,
+ help="Invert fill and stroke colors")
+ self.OptionParser.add_option("--assign_fill",
+ action="store", type="inkbool",
+ dest="assign_fill", default=True,
+ help="Assign a fill color to the markers")
+ self.OptionParser.add_option("-f", "--fill_color",
+ action="store", type="int",
+ dest="fill_color", default=1364325887,
+ help="Choose a custom fill color")
+ self.OptionParser.add_option("--assign_stroke",
+ action="store", type="inkbool",
+ dest="assign_stroke", default=True,
+ help="Assign a stroke color to the markers")
+ self.OptionParser.add_option("-s", "--stroke_color",
+ action="store", type="int",
+ dest="stroke_color", default=1364325887,
+ help="Choose a custom fill color")
+ self.OptionParser.add_option("--tab",
+ action="store", type="string",
+ dest="tab",
+ help="The selected UI-tab when OK was pressed")
+ self.OptionParser.add_option("--colortab",
+ action="store", type="string",
+ dest="colortab",
+ help="The selected cutom color tab when OK was pressed")
def effect(self):
defs = self.xpathSingle('/svg:svg//svg:defs')
except:
inkex.errormsg(_("No style attribute found for id: %s") % id)
continue
-
- stroke = style.get('stroke', '#000000')
- stroke_opacity = style.get('stroke-opacity', '1')
- if (self.options.fill_type == "white"):
- fill = "#FFFFFF"
- fill_opacity = "1"
- else:
- fill = style.get('fill', '#000000')
- fill_opacity = style.get('fill-opacity', '1')
+
+ # Use object colors
+ if self.options.tab == '"object"':
+ temp_stroke = style.get('stroke', '#000000')
+ temp_fill = style.get('fill', '#000000')
+ if (self.options.invert):
+ fill = temp_stroke
+ stroke = temp_fill
+ else:
+ fill = temp_fill
+ stroke = temp_stroke
+ if (self.options.assign_alpha):
+ temp_stroke_opacity = style.get('stroke-opacity', '1')
+ temp_fill_opacity = style.get('fill-opacity', '1')
+ if (self.options.invert):
+ fill_opacity = temp_stroke_opacity
+ stroke_opacity = temp_fill_opacity
+ else:
+ fill_opacity = temp_fill_opacity
+ stroke_opacity = temp_stroke_opacity
+ if (self.options.fill_type == "solid"):
+ fill = stroke
+ if (self.options.assign_alpha):
+ fill_opacity = stroke_opacity
+ # Choose custom colors
+ elif self.options.tab == '"custom"':
+ fill_red = ((self.options.fill_color >> 24) & 255)
+ fill_green = ((self.options.fill_color >> 16) & 255)
+ fill_blue = ((self.options.fill_color >> 8) & 255)
+ fill = "rgb(%s,%s,%s)" % (fill_red, fill_green, fill_blue)
+ fill_opacity = (((self.options.fill_color) & 255) / 255.)
+ stroke_red = ((self.options.stroke_color >> 24) & 255)
+ stroke_green = ((self.options.stroke_color >> 16) & 255)
+ stroke_blue = ((self.options.stroke_color >> 8) & 255)
+ stroke = "rgb(%s,%s,%s)" % (stroke_red, stroke_green, stroke_blue)
+ stroke_opacity = (((self.options.stroke_color) & 255) / 255.)
+ if (not(self.options.assign_fill)):
+ fill = "none";
+ if (not(self.options.assign_stroke)):
+ stroke = "none";
for mprop in mprops:
if style.has_key(mprop) and style[mprop] != 'none'and style[mprop][:5] == 'url(#':
children = mnode.xpath('.//*[@style]', namespaces=inkex.NSS)
for child in children:
cstyle = simplestyle.parseStyle(child.get('style'))
- if ('stroke' in cstyle and cstyle['stroke'] != 'none') or 'stroke' not in cstyle:
+ if (not(self.options.tab == '"object"' and cstyle['stroke'] == 'none' and self.options.fill_type == "filled")):
cstyle['stroke'] = stroke
- if (self.options.assign_alpha):
+ if 'stroke_opacity' in locals():
cstyle['stroke-opacity'] = stroke_opacity
- if ('fill' in cstyle and cstyle['fill'] != 'none') or 'fill' not in cstyle:
- if (self.options.fill_type == "fill" or self.options.fill_type == "white" ):
- cstyle['fill'] = fill
- if (self.options.assign_alpha):
- cstyle['fill-opacity'] = fill_opacity
- elif (self.options.fill_type == "stroke"):
- cstyle['fill'] = stroke
- if (self.options.assign_alpha):
- cstyle['fill-opacity'] = stroke_opacity
- else:
- cstyle['fill'] = "none";
- cstyle['fill-opacity'] = "0"
+ if (not(self.options.tab == '"object"' and cstyle['fill'] == 'none' and self.options.fill_type == "solid")):
+ cstyle['fill'] = fill
+ if 'fill_opacity' in locals():
+ cstyle['fill-opacity'] = fill_opacity
child.set('style',simplestyle.formatStyle(cstyle))
node.set('style',simplestyle.formatStyle(style))
index 7f809655bf5a0ce313dfb15ccedc0bbb51e1345f..7569d0db7deadc3a3ee44c1ccf9cd296e3eb0255 100755 (executable)
* Text flowPara
* Text flowRegion (text frame)
* Font size
+ * Font weight
+ * Font family
+ * Font style
* Baseline shift
+ * Line height
* Writing mode
* Text decoration
+ * Text fill
* Text direction
* Text size
* Text position
+ * Text object
+ * FlowRoot object
-->
<!--
-->
<xsl:template mode="forward" match="*[name(.) = 'tspan' or name(.) = 'flowSpan']">
<span>
+ <xsl:if test="../@xml:space='preserve'">
+ <xsl:attribute name="whiteSpaceCollapse">preserve</xsl:attribute>
+ </xsl:if>
<xsl:variable name="fill">
<xsl:apply-templates mode="fill" select="." />
</xsl:variable>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="font_size" select="." />
- <xsl:apply-templates mode="baseline_shift" select="." />
+ <xsl:apply-templates mode="font_weight" select="." />
+ <xsl:apply-templates mode="font_family" select="." />
+ <xsl:apply-templates mode="font_style" select="." />
+ <xsl:apply-templates mode="text_fill" select="." />
<xsl:apply-templates mode="text_decoration" select="." />
+ <xsl:apply-templates mode="line_height" select="." />
+ <xsl:apply-templates mode="baseline_shift" select="." />
<xsl:if test="text()">
<xsl:value-of select="text()" />
-->
<xsl:template mode="forward" match="*[name(.) = 'flowPara' or name(.) = 'flowDiv']">
<p>
+ <xsl:if test="../@xml:space='preserve'">
+ <xsl:attribute name="whiteSpaceCollapse">preserve</xsl:attribute>
+ </xsl:if>
<xsl:variable name="fill">
<xsl:apply-templates mode="fill" select="." />
</xsl:variable>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="font_size" select="." />
- <xsl:apply-templates mode="baseline_shift" select="." />
+ <xsl:apply-templates mode="font_weight" select="." />
+ <xsl:apply-templates mode="font_family" select="." />
+ <xsl:apply-templates mode="font_style" select="." />
+ <xsl:apply-templates mode="text_fill" select="." />
<xsl:apply-templates mode="text_decoration" select="." />
+ <xsl:apply-templates mode="line_height" select="." />
+ <xsl:apply-templates mode="baseline_shift" select="." />
<xsl:choose>
<xsl:when test="*[name(.) = 'flowSpan']/text()">
</xsl:if>
</xsl:template>
+<!--
+ // Text font weight //
+ SVG: font-weight, FXG: fontWeight
+-->
+<xsl:template mode="font_weight" match="*">
+ <xsl:variable name="value">
+ <xsl:if test="@font-weight">
+ <xsl:value-of select="@font-weight" />
+ </xsl:if>
+ <xsl:if test="@style and contains(@style, 'font-weight:')">
+ <xsl:variable name="font_weight" select="normalize-space(substring-after(@style, 'font-weight:'))" />
+ <xsl:choose>
+ <xsl:when test="contains($font_weight, ';')">
+ <xsl:value-of select="substring-before($font_weight, ';')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$font_weight" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="$value != ''">
+ <xsl:attribute name="fontWeight">
+ <xsl:choose>
+ <xsl:when test="$value='normal' or $value='bold'">
+ <xsl:value-of select="$value" />
+ </xsl:when>
+ <xsl:when test="$value < 500 or $value = 'lighter'">normal</xsl:when>
+ <xsl:when test="$value > 499 or $value = 'bolder'">bold</xsl:when>
+ <xsl:otherwise>normal</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<!--
+ // Text font family //
+ SVG: font-family, FXG: fontFamily
+-->
+<xsl:template mode="font_family" match="*">
+ <xsl:variable name="value">
+ <xsl:if test="@font-family">
+ <xsl:value-of select="translate(@font-family, "'", '')" />
+ </xsl:if>
+ <xsl:if test="@style and contains(@style, 'font-family:')">
+ <xsl:variable name="font_family" select="normalize-space(substring-after(@style, 'font-family:'))" />
+ <xsl:choose>
+ <xsl:when test="contains($font_family, ';')">
+ <xsl:value-of select="translate(substring-before($font_family, ';'), "'", '')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate($font_family, "'", '')" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="$value != ''">
+ <xsl:attribute name="fontFamily">
+ <xsl:choose>
+ <xsl:when test="$value='Sans'">Arial</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$value" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
+<!--
+ // Text font style //
+ SVG: font-style, FXG: fontStyle
+-->
+<xsl:template mode="font_style" match="*">
+ <xsl:variable name="value">
+ <xsl:if test="@font-style">
+ <xsl:value-of select="@font-style" />
+ </xsl:if>
+ <xsl:if test="@style and contains(@style, 'font-style:')">
+ <xsl:variable name="font_style" select="normalize-space(substring-after(@style, 'font-style:'))" />
+ <xsl:choose>
+ <xsl:when test="contains($font_style, ';')">
+ <xsl:value-of select="substring-before($font_style, ';')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$font_style" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="$value != ''">
+ <xsl:attribute name="fontStyle">
+ <xsl:value-of select="$value" />
+ </xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
<!--
// Text baseline shift //
SVG: baseline-shift, FXG: baselineShift
</xsl:if>
</xsl:template>
+<!--
+ // Text line height //
+ SVG: line-height, FXG: lineHeight
+-->
+<xsl:template mode="line_height" match="*">
+ <xsl:variable name="value">
+ <xsl:if test="@line-height">
+ <xsl:value-of select="@line-height" />
+ </xsl:if>
+ <xsl:if test="@style and contains(@style, 'line-height:')">
+ <xsl:variable name="line_height" select="normalize-space(substring-after(@style, 'line-height:'))" />
+ <xsl:choose>
+ <xsl:when test="contains($line_height, ';')">
+ <xsl:value-of select="substring-before($line_height, ';')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$line_height" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:if test="$value != ''">
+ <xsl:attribute name="lineHeight">
+ <xsl:call-template name="convert_unit">
+ <xsl:with-param name="convert_value" select="$value" />
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
<!--
// Text writing mode //
SVG: writing-mode, FXG: blockProgression
</xsl:choose>
</xsl:if>
</xsl:template>
-
+
+<!--
+ // Text fill //
+ SVG: fill, fill-opacity, FXG: color, textAlpha
+-->
+<xsl:template mode="text_fill" match="*">
+ <xsl:variable name="fill">
+ <xsl:apply-templates mode="fill" select="." />
+ </xsl:variable>
+ <xsl:variable name="fill_opacity">
+ <xsl:apply-templates mode="fill_opacity" select="." />
+ </xsl:variable>
+ <xsl:if test="starts-with($fill, '#') or (not(starts-with($fill, 'url')) and $fill != '' and $fill != 'none')">
+ <xsl:attribute name="color">
+ <xsl:call-template name="template_color">
+ <xsl:with-param name="colorspec">
+ <xsl:value-of select="$fill" />
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="textAlpha">
+ <xsl:value-of select="$fill_opacity" />
+ </xsl:attribute>
+ </xsl:if>
+</xsl:template>
+
<!--
// Text direction //
SVG: direction, unicode-bidi, FXG: direction
</xsl:if>
</xsl:template>
-<!--
- // Objects //
-
- * Text
- * Lines
- * Rectangle
- * Path
- * Ellipse
- * Circle
- * Image
- * Polygon (not supported)
- * Polyline (not supported)
--->
<!--
// Text objects //
<xsl:template mode="forward" match="*[name(.) = 'text']">
<xsl:variable name="object">
<RichText>
- <xsl:apply-templates mode="font_size" select="." />
-
- <xsl:variable name="font_weight">
- <xsl:if test="@font-weight">
- <xsl:value-of select="@font-weight" />
- </xsl:if>
- <xsl:if test="@style and contains(@style, 'font-weight:') and not(contains(substring-after(@style, 'font-weight:'), ';'))">
- <xsl:value-of select="substring-after(@style, 'font-weight:')" />
- </xsl:if>
- <xsl:if test="@style and contains(@style, 'font-weight:') and contains(substring-after(@style, 'font-weight:'), ';')">
- <xsl:value-of select="substring-before(substring-after(@style, 'font-weight:'), ';')" />
- </xsl:if>
- </xsl:variable>
- <xsl:attribute name="fontWeight">
- <xsl:choose>
- <xsl:when test="$font_weight='normal' or $font_weight='bold'">
- <xsl:value-of select="$font_weight" />
- </xsl:when>
- <xsl:when test="$font_weight < 500 or $font_weight = 'lighter'">normal</xsl:when>
- <xsl:when test="$font_weight > 499 or $font_weight = 'bolder'">bold</xsl:when>
- <xsl:otherwise>normal</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <xsl:if test="@font-family">
- <xsl:attribute name="fontFamily">
- <xsl:value-of select="translate(@font-family, "'", '')" />
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@style and contains(@style, 'font-family:')">
- <xsl:variable name="font_family" select="substring-after(@style, 'font-family:')" />
- <xsl:attribute name="fontFamily">
- <xsl:choose>
- <xsl:when test="contains($font_family, ';')">
- <xsl:value-of select="translate(substring-before($font_family, ';'), "'", '')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="translate($font_family, "'", '')" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@font-style">
- <xsl:attribute name="fontStyle">
- <xsl:value-of select="@font-style" />
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@style and contains(@style, 'font-style:')">
- <xsl:variable name="font_style" select="substring-after(@style, 'font-style:')" />
- <xsl:attribute name="fontStyle">
- <xsl:choose>
- <xsl:when test="contains($font_style, ';')">
- <xsl:value-of select="substring-before($font_style, ';')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$font_style" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:if>
-
- <xsl:variable name="fill">
- <xsl:apply-templates mode="fill" select="." />
- </xsl:variable>
- <xsl:variable name="fill_opacity">
- <xsl:apply-templates mode="fill_opacity" select="." />
- </xsl:variable>
-
- <xsl:if test="starts-with($fill, '#') or (not(starts-with($fill, 'url')) and $fill != '' and $fill != 'none')">
- <xsl:attribute name="color">
- <xsl:call-template name="template_color">
- <xsl:with-param name="colorspec">
- <xsl:value-of select="$fill" />
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="textAlpha">
- <xsl:value-of select="$fill_opacity" />
- </xsl:attribute>
- </xsl:if>
-
<!-- Force default baseline to "ascent" -->
<xsl:attribute name="alignmentBaseline">ascent</xsl:attribute>
- <xsl:if test="@xml:space='preserve'">
- <xsl:attribute name="whiteSpaceCollapse">preserve</xsl:attribute>
- </xsl:if>
-
+ <xsl:apply-templates mode="font_size" select="." />
+ <xsl:apply-templates mode="font_weight" select="." />
+ <xsl:apply-templates mode="font_family" select="." />
+ <xsl:apply-templates mode="font_style" select="." />
+ <xsl:apply-templates mode="text_fill" select="." />
+ <xsl:apply-templates mode="text_decoration" select="." />
+ <xsl:apply-templates mode="line_height" select="." />
<xsl:apply-templates mode="text_size" select="." />
<xsl:apply-templates mode="text_position" select="." />
- <xsl:apply-templates mode="text_decoration" select="." />
<xsl:apply-templates mode="direction" select="." />
<xsl:apply-templates mode="writing_mode" select="." />
<xsl:apply-templates mode="id" select="." />
+ <xsl:if test="not(*[name(.) = 'tspan']/text())">
+ <xsl:attribute name="whiteSpaceCollapse">preserve</xsl:attribute>
+ </xsl:if>
+
<xsl:apply-templates mode="filter_effect" select="." />
<xsl:apply-templates mode="desc" select="." />
-
<!--xsl:apply-templates mode="forward" /-->
<content>
<xsl:choose>
<xsl:template mode="forward" match="*[name(.) = 'flowRoot']">
<xsl:variable name="object">
<RichText>
- <xsl:apply-templates mode="font_size" select="." />
-
- <xsl:variable name="font_weight">
- <xsl:if test="@font-weight">
- <xsl:value-of select="@font-weight" />
- </xsl:if>
- <xsl:if test="@style and contains(@style, 'font-weight:') and not(contains(substring-after(@style, 'font-weight:'), ';'))">
- <xsl:value-of select="substring-after(@style, 'font-weight:')" />
- </xsl:if>
- <xsl:if test="@style and contains(@style, 'font-weight:') and contains(substring-after(@style, 'font-weight:'), ';')">
- <xsl:value-of select="substring-before(substring-after(@style, 'font-weight:'), ';')" />
- </xsl:if>
- </xsl:variable>
- <xsl:attribute name="fontWeight">
- <xsl:choose>
- <xsl:when test="$font_weight='normal' or $font_weight='bold'">
- <xsl:value-of select="$font_weight" />
- </xsl:when>
- <xsl:when test="$font_weight < 500 or $font_weight = 'lighter'">normal</xsl:when>
- <xsl:when test="$font_weight > 499 or $font_weight = 'bolder'">bold</xsl:when>
- <xsl:otherwise>normal</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <xsl:if test="@font-family">
- <xsl:attribute name="fontFamily">
- <xsl:value-of select="translate(@font-family, "'", '')" />
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@style and contains(@style, 'font-family:')">
- <xsl:variable name="font_family" select="substring-after(@style, 'font-family:')" />
- <xsl:attribute name="fontFamily">
- <xsl:choose>
- <xsl:when test="contains($font_family, ';')">
- <xsl:value-of select="translate(substring-before($font_family, ';'), "'", '')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="translate($font_family, "'", '')" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@font-style">
- <xsl:attribute name="fontStyle">
- <xsl:value-of select="@font-style" />
- </xsl:attribute>
- </xsl:if>
- <xsl:if test="@style and contains(@style, 'font-style:')">
- <xsl:variable name="font_style" select="substring-after(@style, 'font-style:')" />
- <xsl:attribute name="fontStyle">
- <xsl:choose>
- <xsl:when test="contains($font_style, ';')">
- <xsl:value-of select="substring-before($font_style, ';')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$font_style" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </xsl:if>
-
- <xsl:variable name="fill">
- <xsl:apply-templates mode="fill" select="." />
- </xsl:variable>
- <xsl:variable name="fill_opacity">
- <xsl:apply-templates mode="fill_opacity" select="." />
- </xsl:variable>
-
- <xsl:if test="starts-with($fill, '#') or (not(starts-with($fill, 'url')) and $fill != '' and $fill != 'none')">
- <xsl:attribute name="color">
- <xsl:call-template name="template_color">
- <xsl:with-param name="colorspec">
- <xsl:value-of select="$fill" />
- </xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="textAlpha">
- <xsl:value-of select="$fill_opacity" />
- </xsl:attribute>
- </xsl:if>
-
<!-- Force default baseline to "ascent" -->
<xsl:attribute name="alignmentBaseline">ascent</xsl:attribute>
- <xsl:if test="@xml:space='preserve'">
- <xsl:attribute name="whiteSpaceCollapse">preserve</xsl:attribute>
- </xsl:if>
-
+ <xsl:apply-templates mode="font_size" select="." />
+ <xsl:apply-templates mode="font_weight" select="." />
+ <xsl:apply-templates mode="font_family" select="." />
+ <xsl:apply-templates mode="font_style" select="." />
+ <xsl:apply-templates mode="text_fill" select="." />
<xsl:apply-templates mode="text_decoration" select="." />
+ <xsl:apply-templates mode="line_height" select="." />
<xsl:apply-templates mode="direction" select="." />
<xsl:apply-templates mode="writing_mode" select="." />
<xsl:apply-templates mode="id" select="." />
<xsl:apply-templates mode="flow_region" select="*[name(.) = 'flowRegion']/child::node()" />
+
<xsl:apply-templates mode="filter_effect" select="." />
<xsl:apply-templates mode="desc" select="." />
</xsl:choose>
</xsl:template>
+<!--
+ // Shapes //
+
+ * Lines
+ * Rectangle
+ * Path
+ * Ellipse
+ * Circle
+ * Image
+ * Polygon (not supported)
+ * Polyline (not supported)
+-->
+
<!--
// Line object //
SVG: line, FXG: Line
index 1c663c11c954f254f8c61b9fc2d572d0272b5c1b..185ebe25d59128288ca197f9acfdffab702cb0c3 100755 (executable)
exclude-result-prefixes="rdf xlink xs exsl libxslt">
<xsl:strip-space elements="*" />
-<xsl:output method="xml" encoding="UTF-8"/>
+<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:param name="silverlight_compatible" select="1" />