Re: Font Metrics AWT
> At 05:15 PM 5/19/02, you wrote: > >There may be still an issue about the actual vertical > >position of an overline. > > Yes, I expect so; since java.awt.Font contains no specification > for where to put the underline (as I pointed out in my code comments.) > Unfortunately my word processor doesn't know about overlines, so I > can't even suggest a precedent. Have you seen the methods getStrikethroughOffset() and getUnderlineOffset() on LineMetrics? I've used the StrikethroughOffset but left in your method of determining the underline position. > btw: On my wp, the top of a superscript appears to lie 1 or 2 graphics > units above the uppercase ascender; I guess I'd try putting the overline > a hair above that. How would you express that in Java? getAscent() returns values that result overlines to be printed over the previous line's underline position. That's why I took "0.8 * getAscent()". > >And there are sporadic hiccups with the inline > >space text decorations which probably are a result of poor rounding. > >I haven't found out yet. > > I don't doubt that - you might notice several places in AwtRenderer > (marked aml/rlc) where we tweaked the integer arithmetic slightly > to avoid such hiccups. > > On the larger issue of printing, I've made no progress yet; am hoping > to get to it in a day or two; btw: I noticed that in another post Peter is > testing expectations for 0.20.4 -- at the very least, when that starts > getting real, it will light a fire under me re printing. ;-) > > Thanks for your help. You're welcome. Often too little time, but working on it... Cheers, Jeremias Märki mailto:[EMAIL PROTECTED] OUTLINE AG Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern Tel. +41 41 317 2020 - Fax +41 41 317 2029 Internet http://www.outline.ch - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Font Metrics AWT
At 05:15 PM 5/19/02, you wrote: >There may be still an issue about the actual vertical >position of an overline. Yes, I expect so; since java.awt.Font contains no specification for where to put the underline (as I pointed out in my code comments.) Unfortunately my word processor doesn't know about overlines, so I can't even suggest a precedent. btw: On my wp, the top of a superscript appears to lie 1 or 2 graphics units above the uppercase ascender; I guess I'd try putting the overline a hair above that. >And there are sporadic hiccups with the inline >space text decorations which probably are a result of poor rounding. >I haven't found out yet. I don't doubt that - you might notice several places in AwtRenderer (marked aml/rlc) where we tweaked the integer arithmetic slightly to avoid such hiccups. On the larger issue of printing, I've made no progress yet; am hoping to get to it in a day or two; btw: I noticed that in another post Peter is testing expectations for 0.20.4 -- at the very least, when that starts getting real, it will light a fire under me re printing. ;-) Thanks for your help. ' Best, -Ralph LaChance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Font Metrics AWT
At 05:18 PM 5/19/02, you wrote: >Oh my. I seem to have been too fast on this, maybe. Anyway, I'm going to >bed now. Well, in my opinion, the previous change ~should~ be committed as you did, since what we had was clearly not right. Whatever happens next to solve the new problem w/ printing should be applied separately. Thanks! ' Best, -Ralph LaChance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Font Metrics AWT
Oh my. I seem to have been too fast on this, maybe. Anyway, I'm going to bed now. Cheers, Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Font Metrics AWT
Done! While applying your patch I thought I'd also start working on overline and line-through support. I've added text decoration for inline spaces, too. There may be still an issue about the actual vertical position of an overline. And there are sporadic hiccups with the inline space text decorations which probably are a result of poor rounding. I haven't found out yet. Eager to hear your comments... The graphics variable is now protected. On 17.05.2002 14:08:15 Ralph LaChance wrote: > At 04:13 AM 5/17/02, you wrote: > >Can anyone make the 'graphic' variable protected, to enable sublasses to > >draw on it? > > Makes sense to me; since I'm not a committer, it doesn't make much > sense for me to make the change - perhaps whoever commits my new > version of AWTRenderer.renderWordArea() would make that change too. > > (Christian or Arved have handled my previous suggestions.) Cheers, Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Font Metrics AWT
Heads up: Unfortunately, the saga continues The change to AWTRenderer that I recently submitted does indeed fix problems with -awt but as a side effect, it introduces new problems with printing. For example, if you render a page via -awt (with the changed code) the rendition looks fine; then, if you print it directly from the -awt dialog (via menubar) you get some words overlapping one another on a given line. You get the same overlapping by going directly to the printer via -print. Just to keep it fun: not all fonts, nor all sizes fail. I suspect the results may differ by platform and printer too ! I am researching the bug parade and java groups like crazy to find a way through this -- So far, I've learned there ~is~ a known inconsistency (apparently since jdk 1.3.0) between the jre's use of screen fonts vs printer fonts. One Sun bug evaluator mentions that Swing's caching of fonts is also a contributor. This affects fop because we does our printing via a subclass of the awt renderer. The simplest way to explain what is happening is this: draw a string into a graphics2D that will be printed then draw a rectangle using the rectangle returned by .getVisibleBounds In many cases the bounding rectangle does not match the drawn text. The bounding rectangle is usually shorter than the drawn text - - the end result in fop, is that words overlap. The mismatch is a function of font -- and even worse -- also seems to depend on recent font usage (jre caching?) btw: In my testing, the actual bounding rectangle returned by getVisibleBounds() seems to match the internal spacings derived in and used by the fop layout engine - so this appears to be an actual printing problem, not a metrics problem. -ralph At 04:13 AM 5/17/02, you wrote: > >Hi all > >Great work Ralph. >The results looks very good and I hope the next release contains your fix. > >I've and additional wish for the AWTRenderer. >Can anyone make the 'graphic' variable protected, to enable sublasses to >draw on it? >In my case I have to divide between final print and test print (crisscross >the page and draw a test string on it). At this time I have to do it twice >(without patching original sources). Firtsly at renderPage(Page) where I >create my own Graphics2D instance after super.renderPage(Page) has finished >and secondly on print with the passed in Graphics2D parameter. >I think programmer who subclass the original know that they have to work >with the graphics variable careful and are responsible for their own >mistakes. Therefore I don't see a reason to hold the instance restrictively >with private access. > >ThanX a lot (especially to ralph for the fix) >cu Torsten > > > -Original Message- > > From: Ralph LaChance [mailto:[EMAIL PROTECTED]] > > Sent: Donnerstag, 16. Mai 2002 17:05 > > To: [EMAIL PROTECTED] > > Subject: RE: Font Metrics AWT > > > > > > I have found the problem and worked out its repair. > > The modified code is attached below. > > > > The problem stems from a bug in java's handling of drawing of > > AttributedStrings when a font attribute is specified. Bug parade > > #4650042 describes a similar problem unique to jdk 1.4, but > > makes also suggests that there are other more general problems > > w/ fonts and AttributedStrings. > > > > In our case, calling > > drawString (string) instead of > > drawString (AttributedString...) solves the problem. > > > > The fix simply draws the text using the string version of > > drawString and then to draw the underline (if defined) > > separately. > > > > I have tested it on jre 1.3.0, jre 1.3.0_02 and jre/jdk 1.4.0 - > > all on WinNT4/sp5 > > > > attached is the changed code -- it only affects one method > > in AWTRenderer. > > > > Will someone commit it ? > > > > >x--snip >... >x--snap > > > > > > ' Best, > > -Ralph LaChance > > > > > > >- >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: Font Metrics AWT
At 04:13 AM 5/17/02, you wrote: >Can anyone make the 'graphic' variable protected, to enable sublasses to >draw on it? Makes sense to me; since I'm not a committer, it doesn't make much sense for me to make the change - perhaps whoever commits my new version of AWTRenderer.renderWordArea() would make that change too. (Christian or Arved have handled my previous suggestions.) ' Best, -Ralph LaChance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Font Metrics AWT
Hi all Great work Ralph. The results looks very good and I hope the next release contains your fix. I've and additional wish for the AWTRenderer. Can anyone make the 'graphic' variable protected, to enable sublasses to draw on it? In my case I have to divide between final print and test print (crisscross the page and draw a test string on it). At this time I have to do it twice (without patching original sources). Firtsly at renderPage(Page) where I create my own Graphics2D instance after super.renderPage(Page) has finished and secondly on print with the passed in Graphics2D parameter. I think programmer who subclass the original know that they have to work with the graphics variable careful and are responsible for their own mistakes. Therefore I don't see a reason to hold the instance restrictively with private access. ThanX a lot (especially to ralph for the fix) cu Torsten > -Original Message- > From: Ralph LaChance [mailto:[EMAIL PROTECTED]] > Sent: Donnerstag, 16. Mai 2002 17:05 > To: [EMAIL PROTECTED] > Subject: RE: Font Metrics AWT > > > I have found the problem and worked out its repair. > The modified code is attached below. > > The problem stems from a bug in java's handling of drawing of > AttributedStrings when a font attribute is specified. Bug parade > #4650042 describes a similar problem unique to jdk 1.4, but > makes also suggests that there are other more general problems > w/ fonts and AttributedStrings. > > In our case, calling > drawString (string) instead of > drawString (AttributedString...) solves the problem. > > The fix simply draws the text using the string version of > drawString and then to draw the underline (if defined) > separately. > > I have tested it on jre 1.3.0, jre 1.3.0_02 and jre/jdk 1.4.0 - > all on WinNT4/sp5 > > attached is the changed code -- it only affects one method > in AWTRenderer. > > Will someone commit it ? > > x--snip ... x--snap > > > ' Best, > -Ralph LaChance > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Font Metrics AWT
I have found the problem and worked out its repair. The modified code is attached below. The problem stems from a bug in java's handling of drawing of AttributedStrings when a font attribute is specified. Bug parade #4650042 describes a similar problem unique to jdk 1.4, but makes also suggests that there are other more general problems w/ fonts and AttributedStrings. In our case, calling drawString (string) instead of drawString (AttributedString...) solves the problem. The fix simply draws the text using the string version of drawString and then to draw the underline (if defined) separately. I have tested it on jre 1.3.0, jre 1.3.0_02 and jre/jdk 1.4.0 - all on WinNT4/sp5 attached is the changed code -- it only affects one method in AWTRenderer. Will someone commit it ? At 09:12 AM 5/10/02, you wrote: > >Hi all! > >Now I've downloaded the sdk version 1.3.1_03 from sun but the result is the >same like before. >I've attached a screenshot to this mail. >My workflow: >I go to the Driver, set the Logger and my Renderer(extended from >AWTRenderer), and call render(XMLReader,InputSource) on the Driver, >After that I go to my Renderer and render each page in a loop and add the >result within a JLabel to a JPanel, which is showing for the User. > >code piece: > >driver.render( parser, inputHandler.getInputSource() ); > >for (int i = 0; i < renderer.getNumberOfPages(); i++) >{ > renderer.render(i); > > JLabel label = new JLabel( new ImageIcon( >renderer.getLastRenderedPage() ) ); > > panel.add( label, new GridBagConstraints(0, i, 1, 1, 0.0, 0.0 > ,GridBagConstraints.WEST, GridBagConstraints.NONE, new > Insets(6, 6, 6, >6), 0, 0)); >} > >the result is below > >Can anyone help me or tell me my mistake? > >ThanX Torsten > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, email: [EMAIL PROTECTED] ' Best, -Ralph LaChance AWTRenderer.renderWordArea.zip Description: Zip archive - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Font Metrics AWT
I'm using fop v0.20.3, on WINNT 4.0 SP6, java v1.3.1 (required for the project -> 1.4 not possible at this time) Here are the results from command line awt rendering for java 1.3.1 and java 1.4 (looks better) cu Torsten (ThanX for replies) -Original Message- From: Ralph LaChance [mailto:[EMAIL PROTECTED]] Sent: Samstag, 11. Mai 2002 04:22 To: [EMAIL PROTECTED] Subject: RE: Font Metrics AWT Trying to place your results on a JLabel rings a bell but I can't recall why Could you try running the vanilla command-line fop -awt and see if you get better results ? something like java -cp org.apache.fop.apps.Fop -xsl -xml -awt Also, please give you fop version , os ? , the usual stuff (hmmm, perhaps I'm showing my age in more ways than one; I cannot recall if the current maintenance branch still has a command-line invocation. Our production usage is based on fop 0.20.1) ' Best, -Ralph LaChance awt_java1.4.gif Description: GIF image awt_java1.3.1.gif Description: GIF image - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Font Metrics AWT
Trying to place your results on a JLabel rings a bell but I can't recall why Could you try running the vanilla command-line fop -awt and see if you get better results ? something like java -cp org.apache.fop.apps.Fop -xsl -xml -awt Also, please give you fop version , os ? , the usual stuff (hmmm, perhaps I'm showing my age in more ways than one; I cannot recall if the current maintenance branch still has a command-line invocation. Our production usage is based on fop 0.20.1) At 09:12 AM 5/10/02, you wrote: > >Hi all! > >Now I've downloaded the sdk version 1.3.1_03 from sun but the result is the >same like before. >I've attached a screenshot to this mail. >My workflow: >I go to the Driver, set the Logger and my Renderer(extended from >AWTRenderer), and call render(XMLReader,InputSource) on the Driver, >After that I go to my Renderer and render each page in a loop and add the >result within a JLabel to a JPanel, which is showing for the User. > >code piece: > >driver.render( parser, inputHandler.getInputSource() ); > >for (int i = 0; i < renderer.getNumberOfPages(); i++) >{ > renderer.render(i); > > JLabel label = new JLabel( new ImageIcon( >renderer.getLastRenderedPage() ) ); > > panel.add( label, new GridBagConstraints(0, i, 1, 1, 0.0, 0.0 > ,GridBagConstraints.WEST, GridBagConstraints.NONE, new > Insets(6, 6, 6, >6), 0, 0)); >} > >the result is below > >Can anyone help me or tell me my mistake? > >ThanX Torsten > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, email: [EMAIL PROTECTED] ' Best, -Ralph LaChance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Font Metrics AWT
Yes, Our fonts also look badly spaced. It would be very nice to get this fixed. I have looked over the code but could not see anything wrong. Under JDK 1.4 there is a big improvement. But still, the most obvious error's are the spacing between words. Should I submit a test case .fo file? Big reward to anyone who fixes this!! :) At 03:12 PM 5/10/2002 +0200, you wrote: >Hi all! > >Now I've downloaded the sdk version 1.3.1_03 from sun but the result is the >same like before. >I've attached a screenshot to this mail. >My workflow: >I go to the Driver, set the Logger and my Renderer(extended from >AWTRenderer), and call render(XMLReader,InputSource) on the Driver, >After that I go to my Renderer and render each page in a loop and add the >result within a JLabel to a JPanel, which is showing for the User. > >code piece: > >driver.render( parser, inputHandler.getInputSource() ); > >for (int i = 0; i < renderer.getNumberOfPages(); i++) >{ > renderer.render(i); > > JLabel label = new JLabel( new ImageIcon( >renderer.getLastRenderedPage() ) ); > > panel.add( label, new GridBagConstraints(0, i, 1, 1, 0.0, 0.0 > ,GridBagConstraints.WEST, GridBagConstraints.NONE, new > Insets(6, 6, 6, >6), 0, 0)); >} > >the result is below > >Can anyone help me or tell me my mistake? > >ThanX Torsten > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, email: [EMAIL PROTECTED] _ Christopher Burkey[EMAIL PROTECTED] President513-542-3401 eInnovation Inc. http://einnovation.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Font Metrics AWT
Hi all! Now I've downloaded the sdk version 1.3.1_03 from sun but the result is the same like before. I've attached a screenshot to this mail. My workflow: I go to the Driver, set the Logger and my Renderer(extended from AWTRenderer), and call render(XMLReader,InputSource) on the Driver, After that I go to my Renderer and render each page in a loop and add the result within a JLabel to a JPanel, which is showing for the User. code piece: driver.render( parser, inputHandler.getInputSource() ); for (int i = 0; i < renderer.getNumberOfPages(); i++) { renderer.render(i); JLabel label = new JLabel( new ImageIcon( renderer.getLastRenderedPage() ) ); panel.add( label, new GridBagConstraints(0, i, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 6, 6), 0, 0)); } the result is below Can anyone help me or tell me my mistake? ThanX Torsten rendered_contract.gif Description: GIF image - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]