ICEpdf
  1. ICEpdf
  2. PDF-50

Performance Improvement for OFont character advance calculation

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      any

      Description

      When profiling for PDF-13, several red flags came up around how we where calculating the character advance metrics for layout in the OFont classes.

      The first big offender was GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts() was being called for every new instance of a ofont/Font object. This system call is pretty expensive.

      The next big offender was in related to a sequence of awt calls to get a glphys x and y advance values. I change the code to cache the metric information and only do the full calculation when we need to.

      Two very simple optimizations that increased the parsing speed significantly for the OS release.

        Activity

        Repository Revision Date User Message
        ICEsoft Public SVN Repository #19341 Mon Oct 05 06:39:17 MDT 2009 patrick.corless PDF-50 - cached system fonts call GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts as a static instance variable. Expensive call that was origionally being called for each new instance of the class.
        Files Changed
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/fonts/ofont/Font.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #19342 Mon Oct 05 06:41:02 MDT 2009 patrick.corless PDF-50 - added code to cache a font's glyph advance metrics by character id.
        Files Changed
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/fonts/ofont/OFont.java
        Patrick Corless created issue -
        Patrick Corless made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Patrick Corless added a comment -

        Checked in source, closing.

        Show
        Patrick Corless added a comment - Checked in source, closing.
        Patrick Corless made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 3.1 [ 10181 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #19367 Wed Oct 07 17:37:20 MDT 2009 patrick.corless PDF-50 - fixed width caching issue that broke layout for numerous pdf types.
        Files Changed
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/fonts/ofont/OFont.java
        Hide
        Patrick Corless added a comment -

        Found an issue in where the glyph width was incorrectly being calculated after the optimization.

        Show
        Patrick Corless added a comment - Found an issue in where the glyph width was incorrectly being calculated after the optimization.
        Patrick Corless made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Patrick Corless added a comment -

        It turns out the the deriveFont() call where being used for different font instances and as a resulted the cached widths weren't always correct. Update code slightly to recalculate width on the fly but still skip the heavy system calls. I aslo added code to clear the cache when deriveFont is called with metrics changing data.

        Show
        Patrick Corless added a comment - It turns out the the deriveFont() call where being used for different font instances and as a resulted the cached widths weren't always correct. Update code slightly to recalculate width on the fly but still skip the heavy system calls. I aslo added code to clear the cache when deriveFont is called with metrics changing data.
        Patrick Corless made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #19382 Fri Oct 09 05:41:50 MDT 2009 patrick.corless PDF-50 - fixed bug when chaning font size that prevent the echarAdvanceCache from being cleared.
        Files Changed
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/fonts/ofont/OFont.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #19386 Fri Oct 09 06:00:09 MDT 2009 patrick.corless PDF-50 - fixed bug when changing font size that prevent the echarAdvanceCache from being cleared.
        Files Changed
        Commit graph MODIFY /icepdf/tags/icepdf-3.1.0/icepdf/core/src/org/icepdf/core/pobjects/fonts/ofont/OFont.java
        Hide
        Patrick Corless added a comment -

        Qa found a regression with font width which is related to this bug.

        Show
        Patrick Corless added a comment - Qa found a regression with font width which is related to this bug.
        Patrick Corless made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Patrick Corless added a comment -

        There were a few regression in the the image comparor that showed incorrect glyph width calculations for layout. I had logic error when calculating a font point size change which failed to clear the echarAdvanceCache map. Silly mistake.

        Show
        Patrick Corless added a comment - There were a few regression in the the image comparor that showed incorrect glyph width calculations for layout. I had logic error when calculating a font point size change which failed to clear the echarAdvanceCache map. Silly mistake.
        Patrick Corless made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Patrick Corless added a comment -

        ICEpdf 3.1.0 has been released, closing issues.

        Show
        Patrick Corless added a comment - ICEpdf 3.1.0 has been released, closing issues.
        Patrick Corless made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Patrick Corless
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: