xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Reischenbacher <matthias8...@gmx.at>
Subject Re: FOP2.0 taking more time format complex script documents
Date Thu, 24 Sep 2015 20:23:38 GMT
Hi,

thanks for your analysis. I've committed a fix as part of
https://issues.apache.org/jira/browse/FOP-2530

Best regards,
Matthias

On 11.08.2015 11:36, dvineshkumar@gmail.com wrote:
> Hi,
> 
> After analysis, found a bug in MultiByteFont::findGlyphIndex() method. 
> In FOP2.0, MultiByteFont::findGlyphIndex() method, for loop is continous
> even after a glyph character is found. Updated the findGlyphIndex() method
> to terminate the loop once the glyph character is found and performance got
> improved much. Refer below existing and updated method.
> 
> Existing:
> 
>  public int findGlyphIndex(int c) {
>         int idx = c;
>         int retIdx = SingleByteEncoding.NOT_FOUND_CODE_POINT;
> 
>         // for most users the most likely glyphs are in the first cmap
> segments (meaning the one with
>         // the lowest unicode start values)
>         if (idx < NUM_MOST_LIKELY_GLYPHS && mostLikelyGlyphs[idx] != 0) {
>             return mostLikelyGlyphs[idx];
>         }
>         for (CMapSegment i : cmap) {
>             if (retIdx == 0
>                     && i.getUnicodeStart() <= idx
>                     && i.getUnicodeEnd() >= idx) {
>                 retIdx = i.getGlyphStartIndex()
>                     + idx
>                     - i.getUnicodeStart();
>                 if (idx < NUM_MOST_LIKELY_GLYPHS) {
>                     mostLikelyGlyphs[idx] = retIdx;
>                 }
>             }
>         }
>         return retIdx;
>     }
> 
> Updated:
> 
> public int findGlyphIndex(int c) {
> int idx = c;
> int retIdx = SingleByteEncoding.NOT_FOUND_CODE_POINT;
> 
> // for most users the most likely glyphs are in the first cmap segments
> (meaning the one with
> // the lowest unicode start values)
> if (idx < NUM_MOST_LIKELY_GLYPHS && mostLikelyGlyphs[idx] != 0) {
> return mostLikelyGlyphs[idx];
> }
> 
> for (int i = 0; (i < cmap.size()) && retIdx == 0; i++) {
> if (cmap.get(i).getUnicodeStart() <= idx
> && cmap.get(i).getUnicodeEnd() >= idx) {
> 
> retIdx = cmap.get(i).getGlyphStartIndex()
> + idx
> - cmap.get(i).getUnicodeStart();
> if (idx < NUM_MOST_LIKELY_GLYPHS) {
> mostLikelyGlyphs[idx] = retIdx;
> 
> }
> }
> }
> return retIdx;
> }
> 
> Regards,
> Vinesh Kumar. D 
> 
> 
> 
> 
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/FOP2-0-taking-more-time-to-format-complex-script-documents-tp42461p42749.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message