[piccolo2d-dev] Re: Issue 117 in piccolo2d: Text rendering in PText and JLabel via PSwing appear not to respect antialiasing rendering hints

2011-03-07 Thread piccolo2d


Comment #7 on issue 117 by heue...@gmail.com: Text rendering in PText and  
JLabel via PSwing appear not to respect antialiasing rendering hints

http://code.google.com/p/piccolo2d/issues/detail?id=117

Further analysis:

Swing text rendering is dependent on operating system and installed Look  
and Feel.  See jlabel-*, pswing-*, jtextcomponent-*, and phtmlview-* in the  
text rendering benchmark.


Java2D text rendering using Graphics2D.drawSwing respects LCD_* text  
rendering hints of the current graphics context on all platforms.  See  
java2d-* in the text rendering benchmark.


PText text rendering using java.awt.font.TextLayout.draw() ignores any text  
rendering hints specified in the current graphics context.  See ptext-* in  
the text rendering benchmark.


TextLayout receives its text rendering hints from  
PPaintContext.RENDER_QUALITY_HIGH_FRC passed to a  
java.awt.font.LineBreakMeasurer ctr.


http://code.google.com/p/piccolo2d/source/browse/piccolo2d.java/trunk/core/src/main/java/org/piccolo2d/nodes/PText.java#436

RENDER_QUALITY_HIGH_FRC is currently implemented as new  
FontRenderContext(null, true, true)


http://code.google.com/p/piccolo2d/source/browse/piccolo2d.java/trunk/core/src/main/java/org/piccolo2d/util/PPaintContext.java#63

http://download.java.net/jdk7/docs/api/java/awt/font/FontRenderContext.html#FontRenderContext(java.awt.geom.AffineTransform,%20boolean,%20boolean)

It is not possible to modify the text rendering hints supplied to  
TextLayout or LineBreakMeasurer after they have been constructed.


The javadoc for FontRenderContext reads

Typically, instances of FontRenderContext are obtained from a Graphics2D  
object. A FontRenderContext which is directly constructed will most likely  
not represent any actual graphics device, and may lead to unexpected or  
incorrect results.


Incorrect results such as the poorly anti-aliased text shown in the text  
rendering benchmark.



Looking forward, I see a few options

1) Attempt to instantiate a "better" FontRenderContext for  
PPaintContext.RENDER_QUALITY_HIGH_FRC.


2) Re-implement PText to create a new instance of TextLayout with the  
current text rendering hints from the graphics context every time  
PText.paintText is called.


3) Re-implement PText to use the instance of TextLayout created with  
PPaintContext.RENDER_QUALITY_HIGH_FRC only for layout purposes and render  
the text in PText.paintText with Graphics2D.drawString.


4) Re-implement PText with the same pattern as PHtmlView, delegating text  
rendering to a JLabel.



There are pros and cons to each, thought I should post this analysis and  
await comment before proceeding.


--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en


[piccolo2d-dev] Re: Issue 117 in piccolo2d: Text rendering in PText and JLabel via PSwing appear not to respect antialiasing rendering hints

2011-03-02 Thread piccolo2d


Comment #6 on issue 117 by heue...@gmail.com: Text rendering in PText and  
JLabel via PSwing appear not to respect antialiasing rendering hints

http://code.google.com/p/piccolo2d/issues/detail?id=117

Attaching current version of text-rendering-benchmark runnable jar, built  
with Piccolo2D svn trunk.


Attachments:
text-rendering-benchmark.jar  310 KB

--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en


[piccolo2d-dev] Re: Issue 117 in piccolo2d: Text rendering in PText and JLabel via PSwing appear not to respect antialiasing rendering hints

2010-08-23 Thread piccolo2d


Comment #5 on issue 117 by heue...@gmail.com: Text rendering in PText and  
JLabel via PSwing appear not to respect antialiasing rendering hints

http://code.google.com/p/piccolo2d/issues/detail?id=117

This is my most frustrating Piccolo2D issue.  Can anyone else take a look  
at it?


--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en


[piccolo2d-dev] Re: Issue 117 in piccolo2d: Text rendering in PText and JLabel via PSwing appear not to respect antialiasing rendering hints

2010-04-09 Thread piccolo2d


Comment #4 on issue 117 by heue...@gmail.com: Text rendering in PText and  
JLabel via PSwing appear not to respect antialiasing rendering hints

http://code.google.com/p/piccolo2d/issues/detail?id=117

Source code is in svn at

http://dishevelled.svn.sourceforge.net/svnroot/dishevelled/trunk/text-rendering-benchmark/

http://dishevelled.svn.sourceforge.net/viewvc/dishevelled/trunk/text-rendering-benchmark/

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en

To unsubscribe, reply using "remove me" as the subject.