diff options
author | Jeremias Maerki <jeremias@apache.org> | 2006-03-16 13:51:14 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2006-03-16 13:51:14 +0000 |
commit | e6d53d8a9c84b6447f3db4b2b36576d418df1a4a (patch) | |
tree | 7c9c4dcaa414499c66c262383108879e5007c815 /test | |
parent | de1255b13f15201dbba5d6c282cded7719e3dc8f (diff) | |
download | xmlgraphics-fop-e6d53d8a9c84b6447f3db4b2b36576d418df1a4a.tar.gz xmlgraphics-fop-e6d53d8a9c84b6447f3db4b2b36576d418df1a4a.zip |
Added support for fixed-width spaces and kerning.
Note: letter-spacing is still implemented as before. Fixing this cannot be done without looking at space resolution as a whole on inline level.
The Character area tree object is now deprecated. Normal Text objects should be used to keep renderers simpler.
Introduced FontResolver interface to remove the dependency of FOUserAgent into the font package.
Added kerning information to the base14 fonts, Helvetica and Times. By default it is not used to keep the status-quo. Enable base14 kerning through the FOUserAgent (FopFactory after the API finalization).
Restored the production of EPS images in PDF output as PostScript XObjects.
Restored functionality for a more compact format for the area tree renderer to save space.
LayoutEngineTester slightly changed to allow for configuration values from the XML file. For now, only enabling base14 kerning is supported.
Removed duplicate offset variable in SpaceArea.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@386327 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
12 files changed, 618 insertions, 71 deletions
diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java index dce5b9adf..7fd8fe4e4 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java +++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java @@ -19,12 +19,16 @@ package org.apache.fop.layoutengine; import java.io.File; +import java.io.IOException; import java.lang.reflect.Constructor; import java.net.MalformedURLException; import java.util.Iterator; import java.util.List; import java.util.Map; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Templates; @@ -46,10 +50,14 @@ import org.apache.fop.apps.FormattingResults; import org.apache.fop.apps.MimeConstants; import org.apache.fop.layoutmgr.ElementListObserver; import org.apache.fop.render.xml.XMLRenderer; +import org.apache.xpath.XPathAPI; +import org.apache.xpath.objects.XObject; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; /** * Class for testing the FOP's layout engine using testcases specified in XML @@ -105,11 +113,12 @@ public class LayoutEngineTester { * Runs a single layout engine test case. * @param testFile Test case to run * @throws TransformerException In case of an XSLT/JAXP problem - * @throws FOPException In case of a FOP problem - * @throws MalformedURLException if the base URL cannot be set + * @throws IOException In case of an I/O problem + * @throws SAXException In case of a problem during SAX processing + * @throws ParserConfigurationException In case of a problem with the XML parser setup */ public void runTest(File testFile) - throws TransformerException, FOPException, MalformedURLException { + throws TransformerException, SAXException, IOException, ParserConfigurationException { DOMResult domres = new DOMResult(); @@ -119,9 +128,19 @@ public class LayoutEngineTester { Fop fop; try { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + dbf.setValidating(false); + DocumentBuilder builder = dbf.newDocumentBuilder(); + Document testDoc = builder.parse(testFile); + + XObject xo = XPathAPI.eval(testDoc, "/testcase/cfg/base14kerning"); + String s = xo.str(); + boolean base14kerning = ("true".equalsIgnoreCase(s)); + //Setup Transformer to convert the testcase XML to XSL-FO Transformer transformer = getTestcase2FOStylesheet().newTransformer(); - Source src = new StreamSource(testFile); + Source src = new DOMSource(testDoc); //Setup Transformer to convert the area tree to a DOM TransformerHandler athandler = tfactory.newTransformerHandler(); @@ -130,6 +149,7 @@ public class LayoutEngineTester { //Setup FOP for area tree rendering FOUserAgent ua = new FOUserAgent(); ua.setBaseURL(testFile.getParentFile().toURL().toString()); + ua.setBase14KerningEnabled(base14kerning); XMLRenderer atrenderer = new XMLRenderer(); atrenderer.setUserAgent(ua); atrenderer.setContentHandler(athandler); diff --git a/test/layoutengine/standard-testcases/block_basic_2.xml b/test/layoutengine/standard-testcases/block_basic_2.xml index 84e485e24..d43cb0591 100644 --- a/test/layoutengine/standard-testcases/block_basic_2.xml +++ b/test/layoutengine/standard-testcases/block_basic_2.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-2006 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -73,7 +73,8 @@ <eval expected="8616" xpath="//flow/block[4]/lineArea/text/@baseline"/> <eval expected="0" xpath="//flow/block[5]/lineArea/inlineparent/@offset"/> <eval expected="8616" xpath="//flow/block[5]/lineArea/inlineparent/text/@baseline"/> - <eval expected="0" xpath="//flow/block[6]/lineArea/char/@offset"/> - <eval expected="8616" xpath="//flow/block[6]/lineArea/char/@baseline"/> + <eval expected="0" xpath="//flow/block[6]/lineArea/text/@offset"/> + <eval expected="0" xpath="//flow/block[6]/lineArea/text/word/@offset"/> + <eval expected="8616" xpath="//flow/block[6]/lineArea/text/@baseline"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/block_white-space-collapse_1.xml b/test/layoutengine/standard-testcases/block_white-space-collapse_1.xml index a935401ad..f0383be8c 100644 --- a/test/layoutengine/standard-testcases/block_white-space-collapse_1.xml +++ b/test/layoutengine/standard-testcases/block_white-space-collapse_1.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-2006 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -104,7 +104,8 @@ <eval expected="2" xpath="count(//flow/block[1]/lineArea[1]/text[2]/word)"/> <eval expected="1" xpath="count(//flow/block[1]/lineArea[1]/text[2]/space)"/> <eval expected="1" xpath="count(//flow/block[1]/lineArea[1]/text[3]/word)"/> - <eval expected="1" xpath="count(//flow/block[1]/lineArea[1]/char)"/> + <eval expected=" " xpath="//flow/block[1]/lineArea[1]/text[3]/word"/> + <eval expected="1" xpath="count(//flow/block[1]/lineArea[1]/text[4]/word)"/> <eval expected="3" xpath="count(//flow/block[2]/block[1]/lineArea[1]/text/word)"/> <eval expected="2" xpath="count(//flow/block[2]/block[1]/lineArea[1]/text/space)"/> diff --git a/test/layoutengine/standard-testcases/block_white-space_4.xml b/test/layoutengine/standard-testcases/block_white-space_4.xml new file mode 100644 index 000000000..29f724490 --- /dev/null +++ b/test/layoutengine/standard-testcases/block_white-space_4.xml @@ -0,0 +1,412 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2006 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- $Id$ --> +<testcase> + <info> + <p> + This test checks element generation for various spaces. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="normal"> + <fo:flow flow-name="xsl-region-body"> + <!-- for nbsp see block_white-space_2 and block_white-space_3 --> + <fo:block> + <fo:block background-color="yellow" id="l-sp">« text text »<fo:inline font-style="italic"> (normal space)</fo:inline></fo:block> + <fo:block background-color="orange" id="l-thin-space">« text text »<fo:inline font-style="italic"> (thin space, &#x2009;)</fo:inline></fo:block> + <fo:block background-color="yellow" id="l-hair-space">« text text »<fo:inline font-style="italic"> (hair space, &#x200A;)</fo:inline></fo:block> + <fo:block background-color="orange" id="l-zwsp">«​text text​»<fo:inline font-style="italic"> (zero width space, &#x200B;)</fo:inline></fo:block> + <fo:block background-color="yellow" id="l-nosp">«text text»<fo:inline font-style="italic"> (no spaces)</fo:inline></fo:block> + </fo:block> + <fo:block space-before="2mm" text-align="center"> + <fo:block background-color="yellow" id="c-sp">« text text »<fo:inline font-style="italic"> (normal space)</fo:inline></fo:block> + <fo:block background-color="orange" id="c-thin-space">« text text »<fo:inline font-style="italic"> (thin space, &#x2009;)</fo:inline></fo:block> + <fo:block background-color="yellow" id="c-hair-space">« text text »<fo:inline font-style="italic"> (hair space, &#x200A;)</fo:inline></fo:block> + <fo:block background-color="orange" id="c-zwsp">«​text text​»<fo:inline font-style="italic"> (zero width space, &#x200B;)</fo:inline></fo:block> + <fo:block background-color="yellow" id="c-nosp">«text text»<fo:inline font-style="italic"> (no spaces)</fo:inline></fo:block> + </fo:block> + <fo:block space-before="2mm" text-align="justify" text-align-last="justify"> + <fo:block background-color="yellow" id="j-sp">« text text »<fo:inline font-style="italic"> (normal space)</fo:inline></fo:block> + <fo:block background-color="orange" id="j-thin-space">« text text »<fo:inline font-style="italic"> (thin space, &#x2009;)</fo:inline></fo:block> + <fo:block background-color="yellow" id="j-hair-space">« text text »<fo:inline font-style="italic"> (hair space, &#x200A;)</fo:inline></fo:block> + <fo:block background-color="orange" id="j-zwsp">«​text text​»<fo:inline font-style="italic"> (zero width space, &#x200B;)</fo:inline></fo:block> + <fo:block background-color="yellow" id="j-nosp">«text text»<fo:inline font-style="italic"> (no spaces)</fo:inline></fo:block> + </fo:block> + <fo:block space-before="2mm" text-align="justify" text-align-last="justify" letter-spacing="2pt"> + <fo:block background-color="yellow" id="lsj-sp">« text text »<fo:inline font-style="italic"> (normal space)</fo:inline></fo:block> + <fo:block background-color="orange" id="lsj-thin-space">« text text »<fo:inline font-style="italic"> (thin space, &#x2009;)</fo:inline></fo:block> + <fo:block background-color="yellow" id="lsj-hair-space">« text text »<fo:inline font-style="italic"> (hair space, &#x200A;)</fo:inline></fo:block> + <fo:block background-color="orange" id="lsj-zwsp">«​text text​»<fo:inline font-style="italic"> (zero width space, &#x200B;)</fo:inline></fo:block> + <fo:block background-color="yellow" id="lsj-nosp">«text text»<fo:inline font-style="italic"> (no spaces)</fo:inline></fo:block> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <element-list category="line" id="l-sp"> + <box w="6672"/> + + <!-- first space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="3336" y="-10008" z="0"/> + + <box w="19344"/> + + <!-- second space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="3336" y="-10008" z="0"/> + + <box w="19344"/> + + <!-- third space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="3336" y="-10008" z="0"/> + + <box w="6672"/> + + <skip>11</skip> + </element-list> + <eval expected="62040" xpath="//block[@prod-id='l-sp']/lineArea/text/@ipd"/> + <eval expected="word" xpath="local-name(//block[@prod-id='l-sp']/lineArea/text/*[1])"/> + <eval expected="space" xpath="local-name(//block[@prod-id='l-sp']/lineArea/text/*[2])"/> + <eval expected="word" xpath="local-name(//block[@prod-id='l-sp']/lineArea/text/*[3])"/> + <eval expected="space" xpath="local-name(//block[@prod-id='l-sp']/lineArea/text/*[4])"/> + <eval expected="word" xpath="local-name(//block[@prod-id='l-sp']/lineArea/text/*[5])"/> + <eval expected="space" xpath="local-name(//block[@prod-id='l-sp']/lineArea/text/*[6])"/> + <eval expected="word" xpath="local-name(//block[@prod-id='l-sp']/lineArea/text/*[7])"/> + <true xpath="not(//block[@prod-id='l-sp']/lineArea/text/*[2]/@adj = 'false')"/> + <true xpath="not(//block[@prod-id='l-sp']/lineArea/text/*[6]/@adj = 'false')"/> + + <element-list category="line" id="l-thin-space"> + <box w="6672"/> + + <!-- first space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="2400" y="-10008" z="0"/> + + <box w="19344"/> + + <!-- second space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="3336" y="-10008" z="0"/> + + <box w="19344"/> + + <!-- third space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="2400" y="-10008" z="0"/> + + <box w="6672"/> + + <skip>15</skip> + </element-list> + <eval expected="60168" xpath="//block[@prod-id='l-thin-space']/lineArea/text/@ipd"/> + <eval expected="word" xpath="local-name(//block[@prod-id='l-thin-space']/lineArea/text/*[1])"/> + <eval expected="space" xpath="local-name(//block[@prod-id='l-thin-space']/lineArea/text/*[2])"/> + <eval expected="word" xpath="local-name(//block[@prod-id='l-thin-space']/lineArea/text/*[3])"/> + <eval expected="space" xpath="local-name(//block[@prod-id='l-thin-space']/lineArea/text/*[4])"/> + <eval expected="word" xpath="local-name(//block[@prod-id='l-thin-space']/lineArea/text/*[5])"/> + <eval expected="space" xpath="local-name(//block[@prod-id='l-thin-space']/lineArea/text/*[6])"/> + <eval expected="word" xpath="local-name(//block[@prod-id='l-thin-space']/lineArea/text/*[7])"/> + <true xpath="//block[@prod-id='l-thin-space']/lineArea/text/*[2]/@adj = 'false'"/> + <true xpath="//block[@prod-id='l-thin-space']/lineArea/text/*[6]/@adj = 'false'"/> + + <element-list category="line" id="l-hair-space"> + <box w="6672"/> + + <!-- first space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="1200" y="-10008" z="0"/> + + <box w="19344"/> + + <!-- second space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="3336" y="-10008" z="0"/> + + <box w="19344"/> + + <!-- third space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="1200" y="-10008" z="0"/> + + <box w="6672"/> + + <skip>15</skip> + </element-list> + <eval expected="57768" xpath="//block[@prod-id='l-hair-space']/lineArea/text/@ipd"/> + <true xpath="//block[@prod-id='l-hair-space']/lineArea/text/*[2]/@adj = 'false'"/> + <true xpath="//block[@prod-id='l-hair-space']/lineArea/text/*[6]/@adj = 'false'"/> + + <element-list category="line" id="l-zwsp"> + <box w="6672"/> + + <!-- first space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="0" y="-10008" z="0"/> + + <box w="19344"/> + + <!-- second space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="3336" y="-10008" z="0"/> + + <box w="19344"/> + + <!-- third space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="0" y="-10008" z="0"/> + + <box w="6672"/> + + <skip>19</skip> + </element-list> + <eval expected="55368" xpath="//block[@prod-id='l-zwsp']/lineArea/text/@ipd"/> + <true xpath="//block[@prod-id='l-zwsp']/lineArea/text/*[2]/@adj = 'false'"/> + <true xpath="//block[@prod-id='l-zwsp']/lineArea/text/*[6]/@adj = 'false'"/> + + <element-list category="line" id="l-nosp"> + <box w="26016"/> + + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="3336" y="-10008" z="0"/> + + <box w="26016"/> + + <skip>11</skip> + </element-list> + <eval expected="55368" xpath="//block[@prod-id='l-nosp']/lineArea/text/@ipd"/> + + <element-list category="line" id="c-thin-space"> + <glue w="0" y="10008" z="0"/> + + <box w="6672"/> + + <!-- first space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="2400" y="-20016" z="0"/> + <box w="0"/> + <penalty w="0" p="INF"/> + <glue w="0" y="10008" z="0"/> + + <box w="19344"/> + + <!-- second space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="3336" y="-20016" z="0"/> + <box w="0"/> + <penalty w="0" p="INF"/> + <glue w="0" y="10008" z="0"/> + + <box w="19344"/> + + <!-- third space --> + <glue w="0" y="10008" z="0"/> + <penalty w="0" p="0"/> + <glue w="2400" y="-20016" z="0"/> + <box w="0"/> + <penalty w="0" p="INF"/> + <glue w="0" y="10008" z="0"/> + + <box w="6672"/> + + <skip>23</skip> + </element-list> + <eval expected="60168" xpath="//block[@prod-id='c-thin-space']/lineArea/text/@ipd"/> + <eval expected="word" xpath="local-name(//block[@prod-id='c-thin-space']/lineArea/text/*[1])"/> + <eval expected="space" xpath="local-name(//block[@prod-id='c-thin-space']/lineArea/text/*[2])"/> + <eval expected="word" xpath="local-name(//block[@prod-id='c-thin-space']/lineArea/text/*[3])"/> + <eval expected="space" xpath="local-name(//block[@prod-id='c-thin-space']/lineArea/text/*[4])"/> + <eval expected="word" xpath="local-name(//block[@prod-id='c-thin-space']/lineArea/text/*[5])"/> + <eval expected="space" xpath="local-name(//block[@prod-id='c-thin-space']/lineArea/text/*[6])"/> + <eval expected="word" xpath="local-name(//block[@prod-id='c-thin-space']/lineArea/text/*[7])"/> + <true xpath="//block[@prod-id='c-thin-space']/lineArea/text/*[2]/@adj = 'false'"/> + <true xpath="//block[@prod-id='c-thin-space']/lineArea/text/*[6]/@adj = 'false'"/> + + <element-list category="line" id="j-sp"> + <box w="6672"/> + + <!-- first space --> + <glue w="3336" y="1668" z="1112"/> + + <box w="19344"/> + + <!-- second space --> + <glue w="3336" y="1668" z="1112"/> + + <box w="19344"/> + + <!-- third space --> + <glue w="3336" y="1668" z="1112"/> + + <box w="6672"/> + + <skip>5</skip> + </element-list> + <eval expected="190804" xpath="//block[@prod-id='j-sp']/lineArea/text/@ipd"/> + <eval expected="42921" xpath="//block[@prod-id='j-sp']/lineArea/text/@twsadjust"/> + + <element-list category="line" id="j-thin-space"> + <box w="6672"/> + + <!-- first space --> + <glue w="2400" y="0" z="0"/> + + <box w="19344"/> + + <!-- second space --> + <glue w="3336" y="1668" z="1112"/> + + <box w="19344"/> + + <!-- third space --> + <glue w="2400" y="0" z="0"/> + + <box w="6672"/> + + <skip>7</skip> + </element-list> + <eval expected="104277" xpath="//block[@prod-id='j-thin-space']/lineArea/text/@ipd"/> + <eval expected="44109" xpath="//block[@prod-id='j-thin-space']/lineArea/text/@twsadjust"/> + <true xpath="//block[@prod-id='j-thin-space']/lineArea/text/*[2]/@adj = 'false'"/> + <true xpath="//block[@prod-id='j-thin-space']/lineArea/text/*[6]/@adj = 'false'"/> + + <element-list category="line" id="j-zwsp"> + <box w="6672"/> + + <!-- first space --> + <glue w="0" y="0" z="0"/> + + <box w="19344"/> + + <!-- second space --> + <glue w="3336" y="1668" z="1112"/> + + <box w="19344"/> + + <!-- third space --> + <glue w="0" y="0" z="0"/> + + <box w="6672"/> + + <skip>9</skip> + </element-list> + <eval expected="84280" xpath="//block[@prod-id='j-zwsp']/lineArea/text/@ipd"/> + <eval expected="28912" xpath="//block[@prod-id='j-zwsp']/lineArea/text/@twsadjust"/> + <true xpath="//block[@prod-id='j-zwsp']/lineArea/text/*[2]/@adj = 'false'"/> + <true xpath="//block[@prod-id='j-zwsp']/lineArea/text/*[6]/@adj = 'false'"/> + + <element-list category="line" id="lsj-sp"> + <box w="6672"/> + + <!-- first space --> + <glue w="7336" y="1668" z="1112"/> + + <box w="25344"/> + + <!-- second space --> + <glue w="7336" y="1668" z="1112"/> + + <box w="25344"/> + + <!-- third space --> + <glue w="7336" y="1668" z="1112"/> + + <box w="6672"/> + + <skip>5</skip> + </element-list> + <eval expected="182404" xpath="//block[@prod-id='lsj-sp']/lineArea/text/@ipd"/> + <eval expected="32121" xpath="//block[@prod-id='lsj-sp']/lineArea/text/@twsadjust"/> + <eval expected="2000" xpath="//block[@prod-id='lsj-sp']/lineArea/text/@tlsadjust"/> + + <element-list category="line" id="lsj-thin-space"> + <box w="6672"/> + + <!-- first space --> + <glue w="2400" y="0" z="0"/> + + <box w="25344"/> + + <!-- second space --> + <glue w="7336" y="1668" z="1112"/> + + <box w="25344"/> + + <!-- third space --> + <glue w="2400" y="0" z="0"/> + + <box w="6672"/> + + <skip>7</skip> + </element-list> + <eval expected="104777" xpath="//block[@prod-id='lsj-thin-space']/lineArea/text/@ipd"/> + <eval expected="28609" xpath="//block[@prod-id='lsj-thin-space']/lineArea/text/@twsadjust"/> + <eval expected="2000" xpath="//block[@prod-id='lsj-thin-space']/lineArea/text/@tlsadjust"/> + <true xpath="//block[@prod-id='lsj-thin-space']/lineArea/text/*[2]/@adj = 'false'"/> + <true xpath="//block[@prod-id='lsj-thin-space']/lineArea/text/*[6]/@adj = 'false'"/> + + <element-list category="line" id="lsj-zwsp"> + <box w="6672"/> + + <!-- first space --> + <glue w="0" y="0" z="0"/> + + <box w="25344"/> + + <!-- second space --> + <glue w="7336" y="1668" z="1112"/> + + <box w="25344"/> + + <!-- third space --> + <glue w="0" y="0" z="0"/> + + <box w="6672"/> + + <skip>9</skip> + </element-list> + <eval expected="85480" xpath="//block[@prod-id='lsj-zwsp']/lineArea/text/@ipd"/> + <eval expected="14112" xpath="//block[@prod-id='lsj-zwsp']/lineArea/text/@twsadjust"/> + <eval expected="2000" xpath="//block[@prod-id='lsj-zwsp']/lineArea/text/@tlsadjust"/> + <true xpath="//block[@prod-id='lsj-zwsp']/lineArea/text/*[2]/@adj = 'false'"/> + <true xpath="//block[@prod-id='lsj-zwsp']/lineArea/text/*[6]/@adj = 'false'"/> + + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/character_background-color.xml b/test/layoutengine/standard-testcases/character_background-color.xml index a95d2cf50..7a2dfd29c 100644 --- a/test/layoutengine/standard-testcases/character_background-color.xml +++ b/test/layoutengine/standard-testcases/character_background-color.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-2006 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,6 +38,6 @@ </fo:root> </fo> <checks> - <eval expected="color=#ffff00" xpath="//flow/block[1]/lineArea/char/@background"/> + <eval expected="color=#ffff00" xpath="//flow/block[1]/lineArea/text[2]/@background"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/character_background-image.xml b/test/layoutengine/standard-testcases/character_background-image.xml index 8dc1f4361..3a7e2400e 100644 --- a/test/layoutengine/standard-testcases/character_background-image.xml +++ b/test/layoutengine/standard-testcases/character_background-image.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-2006 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ </fo:root> </fo> <checks> - <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=8976,vertical=21360" xpath="//flow/block[1]/lineArea/char[1]/@background"/> - <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=-9696,vertical=-840" xpath="//flow/block[1]/lineArea/char[2]/@background"/> + <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=8976,vertical=21360" xpath="//flow/block[1]/lineArea/text[1]/@background"/> + <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=-9696,vertical=-840" xpath="//flow/block[1]/lineArea/text[3]/@background"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/character_border_padding.xml b/test/layoutengine/standard-testcases/character_border_padding.xml index 02c72b118..d083d7cec 100644 --- a/test/layoutengine/standard-testcases/character_border_padding.xml +++ b/test/layoutengine/standard-testcases/character_border_padding.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-2006 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -47,52 +47,52 @@ </fo:root> </fo> <checks> - <eval expected="7180" xpath="//flow/block[1]/lineArea/char/@baseline"/> - <eval expected="0" xpath="//flow/block[1]/lineArea/char/@offset"/> - <eval expected="5560" xpath="//flow/block[1]/lineArea/char/@ipd"/> - <eval expected="7560" xpath="//flow/block[1]/lineArea/char/@ipda"/> - <eval expected="(solid,#ff0000,1000)" xpath="//flow/block[1]/lineArea/char/@border-after"/> - <eval expected="(solid,#ff0000,1000)" xpath="//flow/block[1]/lineArea/char/@border-before"/> - <eval expected="(solid,#ff0000,1000)" xpath="//flow/block[1]/lineArea/char/@border-end"/> - <eval expected="(solid,#ff0000,1000)" xpath="//flow/block[1]/lineArea/char/@border-start"/> + <eval expected="7180" xpath="//flow/block[1]/lineArea/text[2]/@baseline"/> + <eval expected="0" xpath="//flow/block[1]/lineArea/text[2]/@offset"/> + <eval expected="5560" xpath="//flow/block[1]/lineArea/text[2]/@ipd"/> + <eval expected="7560" xpath="//flow/block[1]/lineArea/text[2]/@ipda"/> + <eval expected="(solid,#ff0000,1000)" xpath="//flow/block[1]/lineArea/text[2]/@border-after"/> + <eval expected="(solid,#ff0000,1000)" xpath="//flow/block[1]/lineArea/text[2]/@border-before"/> + <eval expected="(solid,#ff0000,1000)" xpath="//flow/block[1]/lineArea/text[2]/@border-end"/> + <eval expected="(solid,#ff0000,1000)" xpath="//flow/block[1]/lineArea/text[2]/@border-start"/> - <eval expected="7180" xpath="//flow/block[2]/lineArea/char/@baseline"/> - <eval expected="0" xpath="//flow/block[2]/lineArea/char/@offset"/> - <eval expected="5560" xpath="//flow/block[2]/lineArea/char/@ipd"/> - <eval expected="25560" xpath="//flow/block[2]/lineArea/char/@ipda"/> - <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[2]/lineArea/char/@border-after"/> - <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[2]/lineArea/char/@border-before"/> - <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[2]/lineArea/char/@border-end"/> - <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[2]/lineArea/char/@border-start"/> - <eval expected="5000" xpath="//flow/block[2]/lineArea/char/@padding-after"/> - <eval expected="5000" xpath="//flow/block[2]/lineArea/char/@padding-before"/> - <eval expected="5000" xpath="//flow/block[2]/lineArea/char/@padding-end"/> - <eval expected="5000" xpath="//flow/block[2]/lineArea/char/@padding-start"/> + <eval expected="7180" xpath="//flow/block[2]/lineArea/text[2]/@baseline"/> + <eval expected="0" xpath="//flow/block[2]/lineArea/text[2]/@offset"/> + <eval expected="5560" xpath="//flow/block[2]/lineArea/text[2]/@ipd"/> + <eval expected="25560" xpath="//flow/block[2]/lineArea/text[2]/@ipda"/> + <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[2]/lineArea/text[2]/@border-after"/> + <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[2]/lineArea/text[2]/@border-before"/> + <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[2]/lineArea/text[2]/@border-end"/> + <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[2]/lineArea/text[2]/@border-start"/> + <eval expected="5000" xpath="//flow/block[2]/lineArea/text[2]/@padding-after"/> + <eval expected="5000" xpath="//flow/block[2]/lineArea/text[2]/@padding-before"/> + <eval expected="5000" xpath="//flow/block[2]/lineArea/text[2]/@padding-end"/> + <eval expected="5000" xpath="//flow/block[2]/lineArea/text[2]/@padding-start"/> - <eval expected="7180" xpath="//flow/block[3]/lineArea/char/@baseline"/> - <eval expected="0" xpath="//flow/block[3]/lineArea/char/@offset"/> - <eval expected="5000" xpath="//flow/block[3]/lineArea/char/@ipd"/> - <eval expected="17000" xpath="//flow/block[3]/lineArea/char/@ipda"/> - <eval expected="(solid,#ff0000,3000)" xpath="//flow/block[3]/lineArea/char/@border-after"/> - <eval expected="(solid,#ff0000,1000)" xpath="//flow/block[3]/lineArea/char/@border-before"/> - <eval expected="(solid,#ff0000,2000)" xpath="//flow/block[3]/lineArea/char/@border-end"/> - <eval expected="(solid,#ff0000,4000)" xpath="//flow/block[3]/lineArea/char/@border-start"/> - <eval expected="3000" xpath="//flow/block[3]/lineArea/char/@padding-after"/> - <eval expected="1000" xpath="//flow/block[3]/lineArea/char/@padding-before"/> - <eval expected="2000" xpath="//flow/block[3]/lineArea/char/@padding-end"/> - <eval expected="4000" xpath="//flow/block[3]/lineArea/char/@padding-start"/> + <eval expected="7180" xpath="//flow/block[3]/lineArea/text[2]/@baseline"/> + <eval expected="0" xpath="//flow/block[3]/lineArea/text[2]/@offset"/> + <eval expected="5000" xpath="//flow/block[3]/lineArea/text[2]/@ipd"/> + <eval expected="17000" xpath="//flow/block[3]/lineArea/text[2]/@ipda"/> + <eval expected="(solid,#ff0000,3000)" xpath="//flow/block[3]/lineArea/text[2]/@border-after"/> + <eval expected="(solid,#ff0000,1000)" xpath="//flow/block[3]/lineArea/text[2]/@border-before"/> + <eval expected="(solid,#ff0000,2000)" xpath="//flow/block[3]/lineArea/text[2]/@border-end"/> + <eval expected="(solid,#ff0000,4000)" xpath="//flow/block[3]/lineArea/text[2]/@border-start"/> + <eval expected="3000" xpath="//flow/block[3]/lineArea/text[2]/@padding-after"/> + <eval expected="1000" xpath="//flow/block[3]/lineArea/text[2]/@padding-before"/> + <eval expected="2000" xpath="//flow/block[3]/lineArea/text[2]/@padding-end"/> + <eval expected="4000" xpath="//flow/block[3]/lineArea/text[2]/@padding-start"/> - <eval expected="5744" xpath="//flow/block[4]/lineArea/char/@baseline"/> - <eval expected="8616" xpath="//flow/block[4]/lineArea/char/@offset"/> - <eval expected="4448" xpath="//flow/block[4]/lineArea/char/@ipd"/> - <eval expected="24448" xpath="//flow/block[4]/lineArea/char/@ipda"/> - <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[4]/lineArea/char/@border-after"/> - <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[4]/lineArea/char/@border-before"/> - <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[4]/lineArea/char/@border-end"/> - <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[4]/lineArea/char/@border-start"/> - <eval expected="5000" xpath="//flow/block[4]/lineArea/char/@padding-after"/> - <eval expected="5000" xpath="//flow/block[4]/lineArea/char/@padding-before"/> - <eval expected="5000" xpath="//flow/block[4]/lineArea/char/@padding-end"/> - <eval expected="5000" xpath="//flow/block[4]/lineArea/char/@padding-start"/> + <eval expected="5744" xpath="//flow/block[4]/lineArea/text[2]/@baseline"/> + <eval expected="8616" xpath="//flow/block[4]/lineArea/text[2]/@offset"/> + <eval expected="4448" xpath="//flow/block[4]/lineArea/text[2]/@ipd"/> + <eval expected="24448" xpath="//flow/block[4]/lineArea/text[2]/@ipda"/> + <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[4]/lineArea/text[2]/@border-after"/> + <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[4]/lineArea/text[2]/@border-before"/> + <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[4]/lineArea/text[2]/@border-end"/> + <eval expected="(solid,#ff0000,5000)" xpath="//flow/block[4]/lineArea/text[2]/@border-start"/> + <eval expected="5000" xpath="//flow/block[4]/lineArea/text[2]/@padding-after"/> + <eval expected="5000" xpath="//flow/block[4]/lineArea/text[2]/@padding-before"/> + <eval expected="5000" xpath="//flow/block[4]/lineArea/text[2]/@padding-end"/> + <eval expected="5000" xpath="//flow/block[4]/lineArea/text[2]/@padding-start"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/character_vertical-align.xml b/test/layoutengine/standard-testcases/character_vertical-align.xml index 125d56fb0..36f83c01d 100644 --- a/test/layoutengine/standard-testcases/character_vertical-align.xml +++ b/test/layoutengine/standard-testcases/character_vertical-align.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-2006 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -50,10 +50,10 @@ </fo:root> </fo> <checks> - <eval expected="7180" xpath="//flow/block[1]/lineArea/char/@offset"/> - <eval expected="7180" xpath="//flow/block[2]/lineArea/char/@offset"/> - <eval expected="0" xpath="//flow/block[3]/lineArea/char/@offset"/> - <eval expected="4565" xpath="//flow/block[4]/lineArea/char/@offset"/> - <eval expected="9250" xpath="//flow/block[5]/lineArea/char/@offset"/> + <eval expected="7180" xpath="//flow/block[1]/lineArea/text[2]/@offset"/> + <eval expected="7180" xpath="//flow/block[2]/lineArea/text[2]/@offset"/> + <eval expected="0" xpath="//flow/block[3]/lineArea/text[2]/@offset"/> + <eval expected="4565" xpath="//flow/block[4]/lineArea/text[2]/@offset"/> + <eval expected="9250" xpath="//flow/block[5]/lineArea/text[2]/@offset"/> </checks> </testcase> diff --git a/test/layoutengine/standard-testcases/inline-level_id.xml b/test/layoutengine/standard-testcases/inline-level_id.xml index 9b6d22596..31096cc31 100644 --- a/test/layoutengine/standard-testcases/inline-level_id.xml +++ b/test/layoutengine/standard-testcases/inline-level_id.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-2006 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ <eval expected="page-number1" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[4]/lineArea/text[2]/@prod-id"/> <eval expected="page-number-citation1" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[5]/lineArea/text[2]/@prod-id"/> <eval expected="leader1" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[6]/lineArea/inlineparent/@prod-id"/> - <eval expected="char1" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[7]/lineArea/char/@prod-id"/> + <eval expected="char1" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[7]/lineArea/text[2]/@prod-id"/> <!--eval expected="bidi1" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[8]/lineArea/???/@prod-id"/--> <eval expected="link1" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[9]/lineArea/inlineparent/@prod-id"/> <eval expected="ifo1" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[10]/lineArea/viewport/@prod-id"/> diff --git a/test/layoutengine/standard-testcases/kerning_1_off.xml b/test/layoutengine/standard-testcases/kerning_1_off.xml new file mode 100644 index 000000000..3002d48d0 --- /dev/null +++ b/test/layoutengine/standard-testcases/kerning_1_off.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2006 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- $Id$ --> +<testcase> + <info> + <p> + This test checks kerning. This test has kerning switched off and is only used as a reference. + </p> + </info> + <cfg> + <base14kerning>false</base14kerning> + </cfg> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="normal" font-family="sans-serif"> + <fo:flow flow-name="xsl-region-body"> + <fo:block> + <fo:block><fo:inline>VAVAV</fo:inline> text-text Hello World.</fo:block> + </fo:block> + <fo:block letter-spacing="1pt"> + <fo:block><fo:inline>VAVAV</fo:inline> text-text Hello World.</fo:block> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="40020" xpath="//flow/block[1]/block[1]/lineArea/inlineparent/@ipd"/> + <true xpath="not(boolean(//flow/block[1]/block[1]/lineArea/inlineparent/text/@tlsadjust))"/> + <eval expected="0" xpath="//flow/block[1]/block[1]/lineArea/inlineparent/text/word/@offset"/> + <true xpath="not(boolean(//flow/block[1]/block[1]/lineArea/inlineparent/text/word/@letter-adjust))"/> + + <eval expected="44020" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/@ipd"/> + <eval expected="1000" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/text/@tlsadjust"/> + <eval expected="0" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/text/word/@offset"/> + <true xpath="not(boolean(//flow/block[2]/block[1]/lineArea/inlineparent/text/word/@letter-adjust))"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/kerning_1_on.xml b/test/layoutengine/standard-testcases/kerning_1_on.xml new file mode 100644 index 000000000..308a196df --- /dev/null +++ b/test/layoutengine/standard-testcases/kerning_1_on.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2006 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- $Id$ --> +<testcase> + <info> + <p> + This test checks kerning. + </p> + </info> + <cfg> + <base14kerning>true</base14kerning> + </cfg> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in"> + <fo:region-body/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="normal" font-family="sans-serif"> + <fo:flow flow-name="xsl-region-body"> + <fo:block> + <fo:block><fo:inline>VAVAV</fo:inline> text-text Hello World.</fo:block> + </fo:block> + <fo:block letter-spacing="1pt"> + <fo:block><fo:inline>VAVAV</fo:inline> text-text Hello World.</fo:block> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="36420" xpath="//flow/block[1]/block[1]/lineArea/inlineparent/@ipd"/> + <eval expected="0" xpath="//flow/block[1]/block[1]/lineArea/inlineparent/text/word/@offset"/> + <eval expected="0 -960 -840 -960 -840" xpath="//flow/block[1]/block[1]/lineArea/inlineparent/text/word/@letter-adjust"/> + + <eval expected="40420" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/@ipd"/> + <eval expected="1000" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/text/@tlsadjust"/> + <eval expected="0" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/text/word/@offset"/> + <eval expected="0 -960 -840 -960 -840" xpath="//flow/block[2]/block[1]/lineArea/inlineparent/text/word/@letter-adjust"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/text-decoration_1.xml b/test/layoutengine/standard-testcases/text-decoration_1.xml index 74c6240bf..bfa9b8c6c 100644 --- a/test/layoutengine/standard-testcases/text-decoration_1.xml +++ b/test/layoutengine/standard-testcases/text-decoration_1.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-2006 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -89,9 +89,9 @@ <true xpath="//flow/block[7]/lineArea/text/@underline-score"/> <eval expected="#000000" xpath="//flow/block[7]/lineArea/text/@underline-score-color"/> - <true xpath="not(//flow/block[8]/lineArea/text/@underline-score)"/> - <true xpath="//flow/block[8]/lineArea/char/@underline-score"/> - <eval expected="#000000" xpath="//flow/block[8]/lineArea/char/@underline-score-color"/> + <true xpath="not(//flow/block[8]/lineArea/text[1]/@underline-score)"/> + <true xpath="//flow/block[8]/lineArea/text[2]/@underline-score"/> + <eval expected="#000000" xpath="//flow/block[8]/lineArea/text[2]/@underline-score-color"/> <true xpath="not(//flow/block[9]/lineArea/text[1]/@underline-score)"/> <true xpath="//flow/block[9]/lineArea/text[2]/@underline-score"/> |