Re: Test case for PDFDocumentGraphics2D rotated text problem
Thanks for the test. I'm really not sure how to fix this. I can make it so that the text is almost in the right position except it is flipped on the horizontal axis (so you'll have to stand on your head to read it:) I think the solution is a bit ugly due to the different coordinate systems. THe font problem is either a problem with FOPs font setup (possibly a version thing) or something to do with the acrobat viewer. It has no problem with Acrobat 5. On Wed, 15 Aug 2001 02:01:38 Randall Parker wrote: This is a test case to demonstrate problems with how PDFDocumentGraphics2D renders text that is rotated. The text at 90 and 270 degrees is flipped around in pdfasshapes.pdf as compared to how it is in svgtest.svg and pdfnotshapes.pdf. Also, the text at the angles that start at 45 degrees and then increment at 90 degree intervals does not show up in the pdfnotshapes.pdf and Acrobat complains when it loads the file about not finding a font. The font can be changed in the initFonts() method. See the attached file TestCase1.java. It generates an SVG and two PDF files from the same set of calls to the Graphics2D APIs. I am running FOP and Batik as downloaded last Wednesday Aug 8 2001. I'm also using Jaxp 1.1.1, Crimson 1.1.1, and Xalan 2.2.D8. Also, building and running on JBuilder 5 Pro. Viewing SVG with the Batik SVG Browser and viewing PDF with full Acrobat 4.0. BTW, Acrobat holds a lock on a file it is showing. So you have to close the file in Acrobat to write out a new version of the PDF. The SVG Browser doesn't hold a lock on the file and it has a handy button to click to reload it. The paths to which the output get written are embedded in the file. Edit these lines to change them: String SvgOutputFileName = new String(\\tmp\\svgtest.svg); String PdfTextAsShapesFileName = new String(\\tmp\\pdfasshapes.pdf); String PdfTextNotShapesFileName = new String(\\tmp\\pdfnotshapes.pdf); If anyone wants the 3 output files I can send them. I didn't want to clog up the list with too many attachments. - 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: How to monitor fop-dev without overloading my mailbox?
--- Ian Larner [EMAIL PROTECTED] wrote: Is there a way to monitor the fop-dev exchanges without receiving loads of emails? I'm thinking of some form of newsgroup subscription where I can scan the fop-dev list, and contribute, separate from my mail account(?) I think there is a need for a batched fop-dev email subscription so that you get one message a day with loads of messages inside it. I haven't seen the method for doing this with this list though. If there is a way then perhaps that will help... Of course you could possibly just look at the web archives each day... Alex = Alex McLintock[EMAIL PROTECTED]Open Source Consultancy in London OpenWeb Analysts Ltd, http://www.OWAL.co.uk/ SF and Computing Book News and Reviews: http://news.diversebooks.com/ Get Your XML T-Shirt t-shirt/ at http://www.inversity.co.uk/ Do You Yahoo!? Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk or your free @yahoo.ie address at http://mail.yahoo.ie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Aligning text left and right on same line
Hello list! A question was raised recently, but I didn't see the answer, so I will ask it again: Is it possible in FOP to have a line with text aligned both left and right, for example by using fo:block fo:inline text-align=startText 1/fo:inline fo:inline text-align=endText 2/fo:inline /fo:block If yes, how? The above example is taken (and edited slightly) from the XML Bible, 2nd edition, chapter 18 that is freely available here: http://www.ibiblio.org/xml/books/bible2/chapters/ch18.html Thanks in advance Thomas Kæregaard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/svg PDFGraphics2D.java PDFTextPainter.java
keiron 01/08/15 03:33:35 Modified:src/org/apache/fop/svg PDFGraphics2D.java PDFTextPainter.java Log: added support for embedded fonts for svg text, also added proper escaping Revision ChangesPath 1.15 +136 -20 xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java Index: PDFGraphics2D.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- PDFGraphics2D.java2001/08/14 14:50:30 1.14 +++ PDFGraphics2D.java2001/08/15 10:33:34 1.15 @@ -1,5 +1,5 @@ /* - * $Id: PDFGraphics2D.java,v 1.14 2001/08/14 14:50:30 keiron Exp $ + * $Id: PDFGraphics2D.java,v 1.15 2001/08/15 10:33:34 keiron Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -13,6 +13,8 @@ import org.apache.fop.render.pdf.*; import org.apache.fop.image.*; import org.apache.fop.datatypes.ColorSpace; +import org.apache.fop.render.pdf.CIDFont; +import org.apache.fop.render.pdf.fonts.LazyFont; import org.apache.batik.ext.awt.g2d.*; import org.apache.batik.ext.awt.image.GraphicsUtil; @@ -30,6 +32,7 @@ import java.util.Map; import java.util.Vector; +import java.util.Hashtable; /** * This concrete implementation of ttAbstractGraphics2D/tt is a @@ -40,7 +43,7 @@ * implementing a ttGraphic2D/tt piece-meal. * * @author a href=mailto:[EMAIL PROTECTED];Keiron Liddle/a - * @version $Id: PDFGraphics2D.java,v 1.14 2001/08/14 14:50:30 keiron Exp $ + * @version $Id: PDFGraphics2D.java,v 1.15 2001/08/15 10:33:34 keiron Exp $ * @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D */ public class PDFGraphics2D extends AbstractGraphics2D { @@ -57,6 +60,7 @@ PDFAnnotList currentAnnotList = null; protected FontState fontState; +protected FontState ovFontState = null; /** * the current stream to add PDF commands to @@ -116,6 +120,10 @@ gc = c; } +public void setOverrideFontState(FontState infont) { +ovFontState = infont; +} + /** * This constructor supports the create method */ @@ -787,25 +795,30 @@ currentStream.write(BT\n); -Font gFont = getFont(); -String name = gFont.getName(); -if (name.equals(sanserif)) { -name = sans-serif; -} -int size = gFont.getSize(); -String style = gFont.isItalic() ? italic : normal; -String weight = gFont.isBold() ? bold : normal; -try { -fontState = new FontState(fontState.getFontInfo(), name, style, - weight, size * 1000, 0); -} catch (org.apache.fop.apps.FOPException fope) { -fope.printStackTrace(); +if(ovFontState == null) { +Font gFont = getFont(); +String n = gFont.getFamily(); +if (n.equals(sanserif)) { +n = sans-serif; +} +int siz = gFont.getSize(); +String style = gFont.isItalic() ? italic : normal; +String weight = gFont.isBold() ? bold : normal; +try { +fontState = new FontState(fontState.getFontInfo(), n, style, + weight, siz * 1000, 0); +} catch (org.apache.fop.apps.FOPException fope) { +fope.printStackTrace(); +} +} else { +fontState = ovFontState; +ovFontState = null; } +String name; +int size; name = fontState.getFontName(); size = fontState.getFontSize() / 1000; -// System.out.println(ffn: + gFont.getFontName() + fn: + gFont.getName() + ff: + gFont.getFamily() + fs: + fontState.getFontName()); - if ((!name.equals(this.currentFontName)) || (size != this.currentFontSize)) { this.currentFontName = name; @@ -813,6 +826,31 @@ currentStream.write(/ + name + + size + Tf\n); } + +Hashtable kerning = null; +boolean kerningAvailable = false; + +kerning = fontState.getKerning(); +if (kerning != null !kerning.isEmpty()) { +kerningAvailable = true; +} + +// This assumes that *all* CIDFonts use a /ToUnicode mapping +boolean useMultiByte = false; +org.apache.fop.render.pdf.Font f = + (org.apache.fop.render.pdf.Font)fontState.getFontInfo().getFonts().get(name); +if (f instanceof LazyFont){ +
Problem with the background-image
Hi everybody, this is my first time to do something with FOP and now I have a Problem with the background-image I don't know why; I hope someone can help me to provide what I want to do. This is what I want to do: I want to use a GIF or another graphic file like the background my page but when I use the property background-image=uri then I get this Warning : porperty 'background-image' ignored. yet I don't know how I can loose this Problem ( because I want .gif file like my background) please help me Thanks.. Serge... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Rendering to a printer
You can try something like: fo:block font-size=8pt color=black text-align=start fo:inline font-weight=boldHELLO/fo:inline THERE!!! /fo:block -Lou Spectron Caribe, Inc. [EMAIL PROTECTED] on 08/15/2001 10:44:14 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re: Rendering to a printer Forget it, I wasn't looking hard enough. But I have another question. If I understand correctly a block is a paragraph and I cant have different styles in a paragraph. I cant have a paragraph in 'Helvetica plain' and have a word in 'Helvetica bold size 20' like in HTML. If I'm wrong please correct me and tel me how to do it. Faw - Original Message - From: Spectron Caribe, Inc. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 14, 2001 10:09 AM Subject: Rendering to a printer Hello: I have made a simple function to test fop: void print(String file){ try{ Driver driver = new Driver(); driver.setInputSource(new InputSource(file)); driver.setRenderer(Driver.RENDER_PDF); driver.run(); }catch(Exception e){ e.printStackTrace(System.out); } } It works but I would like to render to the printer (RENDER_PRINT), but I haven't seen any samples for this anywhere. Could somebody show me how to do this? Faw - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - 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: Test case for PDFDocumentGraphics2D rotated text problem
On Wed, 15 Aug 2001 09:20:00 +0200, Keiron Liddle wrote: Thanks for the test. I'm really not sure how to fix this. I can make it so that the text is almost in the right position except it is flipped on the horizontal axis (so you'll have to stand on your head to read it:) Keiron, In my real app the text messages that are running vertically (ie the ones that are at 12 o'clock and 6 o'clock) actually get drawn at 3 o'clock and 9 o'clock. The idea is to put labels on either side of a pie chart or other type of chart. I think the solution is a bit ugly due to the different coordinate systems. I need to apply the transform in order to tell the Graphics2D object to draw the text running vertically. THe font problem is either a problem with FOPs font setup (possibly a version thing) or something to do with the acrobat viewer. It has no problem with Acrobat 5. So then Acrobat can draw the text at 45, 135, 225 and 315 degrees? (ie 1:30, 4:30, 7:30, 10:30) I don't see any text at those positions in the textAsShapes=false version. I will try a later version of FOP and Batik. I'll get the latest stuff from CVS and try it again today. Also, I have Acrobat 4.05 coming as an update but Adobe says it will take 4-6 weeks to get it. I guess I could go get the Acrobat Reader plug-in for v5 and try that. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Test case for PDFDocumentGraphics2D rotated text problem
Randall, On Wed, 15 Aug 2001 17:51:56 Randall Parker wrote: So then Acrobat can draw the text at 45, 135, 225 and 315 degrees? (ie 1:30, 4:30, 7:30, 10:30) I don't see any text at those positions in the textAsShapes=false version. No, I was talking about the font problem, not the position problem. On Wed, 15 Aug 2001 21:53:07 Randall Parker wrote: If your problem is that you don't know which direction is up for the top and which direction is forward (ie to the figurative right) for the text then perhaps a little heuristic can be employed. You could add something to the x and y and transform that and find out in which direction in transformed space the new points show up at. The problem is, unfortunately, more complicated than that. The coordinates for pdf have - (0,0) bottom left, (width,0) bottom right, (0,height) top left svg have - (0,0) top left, (width,0) top right, (0,height) bottom left This is fine for most things, there is a transform that converts between these two coordinates and it works for line drawing. Images are outside this transform but can easily be transformed when the image is place. Text on the other hand does something else entirely. If I just apply the current transform (as is done for lines) then it puts the text in the correct position except if has been flipped along the basline of the text. If I try to apply an appropriate transform (only one can be used for text) then it puts normal horizontal text in the right place but as you have seen other text goes to various other places. The problem is we have two different transforms (coordinate and text) that interact in some unknown way (at least I don't know it, maybe someone else can figure it out). I may be able to solve the problem by putting hte right transform with the right type of transform in the right place. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]