[ 
https://issues.apache.org/jira/browse/PDFBOX-2302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Hewson updated PDFBOX-2302:
--------------------------------

    Description: 
PageDrawer doesn't make effective use of Java 2D's RenderingHints. The 
situation now is a little odd due to code having been moved around and copied 
and pasted. Most of the time we're not making use of higher quality renderings 
which are available to us.

Some examples of strangeness:

- drawTilingPattern sets VALUE_FRACTIONALMETRICS_ON, yet this applies only to 
AWT fonts (!)

- drawGlyph2D sets VALUE_ANTIALIAS_ON but strokePath and fillPath set it to 
VALUE_ANTIALIAS_OFF

- drawBufferedImage sets KEY_INTERPOLATION to 
VALUE_INTERPOLATION_NEAREST_NEIGHBOR which is the lowest quality image scaling 
method

- shadingFill sets VALUE_ANTIALIAS_OFF (but that might make more sense because 
we're Paint-ing these ourselves, OTOH if the canvas is buffered already for 
anti-aliasing do we save anything by disabling it?)

- drawPage sets VALUE_ANTIALIAS_ON but this is always overridden by the various 
drawing methods

Currently we're missing out on anti-aliasing for paths (other than glyphs) and 
we're getting low-quality resizing of images, which makes Type 3 fonts look 
particularly ugly. Setting the appropriate rendering hints would improve this 
greatly.

  was:
PageDrawer doesn't make effective use of Java 2D's RenderingHints. The 
situation now is a little odd due to code having been moved around and copied 
and pasted. Most of the time we're not making use of higher quality renderings 
which are available to us.

Some examples of strangeness:

- drawTilingPattern sets VALUE_FRACTIONALMETRICS_ON, yet this applies only to 
AWT fonts!?

- drawGlyph2D sets VALUE_ANTIALIAS_ON but strokePath and fillPath set it too 
VALUE_ANTIALIAS_OFF

- drawBufferedImage sets KEY_INTERPOLATION to 
VALUE_INTERPOLATION_NEAREST_NEIGHBOR which is the lowest quality image scaling 
method

- shadingFill sets VALUE_ANTIALIAS_OFF (but that might make more sense because 
we're Paint-ing these ourselves, OTOH if the canvas is buffered already for 
anti-aliasing do we save anything by disabling it?)

- drawPage sets VALUE_ANTIALIAS_ON but this is always overridden by the various 
drawing methods

Currently we're missing out on anti-aliasing for paths (other than glyphs) and 
we're getting low-quality resizing of images, which makes Type 3 fonts look 
particularly ugly. Setting the appropriate rendering hints would improve this 
greatly.


> Make better use of RenderingHints
> ---------------------------------
>
>                 Key: PDFBOX-2302
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2302
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Rendering
>    Affects Versions: 2.0.0
>            Reporter: John Hewson
>            Assignee: John Hewson
>            Priority: Minor
>
> PageDrawer doesn't make effective use of Java 2D's RenderingHints. The 
> situation now is a little odd due to code having been moved around and copied 
> and pasted. Most of the time we're not making use of higher quality 
> renderings which are available to us.
> Some examples of strangeness:
> - drawTilingPattern sets VALUE_FRACTIONALMETRICS_ON, yet this applies only to 
> AWT fonts (!)
> - drawGlyph2D sets VALUE_ANTIALIAS_ON but strokePath and fillPath set it to 
> VALUE_ANTIALIAS_OFF
> - drawBufferedImage sets KEY_INTERPOLATION to 
> VALUE_INTERPOLATION_NEAREST_NEIGHBOR which is the lowest quality image 
> scaling method
> - shadingFill sets VALUE_ANTIALIAS_OFF (but that might make more sense 
> because we're Paint-ing these ourselves, OTOH if the canvas is buffered 
> already for anti-aliasing do we save anything by disabling it?)
> - drawPage sets VALUE_ANTIALIAS_ON but this is always overridden by the 
> various drawing methods
> Currently we're missing out on anti-aliasing for paths (other than glyphs) 
> and we're getting low-quality resizing of images, which makes Type 3 fonts 
> look particularly ugly. Setting the appropriate rendering hints would improve 
> this greatly.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to