[ 
https://issues.apache.org/jira/browse/PIVOT-697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13022005#comment-13022005
 ] 

Taro App commented on PIVOT-697:
--------------------------------

Here are some more findings:

On Windows note PC (default LCD anti-alias mode,) Java renders English text 
anti-aliased, but renders Japanese text anti-aliased only when the font size is 
larger than 20pt (http://itpro.nikkeibp.co.jp/article/COLUMN/20070205/260649/), 
however, if non-rectangle clipping is applied, small Japanese font is also 
anti-aliased somehow. I confirmed this with a simple test case without Pivot. 
If default anti-alias is set to off with awt.useSystemAAFontSettings system 
property, text is not anti-aliased even with non-rectangle clipping. I wonder 
if this behavior is expected or a bug in Java2D, but it is consistent as I 
tested with WindowsXP / JDK1.6.0_18 and Windows7 / JDK1.6.0_24.

So this issue is not a bug in Pivot, but there's no workaround for Pivot users 
on Windows except to turn off anti-alias completely. For Pivot to workaround 
this issue, just have to add two lines of code to make clipping areas 
rectangular:

org.apache.pivot.wtk.skin.TextAreaSkinParagraphView.java
----------------------------------------
public void paint(Graphics2D graphics) {
...
// Determine the selected and unselected areas
Area selection = textAreaSkin.getSelection();
Area selectedArea = 
selection.createTransformedArea(AffineTransform.getTranslateInstance(-x, -y));
selectedArea.intersect(new Area(new Rectangle2D.Float(0, 0, width, height))); 
// workaround for PIVOT-697
Area unselectedArea = new Area();
unselectedArea.add(new Area(new Rectangle2D.Float(0, 0, width, height)));
unselectedArea.subtract(new Area(selectedArea));
unselectedArea.intersect(new Area(new Rectangle2D.Float(0, 0, width, height))); 
// workaround for PIVOT-697
...
}
----------------------------------------

Can you add this workaround code to Pivot?


> Font looks different when text is selected across multiple lines in TextArea
> ----------------------------------------------------------------------------
>
>                 Key: PIVOT-697
>                 URL: https://issues.apache.org/jira/browse/PIVOT-697
>             Project: Pivot
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Windows XP SP3, JDK 1.6.0_18, Japanese
>            Reporter: Taro App
>            Priority: Minor
>             Fix For: 2.0.1
>
>         Attachments: NotePadComparison-MultipleLineSelectEnglish.png, 
> NotePadComparison-MultipleLineSelectJapanese.png, 
> Test1.SingleLineSelectEnglish.png, Test2.MultipleLineSelectEnglish.png, 
> Test3.SingleLineSelectJapanese.png, Test4.MultipleLineSelectJapanese.png, 
> TextAreaFontTestEnglish.java, TextAreaFontTestJapanese.java
>
>
> Font looks different when text is selected across multiple lines in TextArea.
> When the selection is within a single line, font looks the same.
> For English text, this font change is subtle and can be ignored.
> For Japanese text, this font change is obvious and looks weird.
> I'm not sure if this is platform dependent or font dependent.
> May have something to do with how Java2D renders fonts.
> I will attach screen shots and test codes.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to