Re: fonts
Good discussion you two had. Jörg injected about the same things I would have. In the back of my mind I have a reminder that AWT has some strange behaviour in font handling making it difficult to produce high-quality text. Looking at org.apache.fop.render.awt.AWTFontMetrics there is a pointer to an AWT bug. There's other code in there that hints at deficiencies in AWT. And there are differences between JDK versions! Here are some thoughts: - I think it would be good if we could provide fonts for the PDF and other renderers from the AWT, because it would make it easier for users to add new fonts and it is consistent with Batik's approach... - ...but will we be able to get at the physical font in order to embedd it in the target file? While quickly looking into the AWT API I haven't found anything approriate. And where will we configure that a particular font should be embedded? - Will we have enough information out of AWT to produce high-quality text? For example, you need accurate information for the placement of under/overlines and superscript stuff. So having said that and considering what has been said before I think relying on AWT for font handling cannot be the only answer. I'm still on the same track as before wanting a font manager for FOP that can handle multiple font sources. This means a good heap of work but will give us the necessary flexibility to cope with almost every situation. That doesn't mean we have to provide everything immediately. Incremental improvement will do just fine. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Passing parameters to XSL file throgh Java Application
Hi, XSLTInputHandler does not provide any methods to pass parameters to the xsl file. But in the XSLTInputHandler there is a method called public XMLReader getParser() This method actually handles A Transformer Object. I would suggest you to go through this class. It is available at FOPROOT\src\org\apache\fop\apps\XSLTInputHandler.java I think there is a possibility of extending XSLTInputHandler and include your functionality by overriding the public XMLReader getParser() method. If you get a better solution do let us know regards Balajee Chandrasekaran -Original Message- From: sujata shetty [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 08, 2002 11:49 AM To: [EMAIL PROTECTED] Subject: RE: Passing parameters to XSL file throgh Java Application Hi Balajee, Thanks for the reply. The code of TransformerFactory is working fine if the file transformation is either to HTMl or CSV. But in case of PDF it is not working. I am using the below code (FOP) for PDF transformation. Driver driver = new Driver(); driver.setRenderer(Driver.RENDER_PDF); InputHandler inputHandler = new XSLTInputHandler(new File(xmlFile), new File(xslFile)); org.xml.sax.XMLReader parser = inputHandler.getParser(); driver.setOutputStream(new FileOutputStream(outFile)); driver.render(parser, inputHandler.getInputSource()); But I don't know, How do I pass paramters in the above mentioned code Thanks and Regards, Sujata --- Balajee Chandrasekaran [EMAIL PROTECTED] wrote: Following code snippet Enables parameter passing through Java TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource(foo.xsl)); // Set the parameter. transformer.setParameter(param1,/* parameter name */ paramValue /* parameter value */ ); transformer.transform(new StreamSource(foo.xml), new StreamResult(System.out)); Hope this helps. regards Balajee Chandrasekaran -Original Message- From: sujata shetty [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 08, 2002 11:19 AM To: [EMAIL PROTECTED] Subject: Passing parameters to XSL file throgh Java Application Hi, I am creating a PDF file from an XML throgh XSL FO stylesheet. It is working fine. BUt I need to pass some parameters to XSL sheet through JAVA program. If parameter passing is done through XML Transformer, It will not transform to PDF and I am anable to open PDF file. Can anyone help me out in passing parameters to XSL through JAVA to create PDF file? Thanks and Regards, Sujata __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com MASTEK Investing in relationships In the US, we're called MAJESCO ~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from all computers. ~~ __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com MASTEK Investing in relationships In the US, we're called MAJESCO ~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned
Re: fonts
At 02:31 AM 10/8/02, you wrote: Will we have enough information out of AWT to produce high-quality text? For example, you need accurate information for the placement of under/overlines and superscript stuff. $.02: Underlines are in the (newish) LineMetrics object available from a Font, nothing I know of about overlines, sub/super script per se. One piece of bad news is that presently the JDK has a problem producing identical output to the screen vs a printer (I documented the problem here a couple months ago viz-a-viz Windows, at least.) As I recall, the rasterizer comes up with output glyphs that do not match the size predicted by measuring text using the font-metrics. Even worse is that it seems to fails differently between depending on major version ~ 1.3 and 1.4 ~ (maybe even among sub versions.) I recall wondering if fop could get better results in the awt if, at the time it creates its reference font metrics, it were to know the actual target (ie printer vs screen vs pdf) graphics context. Then I wondered what this had to do with pdf and went to sleep... ' Best, -Ralph LaChance In theory, there is no difference between theory and practice, but in practice there is. (Someone wrote that, but I don't know who.) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
DO NOT REPLY [Bug 13406] New: - Using padding displaces basic-link
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13406. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13406 Using padding displaces basic-link Summary: Using padding displaces basic-link Product: Fop Version: 0.20.4 Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: page-master/layout AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Overview Description: Consider a page with 2 blocks. The first contains some text and has the padding attribute set (for example, padding=5mm). The second contains an external basic-link. The resulting PDF file shows the two blocks correctly, but the active area of the basic-link (the area over which it's possible to follow the link) is set 10mm above the corresponding text. This bug is always reproducible. Steps to Reproduce: See the attached file Actual Results: The active area is 10mm above the corresponding text Expected Results: The active area must be over the corresponding text - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
DO NOT REPLY [Bug 13406] - Using padding displaces basic-link
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13406. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13406 Using padding displaces basic-link --- Additional Comments From [EMAIL PROTECTED] 2002-10-08 13:23 --- Created an attachment (id=3388) Test case - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
New Developer Suggestion
Hi, my name is Scott Sauyet, a Java developer in Connecticut, USA. I'm new to this group. I've been reading for about a month, but have made no contributions yet. I would like to contribute. Eventually, I hope to understand the system well enough to produce a spin-off which could render output for high-volume printers, in Xerox Metacode, AFP, or some such; this would be very useful for my industry. First, obviously, I have to learn how it all works. I'm looking for a suggestion. When trying to learn a system, I usually find it easiest to have some task, some project that would improve the product. I don't want to assign any work to myself from the bug list. I don't know how much time I can dedicate to it, and I don't want anyone thinking something is being actively worked on when it's not clear if I can deliver or when it might be ready. So what I was hoping for is a suggestion for something that I can work on that might be useful, but not critical to any immediate plans, ideally something that overlaps little with currently active portions of the project. If you have any ideas, please let me know, either on or off the mailing list. Thanks, -- Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
BARCODE
Title: BARCODE Hi! Is it possible to embed barcodes into PDF using FOP? Thanks in advance, Maxim Surov
RE: BARCODE
Title: BARCODE If you made the barcode a graphic, you could embed it. -Original Message-From: Surov Maxim [mailto:[EMAIL PROTECTED]]Sent: Tuesday, October 08, 2002 10:34 AMTo: [EMAIL PROTECTED]Subject: BARCODE Hi! Is it possible to embed barcodes into PDF using FOP? Thanks in advance, Maxim Surov
Tif rendering sizes?
Title: BARCODE Does anyone know that largest Tif file size fop can handle to render into PDF format?
RE: BARCODE
Title: BARCODE Thanks! Could you suggest me some free packages which support barcodes simpliciter? (Something like http://big.faceless.org/but free) If you made the barcode a graphic, you could embed it. -Original Message-From: Surov Maxim [mailto:[EMAIL PROTECTED]]Sent: Tuesday, October 08, 2002 10:34 AMTo: [EMAIL PROTECTED]Subject: BARCODE Hi! Is it possible to embed barcodes into PDF using FOP? Thanks in advance, Maxim Surov
RE: BARCODE
Title: BARCODE There are some threads in the archives which describe using Barcode fonts. I'm sure if you search in the archives for "barcode" you'd come up with something relevant to your needs. -Original Message-From: Surov Maxim [mailto:[EMAIL PROTECTED]]Sent: Tuesday, October 08, 2002 10:34 AMTo: [EMAIL PROTECTED]Subject: BARCODE Hi! Is it possible to embed barcodes into PDF using FOP? Thanks in advance, Maxim Surov
Setting the user configuration in embedded code
Hi, wonder if anyone can help. I am trying to set the user configuratuion file with FOP embedded in my app. java.io.BufferedOutputStream bufferedOutputStream = null; org.apache.fop.apps.Driver driver = null; java.io.ByteArrayInputStream byteArrayInputStream = null; // file to write output to bufferedOutputStream = new java.io.BufferedOutputStream ( outputStream ); // create FOP object with arguments, and run it byteArrayInputStream = new java.io.ByteArrayInputStream ( this.writeXML ( document, true ).getBytes ( ) ); driver = new org.apache.fop.apps.Driver ( new org.xml.sax.InputSource ( byteArrayInputStream ), bufferedOutputStream ); // render pdf to file driver.setRenderer ( driver.RENDER_PDF ); driver.run ( ); // close file bufferedOutputStream.close ( ); I would like to specify some options for loading custom fonts. Has anyone done this or know how to load a user config file in code. ANy help would be appreciated. Regards Paul. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Setting the user configuration in embedded code
The user config options are static, so you can call this anywhere before you start you create your driver. You only have to call this once. import org.apache.fop.apps.Options; // Declare our FOP User Config file (this is where we get our fonts) File userConfigFile = new File( userconfig.xml ); org.apache.fop.apps.Options options = new org.apache.fop.apps.Options( userconfig.xml ); [EMAIL PROTECTED] 10/08/02 09:10 AM Please respond to fop-dev To:[EMAIL PROTECTED] cc: Subject:Setting the user configuration in embedded code Hi, wonder if anyone can help. I am trying to set the user configuratuion file with FOP embedded in my app. java.io.BufferedOutputStream bufferedOutputStream = null; org.apache.fop.apps.Driver driver= null; java.io.ByteArrayInputStream byteArrayInputStream = null; // file to write output to bufferedOutputStream = new java.io.BufferedOutputStream ( outputStream ); // create FOP object with arguments, and run it byteArrayInputStream = new java.io.ByteArrayInputStream ( this.writeXML ( document, true ).getBytes ( ) ); driver = new org.apache.fop.apps.Driver ( new org.xml.sax.InputSource ( byteArrayInputStream ), bufferedOutputStream ); // render pdf to file driver.setRenderer ( driver.RENDER_PDF ); driver.run ( ); // close file bufferedOutputStream.close ( ); I would like to specify some options for loading custom fonts. Has anyone done this or know how to load a user config file in code. ANy help would be appreciated. Regards Paul. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: BARCODE
Two ways I know of. Using barcode fonts. Using SVG to draw barcode. We have used a stylesheet to draw the SVG works really well. Rhett Aultman [EMAIL PROTECTED] on 08/10/2002 15:34:55 Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: RE: BARCODE If you made the barcode a graphic, you could embed it. -Original Message- From: Surov Maxim [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 08, 2002 10:34 AM To: [EMAIL PROTECTED] Subject: BARCODE Hi! Is it possible to embed barcodes into PDF using FOP? Thanks in advance, Maxim Surov - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: fonts
Jeremias Maerki wrote: In the back of my mind I have a reminder that AWT has some strange behaviour in font handling making it difficult to produce high-quality text. Looking at org.apache.fop.render.awt.AWTFontMetrics there is a pointer to an AWT bug. There's other code in there that hints at deficiencies in AWT. And there are differences between JDK versions! Acknowledged. Being quite a bit of an incrementalist myself, the scope of the project that I am contemplating revolved around only the FontMetrics -- in other words, it would only replace the font metric information that we currently get from the generated XML files. Layout and rendering chores could be added later, iff they made sense. Are the problems you are seeing related to the metrics or to other issues? Obviously if the basic metrics we get out of AWT are bad, that would be a deal killer. In addition to the JDK version, there is a JRE issue here as well that I neglected to mention. Since the createFont method doesn't exist until 1.3, wouldn't that be the minimum JRE that could be used to run FOP if we rely on that to get unregistered font information? - ...but will we be able to get at the physical font in order to embedd it in the target file? While quickly looking into the AWT API I haven't found anything approriate. And where will we configure that a particular font should be embedded? This is a good point. I don't see where java tells us how to get to the physical file either. However, we have to configure a path to the physical file now to embed the font, so we aren't really going backwards on this issue. Also, I see no problem with using the current scheme for configuring the embedding (i.e. if embed-file exists, use it, otherwise, don't embed). The trick will be, if we use the AWT, to teach the users how to make sure that the names match or map properly. We may need to build a qd tool to let the users see the fonts (and names) on their system that AWT can see. - Will we have enough information out of AWT to produce high-quality text? For example, you need accurate information for the placement of under/overlines and superscript stuff. If we are talking about metric info only, I think so, but I could be wrong. So having said that and considering what has been said before I think relying on AWT for font handling cannot be the only answer. I'm still on the same track as before wanting a font manager for FOP that can handle multiple font sources. This means a good heap of work but will give us the necessary flexibility to cope with almost every situation. That doesn't mean we have to provide everything immediately. Incremental improvement will do just fine. You have convinced me. Here is what I propose: Hide both the current design and the AWT fonts behind a class that is used everywhere within FOP. If the AWT approach is flaky for any reason, we can always fall back on the current approach, but we can then experiment at will with AWT (at the metrics level). To make this work, we'll need to look in the configuration info for fonts before looking at AWT. This also means we don't need to do anything with createFont for the moment, which also makes the JRE issue go away. The downside is that we won't be able to mess with AWT for layout help (unless a similar approach is taken to hide the differences there). I think that will keep me busy for a couple of minutes :-) Thanks again for all of the good insight. Victor Mote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Trademark and copyright symbols
Swapan Golla wrote: I have text node which has copyright (#169;) and trademark (#x2122;) symbols embedded in it. When I produce pdf using FOP 0.20.4, I get © for copyright symbols on windows 2000 platform and Â#© on linux redhat 7.2 platform. I am using jdk 1.3.1_03. Anybody know why this is occuring ? It looks like you have the files written in UTF-8 encoding, but the parser assumes ISO-8859-1 or a similar 8bit encoding. Check the encoding in the XML declaration, it should be UTF-8 or absent. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: BARCODE
Surov Maxim wrote: Thanks! Could you suggest me some free packages which support barcodes simpliciter? (Something like http://big.faceless.org/ but free) There is a generator written in XSLT available at http://www.renderx.com/barcodes.html J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Tif rendering sizes?
[EMAIL PROTECTED] wrote: Does anyone know that largest Tif file size fop can handle to render into PDF format? The first hard limit reached is probably the JVM memory (1GB). FOP doesn't deal with TIFF itself but relies on the Jimi library. It may be possible to find more hard data on limits in the Jimi documentation or its source. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Generating PDF Files Dynamically
Hi, Does anybody know how to generate PDF Files Dynamically using XSL-FO and Perl? If you know please let me know. Thanks, Venkat
Hyphenated text as String
Hey Foppers: Is there some way to get the hyphenated text of a particular block(s) returned as a string (with hyphens in place)? Since FOP puts hyphens in place at the time of the transform, I'm hoping to get back the hyphenated strings of specific blocks for a different portion of my application. Is this possible? Any input/examples would be greatly appreciated. Thanks! jw - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Hyphenated text as String
Jim Wright wrote: Is there some way to get the hyphenated text of a particular block(s) returned as a string (with hyphens in place)? Since FOP puts hyphens in place at the time of the transform, I'm hoping to get back the hyphenated strings of specific blocks for a different portion of my application. You might want to take a look at the Hyphenator class. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Hyphenated text as String
I did. And it seems like the right class to use, but it looks like it just hyphenates one word at a time(?). Can you point me toward which class decides which word is last on a line (measures text length), and hands it off to hyphenator? If I could just get a point of reference as to how Hyphenator is called by a specific block, I think I could ferret out the rest pretty quick. I checked the Javadoc, but couldn't find which class(es) used hyphenator on the block-level. Thanks for your help! jw On Tuesday, October 8, 2002, at 04:53 PM, J.Pietschmann wrote: Jim Wright wrote: Is there some way to get the hyphenated text of a particular block(s) returned as a string (with hyphens in place)? Since FOP puts hyphens in place at the time of the transform, I'm hoping to get back the hyphenated strings of specific blocks for a different portion of my application. You might want to take a look at the Hyphenator class. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Hyphenated text as String
Jim Wright wrote: I did. And it seems like the right class to use, but it looks like it just hyphenates one word at a time(?). Can you point me toward which class decides which word is last on a line (measures text length), and hands it off to hyphenator? If I could just get a point of reference as to how Hyphenator is called by a specific block, I think I could ferret out the rest pretty quick. I checked the Javadoc, but couldn't find which class(es) used hyphenator on the block-level. Windows explorer can search for files containing certain text, on Unixes there is find|grep. The code you are asking for is in LineArea.java. Be warned: it is very messy, and FOP does *not* hyphenate words, it just fakes it very successfully. One of the problems is that text making up a single word may be passed in multiple chunks to the routine doing the formatting, the other is that it isn't *really* clear what's a word if scripts are arbitrarily mixed. FOP is not language or script sensitive and just assumes that characters below #128; make up words, and everything else is just punctuation but is passed to the hyphenator anyway. In order to have proper word detection for hyphenation, a Unicode character property DB and TR29 (http://www.unicode.org/unicode/reports/tr29/) would be needed. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Hyphenated text as String
Sigh. Yeah, I was looking at that class, but hoped there was a more all in one approach. Thanks again for the input. jw On Tuesday, October 8, 2002, at 05:28 PM, J.Pietschmann wrote: Jim Wright wrote: I did. And it seems like the right class to use, but it looks like it just hyphenates one word at a time(?). Can you point me toward which class decides which word is last on a line (measures text length), and hands it off to hyphenator? If I could just get a point of reference as to how Hyphenator is called by a specific block, I think I could ferret out the rest pretty quick. I checked the Javadoc, but couldn't find which class(es) used hyphenator on the block-level. Windows explorer can search for files containing certain text, on Unixes there is find|grep. The code you are asking for is in LineArea.java. Be warned: it is very messy, and FOP does *not* hyphenate words, it just fakes it very successfully. One of the problems is that text making up a single word may be passed in multiple chunks to the routine doing the formatting, the other is that it isn't *really* clear what's a word if scripts are arbitrarily mixed. FOP is not language or script sensitive and just assumes that characters below #128; make up words, and everything else is just punctuation but is passed to the hyphenator anyway. In order to have proper word detection for hyphenation, a Unicode character property DB and TR29 (http://www.unicode.org/unicode/reports/tr29/) would be needed. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
DO NOT REPLY [Bug 13433] New: - PS rendering crashes with a run-time exception, No such method
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13433. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13433 PS rendering crashes with a run-time exception, No such method Summary: PS rendering crashes with a run-time exception, No such method Product: Fop Version: 0.20.4 Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: general AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The problem occurs after editing build.XML to set debug=on and rebuilding FOP with Ant and JDK1.4. (I required debug on to step into the program using Jbuilder6.) FOP then crashes with a run-time exception, No such method when rendering an fo file to PostScript. The crash occurs in the file PSRenderer.java at line 697: psString = (new StringBuffer(().append(sb).append() t)).toString(); where sb is a previously defined StringBuffer. Changing this to: psString = (new StringBuffer(().append(sb.toString()).append() t)).toString (); fixes the problem. Note that Java does not have a method StringBuffer.append(StringBuffer) There is .append(object) which is why the program compiles but this results in .append(object.valueOf()) rather than .toString(). What I don't understand is why it crashes with debugging on but not when debug is off? I have rebuilt and run FOP several times with debugging on and off but always get the same result; maybe there is some optimization not present in debugging version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
cvs commit: xml-fop/build/classes/conf userconfig.xml
pbwest 2002/10/08 21:42:14 Modified:build/classes/conf Tag: FOP_0-20-0_Alt-Design userconfig.xml Log: Changed location of debugging test file. Revision ChangesPath No revision No revision 1.1.2.2 +2 -7 xml-fop/build/classes/conf/Attic/userconfig.xml Index: userconfig.xml === RCS file: /home/cvs/xml-fop/build/classes/conf/Attic/userconfig.xml,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- userconfig.xml8 May 2002 05:29:03 - 1.1.2.1 +++ userconfig.xml9 Oct 2002 04:42:14 - 1.1.2.2 @@ -15,18 +15,13 @@ /entry entry -keyfoFileName/key -value/home/pbw/public_html/xml/newtest3.fo/value - /entry - - entry keyinputMode/key valuefo/value /entry entry keyfoFileName/key -value/home/pbw/public_html/xml/newtest3.fo/value +value/usr/local/src/xml-fop_20_Alt/docs/examples/fo/test.fo/value /entry entry @@ -36,7 +31,7 @@ entry keyoutputFileName/key -value/home/pbw/public_html/xml/newtest3.pdf/value +value/usr/local/src/xml-fop_20_Alt/docs/examples/tests/test.pdf/value /entry !-- NOT IMPLEMENTED - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/conf userconfig.xml
pbwest 2002/10/08 21:43:32 Modified:conf Tag: FOP_0-20-0_Alt-Design userconfig.xml Log: Changed location of debugging test file. Revision ChangesPath No revision No revision 1.5.4.2 +2 -7 xml-fop/conf/Attic/userconfig.xml Index: userconfig.xml === RCS file: /home/cvs/xml-fop/conf/Attic/userconfig.xml,v retrieving revision 1.5.4.1 retrieving revision 1.5.4.2 diff -u -r1.5.4.1 -r1.5.4.2 --- userconfig.xml7 May 2002 14:42:58 - 1.5.4.1 +++ userconfig.xml9 Oct 2002 04:43:32 - 1.5.4.2 @@ -15,18 +15,13 @@ /entry entry -keyfoFileName/key -value/home/pbw/public_html/xml/newtest3.fo/value - /entry - - entry keyinputMode/key valuefo/value /entry entry keyfoFileName/key -value/home/pbw/public_html/xml/newtest3.fo/value +value/usr/local/src/xml-fop_20_Alt/docs/examples/fo/test.fo/value /entry entry @@ -36,7 +31,7 @@ entry keyoutputFileName/key -value/home/pbw/public_html/xml/newtest3.pdf/value +value/usr/local/src/xml-fop_20_Alt/docs/examples/tests/test.pdf/value /entry !-- NOT IMPLEMENTED - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/datatypes AbstractPropertyValue.java
pbwest 2002/10/08 21:50:24 Modified:src/org/apache/fop/datatypes Tag: FOP_0-20-0_Alt-Design AbstractPropertyValue.java Log: Removed stackedBy references. Added typeString(). Modified toString(). Revision ChangesPath No revision No revision 1.1.2.5 +10 -23 xml-fop/src/org/apache/fop/datatypes/Attic/AbstractPropertyValue.java Index: AbstractPropertyValue.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/datatypes/Attic/AbstractPropertyValue.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- AbstractPropertyValue.java4 Oct 2002 15:49:33 - 1.1.2.4 +++ AbstractPropertyValue.java9 Oct 2002 04:50:24 - 1.1.2.5 @@ -34,11 +34,6 @@ * An integer property type. */ public final int type; - -/** - * The ttFONode/tt that stacked this value. - */ -private FONode stackedBy = null; /** * @param index index of the property in the property arrays. @@ -90,21 +85,6 @@ } /** - * Set the node that stacked this value. - * @param node - the ttFONode/tt that stacked this value. - */ -public void setStackedBy(FONode node) { -stackedBy = node; -} - -/** - * Get the node that stacked this value. - */ -public FONode getStackedBy() { -return stackedBy; -} - -/** * In some circumstances, the property against which a type is to be * validated may not be the same as the property against which this * iAbstractPropertyValue/i is defined. @@ -146,10 +126,17 @@ validate(property, type); } +public static String typeString(int type) { +if (type 0 || type PropertyValue.LAST_PROPERTY_TYPE) +return Property type out of range; +return PropertyValue.propertyTypes.get(type); +} + public String toString() { try { return Property: + PropNames.getPropertyName(property) -+ Index: + property; ++ Index: + property + Type: + +typeString(type); } catch (PropertyException e) { throw new RuntimeException(e.getMessage()); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/datatypes PropertyValueList.java
pbwest 2002/10/08 21:52:21 Modified:src/org/apache/fop/datatypes Tag: FOP_0-20-0_Alt-Design PropertyValueList.java Log: Removed stackedBy references. Modified toString(). Revision ChangesPath No revision No revision 1.1.2.4 +17 -24 xml-fop/src/org/apache/fop/datatypes/Attic/PropertyValueList.java Index: PropertyValueList.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/datatypes/Attic/PropertyValueList.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- PropertyValueList.java2 Oct 2002 07:00:08 - 1.1.2.3 +++ PropertyValueList.java9 Oct 2002 04:52:21 - 1.1.2.4 @@ -1,5 +1,7 @@ package org.apache.fop.datatypes; +import java.lang.reflect.InvocationTargetException; + import java.util.LinkedList; import java.util.Collection; import java.util.Iterator; @@ -39,11 +41,6 @@ public final int type; /** - * The ttFONode/tt that stacked this value. - */ -private FONode stackedBy = null; - -/** * @param property ttint/tt index of the property. */ public PropertyValueList(int property) throws PropertyException { @@ -184,21 +181,6 @@ } /** - * Set the node that stacked this value. - * @param node - the ttFONode/tt that stacked this value. - */ -public void setStackedBy(FONode node) { -stackedBy = node; -} - -/** - * Get the node that stacked this value. - */ -public FONode getStackedBy() { -return stackedBy; -} - -/** * In some circumstances, the property against which a type is to be * validated may not be the same as the property against which this * iAbstractPropertyValue/i is defined. @@ -248,9 +230,20 @@ Iterator contents = iterator(); while (contents.hasNext()) { int i = 0, j = 0; -cstr = contents.next().toString(); +Object obj = contents.next(); +try { +cstr = (String)(obj.getClass() +.getMethod(toString, null) +.invoke(obj, null)); +} catch (IllegalAccessException e) { +throw new PropertyException (e); +} catch (NoSuchMethodException e) { +throw new PropertyException (e); +} catch (InvocationTargetException e) { +throw new PropertyException (e); +} while (i cstr.length() j = 0) { -j = cstr.indexOf('\n'); +j = cstr.indexOf('\n', j); if (j = 0) { str = str + + cstr.substring(i, ++j); i = j; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/datatypes PropertyValue.java
pbwest 2002/10/08 21:54:47 Modified:src/org/apache/fop/datatypes Tag: FOP_0-20-0_Alt-Design PropertyValue.java Log: Removed stackedBy references. Added ROStringArray propertyTypes. Revision ChangesPath No revision No revision 1.1.2.5 +36 -14xml-fop/src/org/apache/fop/datatypes/Attic/PropertyValue.java Index: PropertyValue.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/datatypes/Attic/PropertyValue.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- PropertyValue.java2 Oct 2002 07:00:08 - 1.1.2.4 +++ PropertyValue.java9 Oct 2002 04:54:46 - 1.1.2.5 @@ -2,6 +2,7 @@ import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.FONode; +import org.apache.fop.datastructs.ROStringArray; /* * PropertyValue.java @@ -53,6 +54,39 @@ ,LAST_PROPERTY_TYPE = LIST; +public static final ROStringArray propertyTypes = +new ROStringArray(new String[] { +NO_TYPE +,ANGLE +,AUTO +,BOOL +,COLOR_TYPE +,COUNTRY +,ENUM +,FONT_FAMILY +,FREQUENCY +,FROM_NEAREST_SPECIFIED +,FROM_PARENT +,INHERIT +,INHERITED_VALUE +,INTEGER +,LANGUAGE +,LITERAL +,MAPPED_NUMERIC +,MIME_TYPE +,NCNAME +,NONE +,NUMERIC +,SCRIPT +,SHADOW_EFFECT +,SLASH +,TEXT_DECORATIONS +,TEXT_DECORATOR +,TIME +,URI_LIST +,LIST +}); + /** * @return ttint/tt property index. */ @@ -64,18 +98,6 @@ * @return type field of the ttPropertyValue/tt. */ public int getType(); - -/** - * Set the reference to the ttFONode/tt that stacked this value. - * @param node - the stacking tt.FONode/tt. - */ -public void setStackedBy(FONode node); - -/** - * Get a reference to the ttFONode/tt that stacked this value. - * @return ttFONode/tt that stacked this value. - */ -public FONode getStackedBy(); /** * In some circumstances, the property against which a type is to be - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/datatypes Numeric.java
pbwest 2002/10/08 22:45:57 Modified:src/org/apache/fop/datatypes Tag: FOP_0-20-0_Alt-Design Numeric.java Log: Modified abs() to return Numeric. Works with any kind of Numeric value. Modified max() and min() to return Numeric and to operate on any Numerics of the same baseunit and power. Added setValue() and setPower() for use with the modified methods. Revision ChangesPath No revision No revision 1.1.2.8 +66 -29xml-fop/src/org/apache/fop/datatypes/Attic/Numeric.java Index: Numeric.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/datatypes/Attic/Numeric.java,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- Numeric.java 18 Sep 2002 15:24:12 - 1.1.2.7 +++ Numeric.java 9 Oct 2002 05:45:56 - 1.1.2.8 @@ -271,6 +271,15 @@ } /** + * Set the value. This used on ttNumeric/tt clones in the iabs/i + * imin/i and imax/i operations. + * @param value - the ttdouble/tt value. + */ +protected void setValue(double value) { +this.value = value; +} + +/** * @return ttint/tt unit power of this iNumeric/i. */ public int getPower() { @@ -278,6 +287,14 @@ } /** + * Set the power. A complement to the isetValue/i method. + * @param power - the ttint/tt power. + */ +protected void setPower(int power) { +this.power = power; +} + +/** * @return ttint/tt current baseunit of this iNumeric/i. */ public int getBaseunit() { @@ -673,57 +690,77 @@ } /** - * Return the absolute value of this ttNumeric/tt. This is an + * Return a new ttNumeric/tt with the absolute value of this. + * This is an * implementation of the core function library ttabs/tt function. - * It is only valid on an absolute numeric of unit power zero. * @return A ttdouble/tt containing the absolute value. - * @exception PropertyException if ivalue/i is not unit power zero. + * @exception PropertyException if cloning fails. */ -public double abs() throws PropertyException { -if (power != 0) -throw new PropertyException -(abs requires absolute numeric of unit power zero); -return Math.abs(value); +public Numeric abs() throws PropertyException { +Numeric n; +try { +n = (Numeric)(this.clone()); +} catch (CloneNotSupportedException e) { +throw new PropertyException(e); +} +n.setValue(Math.abs(value)); +return n; } /** - * Return a ttdouble/tt which is the maximum of the current value and + * Return a ttNumeric/tt which is the maximum of the current value and * the operand. This is an implementation of the core function library * ttmax/tt function. It is only valid for comparison of two - * absolute ttNumeric/tt values. + * values of the same unit power and same type, i.e. both absolute or + * both percentages. * @param op a ttNumeric/tt representing the comparison value. * @return a ttdouble/tt representing the imax/i of * ithis.value/i and the ivalue/i of iop/i. - * @throws PropertyException If the power of this - * object and the operand are different or not 0. + * @throws PropertyException If the baseunit or power of this + * object and the operand are different, or if cloning fails. */ -public double max(Numeric op) throws PropertyException { -// Only compare if both have unit power 0 -if (power == op.power power == 0) { -return Math.max(value, op.value); +public Numeric max(Numeric op) throws PropertyException { +Numeric n; +// Only compare if both have same unit power and same baseunit +if (power == op.power baseunit == op.baseunit) { +try { +n = (Numeric)(this.clone()); +} catch (CloneNotSupportedException e) { +throw new PropertyException(e); +} +n.setValue(Math.max(value, op.value)); +return n; } throw new PropertyException -(max() must compare numerics of unit power 0.); +(max() must compare numerics of same baseunit unit power.); } /** - * Return a ttdouble/tt which is the minimum of the current value and + * Return a ttNumeric/tt which is the minimum of the current value and * the operand. This is an implementation of the core function library * ttmin/tt function. It is
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/10/08 22:53:32 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Added specific error test for LIST passed to refineParsing(). Revision ChangesPath No revision No revision 1.1.2.32 +8 -3 xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.31 retrieving revision 1.1.2.32 diff -u -r1.1.2.31 -r1.1.2.32 --- Properties.java 4 Oct 2002 15:57:56 - 1.1.2.31 +++ Properties.java 9 Oct 2002 05:53:30 - 1.1.2.32 @@ -424,6 +424,11 @@ if (pv == value) return value; // unable to resolve // TODO: validate here return pv; +case PropertyValue.LIST: +System.out.println((PropertyValueList)value); +throw new PropertyException +(PropertyValueList passed to Properties.refineParsing for ++ propName); default: if ( ! nested) { if ((datatype COMPOUND) != 0) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo FOTree.java
pbwest 2002/10/08 22:55:06 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design FOTree.java Log: Commented out debugging output. Revision ChangesPath No revision No revision 1.1.2.17 +4 -4 xml-fop/src/org/apache/fop/fo/Attic/FOTree.java Index: FOTree.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/FOTree.java,v retrieving revision 1.1.2.16 retrieving revision 1.1.2.17 diff -u -r1.1.2.16 -r1.1.2.17 --- FOTree.java 5 Oct 2002 02:44:24 - 1.1.2.16 +++ FOTree.java 9 Oct 2002 05:55:06 - 1.1.2.17 @@ -96,8 +96,8 @@ if (i == PropNames.FONT_SIZE) continue; // Set up the initial values for each property prop = PropertyConsts.getInitialValue(i); -System.out.println(Setting initial value: - + i + ((prop == null) ? NULL : notNULL)); +//System.out.println(Setting initial value: +// + i + ((prop == null) ? NULL : notNULL)); initialValues[i] = prop; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo FoRoot.java
pbwest 2002/10/08 22:56:31 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design FoRoot.java Log: Modified signatures for xmlevents.get?Element() methods. Revision ChangesPath No revision No revision 1.1.2.8 +9 -8 xml-fop/src/org/apache/fop/fo/Attic/FoRoot.java Index: FoRoot.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/FoRoot.java,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- FoRoot.java 6 Oct 2002 14:28:02 - 1.1.2.7 +++ FoRoot.java 9 Oct 2002 05:56:31 - 1.1.2.8 @@ -85,7 +85,8 @@ // Look for layout-master-set try { ev = xmlevents.expectStartElement -(XMLNamespaces.XSLNSpaceIndex, layout-master-set); +(XMLNamespaces.XSLNSpaceIndex, layout-master-set, +XMLEvent.DISCARD_W_SPACE); } catch (NoSuchElementException e) { throw new FOPException(e); } @@ -99,15 +100,15 @@ } layoutMasters.setupPageMasters(); // Stub - flush the layout masters -ev = xmlevents.getEndElement -(XMLNamespaces.XSLNSpaceIndex, layout-master-set); +ev = xmlevents.getEndElement(ev); // Look for optional declarations try { xmlevents.expectStartElement -(XMLNamespaces.XSLNSpaceIndex, declarations); +(XMLNamespaces.XSLNSpaceIndex, declarations, +XMLEvent.DISCARD_W_SPACE); // process the declarations xmlevents.getEndElement -(XMLNamespaces.XSLNSpaceIndex, declarations); +(XMLNamespaces.XSLNSpaceIndex, declarations); } catch (NoSuchElementException e) { // Take no notice - declarations is optional } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo FONode.java
pbwest 2002/10/08 22:57:10 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design FONode.java Log: Modified exception handling. Revision ChangesPath No revision No revision 1.19.2.16 +4 -4 xml-fop/src/org/apache/fop/fo/FONode.java Index: FONode.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FONode.java,v retrieving revision 1.19.2.15 retrieving revision 1.19.2.16 diff -u -r1.19.2.15 -r1.19.2.16 --- FONode.java 5 Oct 2002 02:44:24 - 1.19.2.15 +++ FONode.java 9 Oct 2002 05:57:09 - 1.19.2.16 @@ -184,9 +184,9 @@ .get(property)) .invoke(null, foTree.args)); } catch (IllegalAccessException e) { -throw new PropertyException (e.getMessage()); +throw new PropertyException (e); } catch (InvocationTargetException e) { -throw new PropertyException (e.getMessage()); +throw new PropertyException (e); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo FOAttributes.java
pbwest 2002/10/08 22:57:50 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design FOAttributes.java Log: Comment change. Revision ChangesPath No revision No revision 1.1.2.7 +6 -6 xml-fop/src/org/apache/fop/fo/Attic/FOAttributes.java Index: FOAttributes.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/FOAttributes.java,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -r1.1.2.6 -r1.1.2.7 --- FOAttributes.java 1 Oct 2002 16:34:44 - 1.1.2.6 +++ FOAttributes.java 9 Oct 2002 05:57:49 - 1.1.2.7 @@ -45,7 +45,8 @@ * ttHashMap/tts which contain the attribute lists for each * namespace which may be active for a particular FO element. The * ttArrayList/tt is indexed by the URIIndex for this namespace - * which is statically maintained by ttXMLEvent/tt. The + * which is maintained in an ttXMLNamespaces/tt object by the + * ttFOTree/tt object which is processing the FO input. The * values in the ttHashMap/tts are indexed by the local name of the * attribute. * The ttArrayList/tt will not be created for a particular instance @@ -119,8 +120,7 @@ //System.out.println(FONode: + event); if (attrUriIndex == XMLNamespaces.DefAttrNSIndex) { // Standard FO namespace -// Catch default namespace declaration here. This seems to -// be a kludge. Should 'xmlns' come through here? +// Catch default namespace declaration here. if (attrLocalname.equals(xmlns)) break; // Is this a known (valid) property? try { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo/pagination FoLayoutMasterSet.java FoPageSequenceMaster.java
pbwest 2002/10/08 23:00:49 Modified:src/org/apache/fop/fo/pagination Tag: FOP_0-20-0_Alt-Design FoLayoutMasterSet.java FoPageSequenceMaster.java Log: Use array argument for multiple choice expectStartElement() calls. Revision ChangesPath No revision No revision 1.1.2.6 +20 -10 xml-fop/src/org/apache/fop/fo/pagination/Attic/FoLayoutMasterSet.java Index: FoLayoutMasterSet.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/Attic/FoLayoutMasterSet.java,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- FoLayoutMasterSet.java6 Oct 2002 14:18:05 - 1.1.2.5 +++ FoLayoutMasterSet.java9 Oct 2002 06:00:49 - 1.1.2.6 @@ -11,6 +11,7 @@ import org.apache.fop.fo.FOTree; import org.apache.fop.fo.FONode; import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.xml.XMLEvent; import org.apache.fop.xml.XMLNamespaces; import org.apache.fop.xml.SyncedXmlEventsBuffer; import org.apache.fop.datastructs.Tree; @@ -37,6 +38,18 @@ private static final String revision = $Revision$; /** + * An array with ttXMLEvent.UriLocalName/tt objects identifying + * ttsimple-page-master/tt and ttpage-sequence-master/tt + * XML events. + */ +private static final XMLEvent.UriLocalName[] simpleOrSequenceMaster = { +new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, simple-page-master), +new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, page-sequence-master) +}; + +/** * Hash of SimplePageMaster and PageSequenceMaster objects, * indexed by master-name of the object. */ @@ -68,19 +81,16 @@ * (simple-page-master|page-sequence-master)+ */ public void setupPageMasters() throws FOPException { -// Set up a list with the two possibilities -LinkedList list = new LinkedList(); -list.add((Object)(new XMLEvent.UriLocalName - (XMLNamespaces.XSLNSpaceIndex, simple-page-master))); -list.add((Object)(new XMLEvent.UriLocalName - (XMLNamespaces.XSLNSpaceIndex, page-sequence-master))); +// Use an array with the two possibilities try { do { FoSimplePageMaster simple; String simpleName; String localName; FoPageSequenceMaster pageSeq; -XMLEvent ev = xmlevents.expectStartElement(list); +XMLEvent ev = +xmlevents.expectStartElement +(simpleOrSequenceMaster, XMLEvent.DISCARD_W_SPACE); localName = ev.getLocalName(); if (localName.equals(simple-page-master)) { System.out.println(Found simple-page-master); 1.1.2.6 +21 -13 xml-fop/src/org/apache/fop/fo/pagination/Attic/FoPageSequenceMaster.java Index: FoPageSequenceMaster.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/Attic/FoPageSequenceMaster.java,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- FoPageSequenceMaster.java 6 Oct 2002 14:15:11 - 1.1.2.5 +++ FoPageSequenceMaster.java 9 Oct 2002 06:00:49 - 1.1.2.6 @@ -28,6 +28,7 @@ import org.apache.fop.datastructs.Tree; import org.apache.fop.datatypes.PropertyValue; import org.apache.fop.datatypes.NCName; +import org.apache.fop.xml.XMLEvent; /** * Implements the fo:page-sequence-master flow object. These Fos are @@ -41,6 +42,22 @@ private static final String tag = $Name$; private static final String revision = $Revision$; +/** + * An array with ttXMLEvent.UriLocalName/tt objects identifying + * ttsingle-page-master-reference/tt, + * ttrepeatable-page-master-reference/tt and + * ttrepeatable-page-master-alternatives/tt XML events. + */ +private static final XMLEvent.UriLocalName[] +singleOrRepeatableMasterRefs = { +new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, single-page-master-reference), +new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, repeatable-page-master-reference), +new XMLEvent.UriLocalName + (XMLNamespaces.XSLNSpaceIndex, repeatable-page-master-alternatives) +}; + private String masterName; private ArrayList subSequenceList = new ArrayList(1); @@ -59,19 +76,10 @@
cvs commit: xml-fop/src/org/apache/fop/fo/expr PropertyParser.java PropertyTokenizer.java
pbwest 2002/10/08 23:02:51 Modified:src/org/apache/fop/fo/expr Tag: FOP_0-20-0_Alt-Design PropertyParser.java PropertyTokenizer.java Log: Bug fixes and debugging output. Revision ChangesPath No revision No revision 1.5.2.13 +133 -44 xml-fop/src/org/apache/fop/fo/expr/PropertyParser.java Index: PropertyParser.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/expr/PropertyParser.java,v retrieving revision 1.5.2.12 retrieving revision 1.5.2.13 diff -u -r1.5.2.12 -r1.5.2.13 --- PropertyParser.java 2 Oct 2002 07:23:18 - 1.5.2.12 +++ PropertyParser.java 9 Oct 2002 06:02:51 - 1.5.2.13 @@ -237,6 +237,7 @@ */ private PropertyValue parseAdditiveExpr() throws PropertyException { // Evaluate and put result on the operand stack +System.out.println(parseAdd); PropertyValue prop = parseMultiplicativeExpr(); loop: for (; ; ) { @@ -261,24 +262,109 @@ * the resulting PropertyValue. */ private PropertyValue parseMultiplicativeExpr() throws PropertyException { +System.out.println(parseMult); PropertyValue prop = parseUnaryExpr(); -loop: +PropertyValue pv; +outer: +// Outer loop exists to handle a sequence of multiplicative operations +// e.g. 5 * 4 / 2 +// break outer; will terminate the multiplicative expression parsing +// break inner; will look for another trailing multiplicative +// operator. for (; ; ) { -switch (currentToken) { -case DIV: -next(); -((Numeric)prop).divide((Numeric)parseUnaryExpr()); -break; -case MOD: -next(); -((Numeric)prop).mod((Numeric)parseUnaryExpr()); -break; -case MULTIPLY: -next(); -((Numeric)prop).multiply((Numeric)parseUnaryExpr()); -break; +inner: +switch (prop.getType()) { +case PropertyValue.NUMERIC: +switch (currentToken) { +case DIV: +next(); +System.out.println(Dividing..); +pv = parseUnaryExpr(); +if (pv.getType() == PropertyValue.INTEGER) { +((Numeric)prop).divide +((double)(((IntegerType)pv).getInt())); +break inner; +} // else must be Numeric +((Numeric)prop).divide((Numeric)pv); +break inner; +case MOD: +next(); +pv = parseUnaryExpr(); +if (pv.getType() == PropertyValue.INTEGER) { +((Numeric)prop).mod +((double)(((IntegerType)pv).getInt())); +break inner; +} // else must be Numeric +((Numeric)prop).mod((Numeric)parseUnaryExpr()); +break inner; +case MULTIPLY: +next(); +System.out.println(Multiplying..); +pv = parseUnaryExpr(); +System.out.println(...by + pv); +if (pv.getType() == PropertyValue.INTEGER) { +((Numeric)prop).multiply +((double)(((IntegerType)pv).getInt())); +break inner; +} // else must be Numeric +((Numeric)prop).multiply((Numeric)pv); +break inner; +default: +break outer; +} +// N.B. The above case cannot fall through to here +case PropertyValue.INTEGER: +// This code treats all multiplicative operations as implicit +// operations on doubles. It might be reasonable to allow +// an integer multiply. +switch (currentToken) { +case DIV: +next(); +System.out.println(Dividing..); +pv = parseUnaryExpr(); +if (pv.getType() == PropertyValue.INTEGER) { +prop = new Numeric(property, +(double)(((IntegerType)prop).getInt()) / + ((IntegerType)pv).getInt()); +break inner; +
cvs commit: xml-fop/src/org/apache/fop/xml SyncedXmlEventsBuffer.java
pbwest 2002/10/08 23:07:04 Modified:src/org/apache/fop/xml Tag: FOP_0-20-0_Alt-Design SyncedXmlEventsBuffer.java Log: Added get/expectTypedEvent. Modified all other get/expect methods to use these. Added array arguments to multiple choice get/expectStartElement(). Revision ChangesPath No revision No revision 1.1.2.3 +429 -170 xml-fop/src/org/apache/fop/xml/Attic/SyncedXmlEventsBuffer.java Index: SyncedXmlEventsBuffer.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/xml/Attic/SyncedXmlEventsBuffer.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- SyncedXmlEventsBuffer.java3 Oct 2002 03:37:26 - 1.1.2.2 +++ SyncedXmlEventsBuffer.java9 Oct 2002 06:07:03 - 1.1.2.3 @@ -69,7 +69,7 @@ XMLEvent ev; try { ev = (XMLEvent)get(); -//System.out.println(getEvent: + ev); +System.out.println(getEvent: + ev); return ev; } catch (InterruptedException e) { throw new FOPException(e); @@ -77,68 +77,244 @@ } /** - * @return an ENDDOCUMENT event - * @exception FOPException if buffer errors or interrupts occur - * @exception NoSuchElementException if the event is not found + * Get the next event of the given type from the buffer. Discard + * intervening events. + * @param eventType - the ttint/tt event type. + * @return an event of the given type. + * @exception FOPException if buffer errors or interrupts occur. + * @exception NoSuchElementException if the event is not found. */ -public XMLEvent getEndDocument() throws FOPException { +public XMLEvent getTypedEvent(int eventType) throws FOPException { XMLEvent ev = getEvent(); -while (ev != null ev.type != XMLEvent.ENDDOCUMENT) { +while (ev != null ev.type != eventType) { ev = getEvent(); } if (ev == null) { -throw new NoSuchElementException(EndDocument not found.); +throw new NoSuchElementException +(XMLEvent.eventTypeName(eventType) + not found.); } return ev; } /** - * @return an ENDDOCUMENT event - * @exception FOPException if buffer errors or interrupts occur - * @exception NoSuchElementException if ENDDOCUMENT is not the next - * event detected. The erroneous event is pushed back. + * Get the next event of the given type and with the given ttQName/tt + * from the buffer. Discard intervening events. + * @param eventType - the ttint/tt event type. + * @param qName a ttString/tt with the ttQName/tt of the + * required element. + * @return an event of the given type. + * @exception FOPException if buffer errors or interrupts occur. + * @exception NoSuchElementException if the event is not found. */ -public XMLEvent expectEndDocument() throws FOPException { +public XMLEvent getTypedEvent(int eventType, String qName) +throws FOPException +{ +XMLEvent ev = getEvent(); +while (ev != null + ! (ev.type == eventType ev.qName.equals(qName))) { +ev = getEvent(); +} +if (ev == null) { +throw new NoSuchElementException +(XMLEvent.eventTypeName(eventType) + + qName + not found.); +} +return ev; +} + +/** + * Get the next event of the given type, and with the given URI index and + * local name, from the buffer. Discard intervening events. + * @param eventType - the ttint/tt event type. + * @param uriIndex - the ttint/tt URI index maintained in the + * ttXMLNamespaces/tt object. + * @param localName a ttString/tt with the local name of the + * required element. + * @return an event of the given type. + * @exception FOPException if buffer errors or interrupts occur. + * @exception NoSuchElementException if the event is not found. + */ +public XMLEvent getTypedEvent +(int eventType, int uriIndex, String localName) +throws FOPException +{ XMLEvent ev = getEvent(); -if (ev != null ev.type == XMLEvent.ENDDOCUMENT) { +while (ev != null + ! (ev.type == eventType + ev.type == eventType + ev.localName.equals(localName))) { +ev = getEvent(); +} +if (ev == null) +throw new NoSuchElementException +(XMLEvent.eventTypeName(eventType)
cvs commit: xml-fop/src/org/apache/fop/xml XMLEvent.java
pbwest 2002/10/08 23:08:37 Modified:src/org/apache/fop/xml Tag: FOP_0-20-0_Alt-Design XMLEvent.java Log: Added eventTypeName(). Revision ChangesPath No revision No revision 1.1.2.3 +26 -25xml-fop/src/org/apache/fop/xml/Attic/XMLEvent.java Index: XMLEvent.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/xml/Attic/XMLEvent.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- XMLEvent.java 16 Sep 2002 04:26:31 - 1.1.2.2 +++ XMLEvent.java 9 Oct 2002 06:08:37 - 1.1.2.3 @@ -34,6 +34,28 @@ private static final int MIN_XML_EV_TYPE = NOEVENT; private static final int MAX_XML_EV_TYPE = CHARACTERS; +public static final boolean DISCARD_W_SPACE = true; +public static final boolean RETAIN_W_SPACE = false; + +public static String eventTypeName(int type) { +switch (type) { +case NOEVENT: +return NOEVENT; +case STARTDOCUMENT: +return STARTDOCUMENT; +case ENDDOCUMENT: +return ENDDOCUMENT; +case STARTELEMENT: +return STARTELEMENT; +case ENDELEMENT: +return ENDELEMENT; +case CHARACTERS: +return CHARACTERS; +default: +return Unknown type + type; +} +} + // These are made public specifically so the the values of individual // XMLEvent instances can be changed directly, on the assumption that // the basic XML events are unlikely to change. @@ -171,28 +193,7 @@ public String toString() { String tstr; -switch (type) { -case NOEVENT: -tstr = NOEVENT; -break; -case STARTDOCUMENT: -tstr = STARTDOCUMENT; -break; -case ENDDOCUMENT: -tstr = ENDDOCUMENT; -break; -case STARTELEMENT: -tstr = STARTELEMENT; -break; -case ENDELEMENT: -tstr = ENDELEMENT; -break; -case CHARACTERS: -tstr = CHARACTERS; -break; -default: -tstr = Unknown type + type; -} +tstr = eventTypeName(type); tstr = tstr + \nURI + uriIndex + + namespaces.getIndexURI(uriIndex); tstr = tstr + \n + Local Name + localName; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: fonts
In the back of my mind I have a reminder that AWT has some strange behaviour in font handling making it difficult to produce high-quality text. Looking at org.apache.fop.render.awt.AWTFontMetrics there is a pointer to an AWT bug. There's other code in there that hints at deficiencies in AWT. And there are differences between JDK versions! Acknowledged. Being quite a bit of an incrementalist myself, the scope of the project that I am contemplating revolved around only the FontMetrics -- in other words, it would only replace the font metric information that we currently get from the generated XML files. Layout and rendering chores could be added later, iff they made sense. Are the problems you are seeing related to the metrics or to other issues? Obviously if the basic metrics we get out of AWT are bad, that would be a deal killer. I'm not a guru on this but the AWT font metrics are not that bad just not fully complete. Using our own FontMetrics abstraction means that we can adapt to other metric sources. That's what is in place and what I think can be built upon. So yes, the problems I see are related to font metrics. In addition to the JDK version, there is a JRE issue here as well that I neglected to mention. Since the createFont method doesn't exist until 1.3, wouldn't that be the minimum JRE that could be used to run FOP if we rely on that to get unregistered font information? I think so. This is another reason not to rely too heavily on AWT. Once we have the possibility to supply JDK-dependent code it will make it easier to provide the best functionality possible. - ...but will we be able to get at the physical font in order to embedd it in the target file? While quickly looking into the AWT API I haven't found anything approriate. And where will we configure that a particular font should be embedded? This is a good point. I don't see where java tells us how to get to the physical file either. However, we have to configure a path to the physical file now to embed the font, so we aren't really going backwards on this issue. Also, I see no problem with using the current scheme for configuring the embedding (i.e. if embed-file exists, use it, otherwise, don't embed). The trick will be, if we use the AWT, to teach the users how to make sure that the names match or map properly. We may need to build a qd tool to let the users see the fonts (and names) on their system that AWT can see. I agree. Maybe we can simplify the embedding business by just having a section in the configuration where you can supply a list of font names that should be embedded. That provides an opportunity to break away from having to register each single font though that should still be possible. I'd like to go as far as providing an extension so you could specify in the FO file that some particular font should be embedded (but that's for later). - Will we have enough information out of AWT to produce high-quality text? For example, you need accurate information for the placement of under/overlines and superscript stuff. If we are talking about metric info only, I think so, but I could be wrong. I hope so. :-) The AWT renderer already relies on this but I know there are noticable differencies between PDF and AWT output. The issue of producing the same output with different renderers has come up several times already. I'm talking mainly about font metrics at the moment. There are several areas to the whole discussion though: - font metrics (has an effect on the layout/appearance) - available fonts (different font types and sources, different quality of information) - font embedding (how do I get to the physical font and how do I transform it for the target format) - character encodings - speed and memory consumption issues (forgot anything?) So having said that and considering what has been said before I think relying on AWT for font handling cannot be the only answer. I'm still on the same track as before wanting a font manager for FOP that can handle multiple font sources. This means a good heap of work but will give us the necessary flexibility to cope with almost every situation. That doesn't mean we have to provide everything immediately. Incremental improvement will do just fine. You have convinced me. Here is what I propose: Hide both the current design and the AWT fonts behind a class that is used everywhere within FOP. If the AWT approach is flaky for any reason, we can always fall back on the current approach, but we can then experiment at will with AWT (at the metrics level). To make this work, we'll need to look in the configuration info for fonts before looking at AWT. This also means we don't need to do anything with createFont for the moment, which also makes the JRE issue go away. The downside is that we won't be able to mess with AWT for layout help (unless a similar approach is taken to hide the differences there).