Because it is always one line.
refs #172
tests/test_rptreport_creation
tests/test_rptreport_liststore
tests/test_report_created*
-tests/test_rptprint_mm.rptr
-tests/test_report_newline.rpt
POTFILES
mkinstalldirs
stamp-it
if (prop != NULL
&& g_strcmp0 (g_strstrip (prop), "") != 0)
{
+ PangoLayoutLine *line;
+ PangoRectangle rect;
gint lines;
GString *text_tmp;
g_string_append (text_tmp, prop);
pango_layout_set_text (playout, text_tmp->str, -1);
- while (lines == pango_layout_get_line_count (playout))
+ line = pango_layout_get_line (playout, pango_layout_get_line_count (playout) - 1);
+ pango_layout_line_get_pixel_extents (line, NULL, &rect);
+ while (lines == pango_layout_get_line_count (playout)
+ && rect.width < layout_width)
{
g_string_append (text, prop);
g_string_append (text_tmp, prop);
pango_layout_set_text (playout, text_tmp->str, -1);
+ line = pango_layout_get_line (playout, pango_layout_get_line_count (playout) - 1);
+ pango_layout_line_get_pixel_extents (line, NULL, &rect);
}
g_string_free (text_tmp, TRUE);
<page width="297,000000" height="210,000000" margin-top="10,000000" margin-right="10,000000" margin-bottom="10,000000" margin-left="10,000000"/>
<report>
<page-header first-page="y" last-page="y" height="27,000000">
- <text name="title" x="0,000000" y="0,000000" width="277,000000" height="10,000000" font-name="Droid Sans" font-size="11,000000" font-bold="y" font-color="#000000FF" source=""Report's Title""/>
- <text name="title_0" x="0,000000" y="15,000000" width="50,000000" height="10,000000" font-name="Droid Sans" font-size="9,000000" font-bold="y" font-color="#000000FF" source=""Book's title""/>
- <text name="title_1" x="55,000000" y="15,000000" width="76,000000" height="10,000000" font-name="Droid Sans" font-size="9,000000" font-bold="y" font-color="#000000FF" source=""Author""/>
- <line name="line1" x="0,000000" y="25,000000" width="277,000000" height="0,000000"/>
+ <text name="title" x="0,000000" y="0,000000" width="277,000000" height="10,000000" visible="y" font-name="Droid Sans" font-size="11,000000" font-bold="y" font-color="#000000FF" source=""Report's Title""/>
+ <text name="title_0" x="0,000000" y="15,000000" width="50,000000" height="10,000000" visible="y" font-name="Droid Sans" font-size="9,000000" font-bold="y" font-color="#000000FF" source=""Book's title""/>
+ <text name="title_1" x="55,000000" y="15,000000" width="76,000000" height="10,000000" visible="y" font-name="Droid Sans" font-size="9,000000" font-bold="y" font-color="#000000FF" source=""Author""/>
+ <line name="line1" x="0,000000" y="25,000000" width="277,000000" height="0,000000" visible="y"/>
</page-header>
<body height="15,000000">
- <text name="field_0" x="0,000000" y="0,000000" width="50,000000" height="10,000000" font-name="Droid Sans" font-size="9,000000" font-color="#000000FF" source="[field_0]"/>
- <text name="field_1" x="55,000000" y="0,000000" width="76,000000" height="10,000000" font-name="Droid Sans" font-size="9,000000" font-color="#000000FF" source="[field_1]"/>
+ <text name="field_0" x="0,000000" y="0,000000" width="50,000000" height="10,000000" visible="y" font-name="Droid Sans" font-size="9,000000" font-color="#000000FF" source="[field_0]"/>
+ <text name="field_1" x="55,000000" y="0,000000" width="76,000000" height="10,000000" visible="y" font-name="Droid Sans" font-size="9,000000" font-color="#000000FF" source="[field_1]"/>
</body>
<page-footer first-page="y" last-page="y" height="12,000000">
- <line name="line2" x="0,000000" y="0,000000" width="277,000000" height="0,000000"/>
- <text name="pages" x="0,000000" y="2,000000" width="277,000000" height="10,000000" font-name="Droid Sans" font-size="8,000000" font-color="#000000FF" horizontal-align="right" source=""Page " & @Page & " of " & @Pages"/>
+ <line name="line2" x="0,000000" y="0,000000" width="277,000000" height="0,000000" visible="y"/>
+ <text name="pages" x="0,000000" y="2,000000" width="277,000000" height="10,000000" visible="y" font-name="Droid Sans" font-size="8,000000" font-color="#000000FF" horizontal-align="right" source=""Page " & @Page & " of " & @Pages"/>
</page-footer>
</report>
</reptool>
<report>
<report-header height="80">
- <text name="rephead" x="10" y="10" width="300" height="70" font-name="Verdana" font-size="16" font-bold="y" font-underline="y" font-color="#0000FF" source=""the report's header"" />
+ <text name="rephead" x="10" y="10" width="300" height="70" visible="y" font-name="Verdana" font-size="16" font-bold="y" font-underline="y" font-color="#0000FF" source=""the report's header"" />
</report-header>
<page-header height="80" first-page="y">
- <text name="title" x="10" y="10" width="300" height="50" font-name="Courier New" font-size="10" font-bold="y" source=""the page's title" & " - " & @Page" />
- <line name="line1" x="10" y="65" width="500" height="0" stroke-width="1.0" />
+ <text name="title" x="10" y="10" width="300" height="50" visible="y" font-name="Courier New" font-size="10" font-bold="y" source=""the page's title" & " - " & @Page" />
+ <line name="line1" x="10" y="65" width="500" height="0" visible="y" stroke-width="1.0" />
</page-header>
<body height="200">
- <text name="txt_id" x="50" y="50" width="100" height="50" border-top-width="1.0" border-top-color="#FF0000" source="[id]" />
- <text name="txt_name" x="200" y="50" width="100" height="50" source="[name]" />
- <text name="txt_req" x="50" y="100" width="100" height="50" source="[nonexistent]" />
- <rect name="rect1" x="400" y="10" width="20" height="20" fill-color="#00FF00" />
- <image name="img1" x="450" y="10" width="60" height="60" border-bottom-width="1.0" border-bottom-color="#FF0000" border-bottom-style="10;10" source="tests/gnome-globe.png" />
+ <text name="txt_id" x="50" y="50" width="100" height="50" visible="y" border-top-width="1.0" border-top-color="#FF0000" source="[id]" fill-with="." />
+ <text name="txt_name" x="200" y="50" width="100" height="50" visible="y" source="[name]" />
+ <text name="txt_req" x="50" y="100" width="100" height="50" visible="y" source="[nonexistent]" />
+ <rect name="rect1" x="400" y="10" width="20" height="20" visible="y" fill-color="#00FF00" />
+ <image name="img1" x="450" y="10" width="60" height="60" visible="y" border-bottom-width="1.0" border-bottom-color="#FF0000" border-bottom-style="10;10" source="tests/gnome-globe.png" />
</body>
<report-footer height="50">
- <line name="line3" x="10" y="10" width="500" height="0" stroke-color="#FFFF00" stroke-style="50;10" />
- <text name="txt_report_footer" x="10" y="20" width="500" height="30" horizontal-align="center" source=""the report's footer"" />
- <line name="line4" x="10" y="50" width="500" height="0" stroke-color="#FFFF00" stroke-style="1;5" />
+ <line name="line3" x="10" y="10" width="500" height="0" visible="y" stroke-color="#FFFF00" stroke-style="50;10" />
+ <text name="txt_report_footer" x="10" y="20" width="500" height="30" visible="y" horizontal-align="center" source=""the report's footer"" />
+ <line name="line4" x="10" y="50" width="500" height="0" visible="y" stroke-color="#FFFF00" stroke-style="1;5" />
</report-footer>
<page-footer height="80" first-page="y" last-page="y">
- <line name="line2" x="10" y="10" width="500" height="0" />
- <text name="footer" x="10" y="20" width="300" height="50" source=""the page's footer"" />
- <ellipse name="ellipse1" x="400" y="50" width="20" height="10" stroke-color="#FF0000" fill-color="#00FF00" />
- <text name="page_n" x="500" y="20" width="50" height="50" source="@Page & "/" & @Pages" />
+ <line name="line2" x="10" y="10" width="500" height="0" visible="y" />
+ <text name="footer" x="10" y="20" width="300" height="50" visible="y" source=""the page's footer"" />
+ <ellipse name="ellipse1" x="400" y="50" width="20" height="10" visible="y" stroke-color="#FF0000" fill-color="#00FF00" />
+ <text name="page_n" x="500" y="20" width="50" height="50" visible="y" source="@Page & "/" & @Pages" />
</page-footer>
</report>
</reptool>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<reptool>
+ <properties>
+ <name>Newline test</name>
+ <description>A report to test if the newline character (#10) works</description>
+ </properties>
+ <page width="595.000000" height="842.000000" margin-left="100.000000" margin-top="200.000000"/>
+ <report>
+ <body>
+ <text name="txt_id" visible="y" x="50.000000" y="50.000000" width="100.000000" height="50.000000" border-top-width="1.000000" border-top-color="#FF0000FF" font-name="Sans" font-size="12.000000" source=""text with new line""/>
+ <text name="txt_invisible" visible="y" x="50.000000" y="250.000000" width="100.000000" height="50.000000" border-top-width="1.000000" border-top-color="#FF0000FF" font-name="Sans" font-size="12.000000" source=""text with new line"" letter-spacing="20"/>
+ <text name="txt_long" visible="y" x="50.000000" y="350.000000" width="300.000000" height="50.000000" border-top-width="1.000000" border-top-color="#FF0000FF" border-right-width="1" border-right-color="#000" font-name="Sans" font-size="12.000000" source=""text with new line"" fill-with="."/>
+ <text name="txt_dot" visible="y" x="50.000000" y="400.000000" width="300.000000" height="50.000000" border-top-width="1.000000" border-top-color="#FF0000FF" font-name="Sans" font-size="12.000000" source="".""/>
+ <text name="txt_long_with_spacing" visible="y" x="0.000000" y="450.000000" width="400.000000" height="50.000000" border-top-width="1.000000" border-top-color="#FF0000FF" font-name="Sans" font-size="12.000000" source=""text with new line"" letter-spacing="10"/>
+ <text name="txt_date" visible="y" x="0.000000" y="500.000000" width="400.000000" height="50.000000" font-name="Sans" font-size="12.000000" source="@Date{%d/%m/%Y} & " " & @Time{%H.%M.%S}" letter-spacing="10"/>
+ </body>
+ </report>
+</reptool>
--- /dev/null
+<?xml version="1.0" ?>
+<reptool_report>
+ <properties>
+ <unit-length>mm</unit-length>
+ </properties>
+ <page width="210" height="297">
+ <text x="10" y="20" width="210" height="100" visible="y" border-top-width="2.83" border-bottom-width="2.83" font-size="12" font-color="#0F0" border-top="2.83" border-bottom="2.83">Text sample</text>
+ <!--<line x="10" y="300" width="100" height="0" visible="y" stroke-color="#F00" />
+ <image x="250" y="180" width="300" height="200" visible="y" border-top-width="1.0" border-right-width="1.0" border-bottom-width="1.0" border-left-width="1.0" source="tests/city.png" />
+ <rect x="10" y="500" width="400" height="10" visible="y" fill-color="#00F" />
+ <text x="10" y="400" width="100" height="50" visible="y" border-top-width="1.0" border-right-width="1.0" border-bottom-width="1.0" border-left-width="1.0" border-top-color="#FF0000" border-right-color="#FF0000" border-bottom-color="#FF0000" border-left-color="#FF0000" background-color="#000000" font-color="#FFFFFF">White on black</text>
+ </page>
+
+ <page width="595" height="842">
+ <text x="10" y="300" width="300" height="800" visible="y" font-size="30" font-color="#FF0">Text sample on second page</text>
+ <line x="10" y="300" width="100" height="0" visible="y" stroke-color="#0F0" />
+ <ellipse x="200" y="700" width="100" height="30" visible="y" stroke-color="#FF0000" fill-color="#0000FF" />
+ <text x="350" y="20" width="200" height="100" visible="y" font-underline="single">Underline single</text>
+ <text x="350" y="120" width="200" height="100" visible="y" font-underline="double">Underline double</text>
+ <text x="350" y="220" width="200" height="100" visible="y" font-underline="low">Underline low</text>
+ <text x="350" y="320" width="200" height="100" visible="y" font-underline="error">Underline error</text>
+ <text x="350" y="420" width="200" height="100" visible="y" font-bold="y" font-color="#FF0000" font-strike="y">Text striked and bold</text>
+ <text x="350" y="520" width="200" height="100" visible="y" font-italic="y">Text italic</text>-->
+ </page>
+</reptool_report>