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: [email protected]
For additional commands, e-mail: [email protected]