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

John Hewson commented on PDFBOX-678:
------------------------------------

So I ended up basically rewriting this patch, because supporting rendering 
modes for AWT caused too many changes given that it's just going to be removed 
again soon. Instead I added support for rendering modes in the Glyph2D path 
only, which makes the code much, much cleaner and easy to follow.

- I moved the rendering modes into an enum, RenderingMode (enums are a 
long-standing 2.0 goal).
- Setting the graphics paint in both processText and drawGlyph2D isn't needed 
for Glyph2D but it is retained for the existing AWT code path.
- All stroke/fill/clip management for now happens in drawGlyph2D (excluding the 
legacy AWT code path).
- I've modified PDGraphicsState#intersectClippingPath to be more efficient so 
that we can call it from drawGlyph2D instead of buffering the text clipping 
path (this rendering mode is very rarely used).
- I added some flags (needsFill/needsStroke) in drawGlyph2D to avoid setting 
the Graphics2D the paint for every glyph.

I've added some comments to the AWT code explaining that it is deprecated and 
I've added some INFO logging to notify when AWT fonts are used. Keep an eye on 
PDFBOX-2149 if you're interested in what's happening with fonts currently.

> Support missing Text Rendering Modes when rendering a PDF
> ---------------------------------------------------------
>
>                 Key: PDFBOX-678
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-678
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Rendering
>            Reporter: Maruan Sahyoun
>            Assignee: John Hewson
>         Attachments: Java Printing.pdf, TextRenderingModes.java.patch, 
> example_026.pdf
>
>
> Of the 7 different Text Rendering Modes only mode 0 (Fill Text) is correctly 
> implemented. Mode 1 (Stroke Text) falls back to Mode 0 and the others are not 
> implemented. I'm looking to implement the missing modes (at least some of 
> them).
> Before doing so I'm proposing a structural change to when rendering really 
> occurs. Currently it's done within the PDxxxFont classes. I'd rather 
> implement the (AWT) text output in PageDrawer (or helper classes within the 
> same package) and use the font classes to return an AWT font by adding a 
> getAwtFont method. Doing so we get a better separation between the PDF 
> related stuff (PDxxx) and applications like PageDrawer. The current rendering 
> specific code within the PDxxxFont classes can be retained for compatibility 
> and marked deprecated at a later stage.
> WDYT?



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

Reply via email to