Hey agin,

another annoyance I came across in odf2xhtml today is missing output
of generic @font-family declarations in the generated CSS.
They are described in CSS2:
http://www.w3.org/TR/CSS2/fonts.html#generic-font-families

They are also described in ODT as
style:font-face/@style:font-family-generic and
style:font-face/@style:font-pitch, although widht different values --
'roman' instead of 'serif', 'swiss' instead of 'sans-serif' etc.
http://books.evc-cit.info/OD_Essentials.pdf

That makes a mapping pretty trivial, and I wonder why it wasn't
included in odf2xhtml.

Anyhow, here is my version. Modified @style:font-name template in
style_mapping_css.xsl:

<xsl:template match="@style:font-name">
        <xsl:param name="globalData" />

        <xsl:text>font-family:</xsl:text>
        <xsl:variable name="content" select="."/>
        <xsl:variable name="quote">'</xsl:variable>
        <xsl:variable name="fontName"
select="$globalData/office:font-face-decls/style:font-fa...@style:name=$content]/@svg:font-family"
/>
        <xsl:variable name="fontFamily"
select="$globalData/office:font-face-decls/style:font-fa...@style:name=$content]/@style:font-family-generic"
/>
        <xsl:variable name="fontWidth"
select="$globalData/office:font-face-decls/style:font-fa...@style:name=$content]/@style:font-pitch"
/>
        <xsl:value-of select="translate($fontName, $quote, '')"/>
        <xsl:choose>
            <xsl:when test="$fontFamily = 'roman'">
                <xsl:text>, serif</xsl:text>
            </xsl:when>
            <xsl:when test="$fontFamily = 'swiss'">
                <xsl:text>, sans-serif</xsl:text>
            </xsl:when>
            <xsl:when test="$fontWidth = 'fixed'">
                <xsl:text>, monospace</xsl:text>
            </xsl:when>
        </xsl:choose>
        <xsl:text>; </xsl:text>
</xsl:template>


Martynas
odt2epub.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to