10 Dec
2010
10 Dec
'10
3:50 p.m.
* demo/xml2doc/templates/pdf/line.xsl: Use temporary hack to
improve document rendering.
---
scribo/ChangeLog | 69 +--------------------
scribo/demo/xml2doc/templates/pdf/line.xsl | 89 +++++++++++++++++++++++++--
2 files changed, 85 insertions(+), 73 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 04bf771..7d0a372 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,72 +1,9 @@
2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
- Integrate the DIA toolchain in Scribo viewer.
+ Temporary fix PDF rendering.
- * demo/viewer/Makefile.am: Add new files.
-
- * demo/viewer/main.cc: Initialize libMagick++.
-
- * demo/viewer/step_widget.cc,
- * demo/viewer/step_widget.hh: Improve interface.
-
- * demo/viewer/viewer.cc,
- * demo/viewer/viewer.hh,
- * demo/viewer/viewer.hxx: Handle calls to the DIA toolchain.
-
- * demo/viewer/preprocess.cc,
- * demo/viewer/preprocess.hh,
- * demo/viewer/process.cc,
- * demo/viewer/process.hh,
- * demo/viewer/runner.cc,
- * demo/viewer/runner.hh: New.
-
-2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
-
- Fix guards and license.
-
- * demo/viewer/README,
- * demo/viewer/browser_widget.cc,
- * demo/viewer/browser_widget.hh,
- * demo/viewer/common.hh,
- * demo/viewer/help_dialog.cc,
- * demo/viewer/help_dialog.hh,
- * demo/viewer/image_region.cc,
- * demo/viewer/image_region.hh,
- * demo/viewer/image_region.hxx,
- * demo/viewer/image_scene.cc,
- * demo/viewer/image_scene.hh,
- * demo/viewer/image_view.cc,
- * demo/viewer/image_view.hh,
- * demo/viewer/image_widget.cc,
- * demo/viewer/image_widget.hh,
- * demo/viewer/key_widget.cc,
- * demo/viewer/key_widget.hh,
- * demo/viewer/main.cc,
- * demo/viewer/xml_widget.cc,
- * demo/viewer/xml_widget.hh: Here.
-
-2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
-
- Add configuration widgets in Scribo viewer.
-
- * demo/viewer/config.cc,
- * demo/viewer/config.hh,
- * demo/viewer/defs.hh,
- * demo/viewer/general_options.cc,
- * demo/viewer/general_options.hh,
- * demo/viewer/general_options.ui,
- * demo/viewer/option_widget.cc,
- * demo/viewer/option_widget.hh,
- * demo/viewer/preferences_dialog.cc,
- * demo/viewer/preferences_dialog.hh,
- * demo/viewer/preferences_dialog.ui,
- * demo/viewer/toolchain_options.cc,
- * demo/viewer/toolchain_options.hh,
- * demo/viewer/toolchain_options.ui: New.
-
-2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
-
- * src/scribo-cli.in: Add a call to xml2doc.
+ * demo/xml2doc/templates/pdf/line.xsl: Use temporary hack to
+ improve document rendering.
2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
diff --git a/scribo/demo/xml2doc/templates/pdf/line.xsl
b/scribo/demo/xml2doc/templates/pdf/line.xsl
index b143502..e804d52 100644
--- a/scribo/demo/xml2doc/templates/pdf/line.xsl
+++ b/scribo/demo/xml2doc/templates/pdf/line.xsl
@@ -70,6 +70,15 @@
</xsl:for-each>
</xsl:variable>
+ <xsl:variable name="ymax">
+ <xsl:for-each select="coords/point">
+ <xsl:sort select="@y" order="ascending"
data-type="number"/>
+ <xsl:if test="position() = 3">
+ <xsl:value-of select="@y" />
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
<xsl:variable name="x1">
<xsl:for-each select="coords/point">
<xsl:sort select="@x" order="ascending"
data-type="number"/>
@@ -78,9 +87,19 @@
</xsl:if>
</xsl:for-each>
</xsl:variable>
+
+ <xsl:variable name="xmax">
+ <xsl:for-each select="coords/point">
+ <xsl:sort select="@x" order="ascending"
data-type="number"/>
+ <xsl:if test="position() = 3">
+ <xsl:value-of select="@x" />
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
<!-- END OF lines coordinates -->
- <!-- WTF !?, Necessary to do a lower-case ! -->
+ <!-- WTF !?, Necessary to do a lower-case !
+ FIXME: take a look at text-transform attribute -->
<xsl:variable name="smallcase"
select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase"
select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
@@ -97,7 +116,7 @@
</xsl:variable>
- <fo:block-container position="absolute">
+ <fo:block-container position="absolute"
border-width="5mm">
<xsl:attribute name="left">
<xsl:value-of select="$x1" />px
@@ -106,6 +125,18 @@
<xsl:value-of select="$y1" />px
</xsl:attribute>
+ <xsl:attribute name="right">
+ <xsl:value-of select="$xmax" />px
+ </xsl:attribute>
+ <xsl:attribute name="bottom">
+ <xsl:value-of select="$ymax" />px
+ </xsl:attribute>
+
+
+ <xsl:attribute name="width">
+ <xsl:value-of select="$xmax - $x1" />px
+ </xsl:attribute>
+
<xsl:attribute name="color">
<xsl:value-of select="$colour" />
</xsl:attribute>
@@ -113,14 +144,58 @@
<!-- if necessary, put letter-spacing="-Npt" ~ -3 <= N <= -1
in fo:block-->
- <fo:block font-family="Times">
+ <!-- text-align-last="justify" will help justifying and using a
+ uniform font size (it stretchs the text, at least for PDF)
+ but it relies on several lines... We need paragraph
+ information.
+ -->
- <xsl:attribute name="font-size">
- <xsl:value-of select="$a + $d" />px
+ <!-- FIXME: using a table allows to justify a single line of
+ text. This is an UGLY HACK. Font size is also tweaked for
+ now but it should not since we have font information.
+ -->
+ <fo:table table-layout="fixed">
+
+ <xsl:attribute name="width">
+ <xsl:value-of select="$xmax -$x1" />px
</xsl:attribute>
- <xsl:value-of select="@text"/>
- </fo:block>
+ <fo:table-column column-number="1">
+ <xsl:attribute name="column-width">
+ <xsl:value-of select="$xmax -$x1" />px
+ </xsl:attribute>
+ </fo:table-column>
+
+ <fo:table-body start-indent="0pt" text-align="justify"
text-align-last="justify">
+
+ <fo:table-row>
+
+ <fo:table-cell>
+
+ <fo:block font-family="Times" wrap-option="no-wrap"
white-space-collapse="true" text-align-last="justify"
text-align="justify">
+
+ <xsl:attribute name="font-size">
+ <xsl:choose>
+ <xsl:when test="($a + $d) > 50">
+ <xsl:value-of select="0.82 * ($a + $d)" />px
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0.95 * ($a + $d)" />px
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:value-of select="@text"/>
+ </fo:block>
+
+ </fo:table-cell>
+
+ </fo:table-row>
+
+ </fo:table-body>
+
+ </fo:table>
+
</fo:block-container>
--
1.5.6.5