pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dalley Oliver" <Oliver.Dal...@cor.fja.com>
Subject Change in PDSimpleFont
Date Wed, 24 Aug 2011 13:30:02 GMT

This is my first post here, so hello to you.

I use the pdfbox to print pdfs that were generated with the api from

There was something wrong with the fonds in the print and i fonud that
the fonds in oo pdfs were not used from pdfbox because the fond in java
could not handle it.

So i changed the PDSimpleFond that it tries to find the fond in the
systemand it worked for me. Here is the change:

     * {@inheritDoc}
    public void drawString( String string, Graphics g, float fontSize, 
            AffineTransform at, float x, float y ) throws IOException
        Font _awtFont = getawtFont();

        // mdavis - fix fontmanager.so/dll on
        // for font with bad cmaps?
        // Type1 fonts are not affected as they don't have cmaps
        if (!isType1Font() && _awtFont.canDisplayUpTo(string) != -1) { 
      	  _awtFont = new Font(_awtFont.getFontName(),
      	  if(_awtFont.canDisplayUpTo(string) != -1)
      		  log.warn("Changing font on <" + string + "> from <"
                    + _awtFont.getName() + "> to the default font");
      		  _awtFont = Font.decode(null); 

        Graphics2D g2d = (Graphics2D)g;
        g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON );
        writeFont(g2d, at, _awtFont, x, y, string);
I use this changed version in a comercial product so i would like to
give the change i made back to the project. 

The question now is, what do i have to do? should i check this into svn?

Greetings Oliver Dalley

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message