in src/java/org/apache/fop/render/pdf/pdfbox/FOPPDFSingleByteFont.java [304:344]
private void mergeWidths(FontContainer font) throws IOException {
int w = 0;
int skipGlyphIndex = getLastChar() + 1;
Object cmap = getCmap(font);
Set<Integer> codeToName = getCodeToName(font.getEncoding()).keySet();
for (int i = font.getFirstChar(); i <= font.getLastChar(); i++) {
boolean addedWidth = false;
int glyphIndexPos = skipGlyphIndex;
if (font.font instanceof PDTrueTypeFont) {
glyphIndexPos = i;
}
int neww = 0;
if (font.getWidths() != null) {
neww = font.getWidths().get(i - font.getFirstChar());
if (!newWidth.containsKey(i) || newWidth.get(i) == 0) {
if (getFontType() == FontType.TYPE1
|| font.font instanceof PDTrueTypeFont
|| codeToName.contains(i)) {
newWidth.put(i, neww);
glyphIndexPos = i;
} else {
newWidth.put(i, 0);
}
addedWidth = true;
}
}
String mappedChar = getChar(cmap, i);
if (mappedChar != null) {
if (!charMapGlobal.containsKey(mappedChar)) {
charMapGlobal.put(mappedChar, glyphIndexPos);
if (!addedWidth && w < font.getWidths().size()) {
newWidth.put(newWidth.size() + getFirstChar(), neww);
}
skipGlyphIndex++;
} else if (glyphIndexPos < charMapGlobal.get(mappedChar)) {
charMapGlobal.put(mappedChar, glyphIndexPos);
}
}
w++;
}
}