On Thu Sep 09 10:10:52 PDT 2021 thaush...@t-online.de said:
>In theory one could make separate rendering hints for fonts and for
>ordinary vectors, but that would be messy and hard to understand. (And
>who knows whether it will work for your file)
>
>I recommend that you try doing this yourself by downloading the source
>code and changing PageDrawer and put some hard-coded modifications.
>Search for "graphics.".

I was able to find a bit of time to take a look at this.
I experimented in PageDrawer.drawGlyph and found that I get pretty close to the 
old renderer if I changed the RenderingMode to STROKE instead of FILL.
As far as I can tell, the FILL comes from the PDF interpreting code.  For my 
use of generating tiny thumbnails, I added the following code.  Not sure if it 
would ever be useful to anyone else.  If it might, I'd need to clean it up a 
bit and do whatever is needed to fit with the project style and conventions.

--I added this to my PageDrawer.java

        public static class BoxKey extends Key {

                public static BoxKey KEY_TEXTHINT = new BoxKey(1984);

                private BoxKey( final int privatekey) {
                        super(privatekey);
                }

                @Override
                public boolean isCompatibleValue(final Object val) {
                        boolean isvalid = false;
                        try {
                                RenderingMode.valueOf((String) val);
                                isvalid = true;
                        } finally {
                        }
                        return isvalid;
                }

        }

        private RenderingMode textRenderModeHint = null;

-- then in the constructor, added

                if (renderingHints.containsKey(BoxKey.KEY_TEXTHINT)) {
                        textRenderModeHint = RenderingMode.valueOf((String) 
renderingHints.get(BoxKey.KEY_TEXTHINT));
                }

-- and in drawGlyph, changed renderingMode to be:

                RenderingMode renderingMode = (textRenderModeHint != null) ? 
textRenderModeHint : state.getTextState().getRenderingMode();

-- and finally, where I actually use the renderer, I added:

                hintlist.put(BoxKey.KEY_TEXTHINT, "STROKE");



--

Try my Sensible Email package!  https://sourceforge.net/projects/sensibleemail/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to