#1281 DefineFont2/3 set advance value by deriving font

This commit is contained in:
Jindra Petřík
2016-09-17 17:20:56 +02:00
parent b9abe1a5fa
commit 42cec207fd
2 changed files with 4 additions and 4 deletions

View File

@@ -540,8 +540,8 @@ public class DefineFont2Tag extends FontTag {
SHAPE shp = SHAPERECORD.fontCharacterToSHAPE(font, (int) Math.round(getDivider() * 1024), ch);
fontBoundsTable.add(shp.getBounds());
int fontStyle = getFontStyle();
Font fnt = new Font(font.getFontName(), fontStyle, 1024); // Not multiplied with divider as it causes problems to create font with height around 20k
fontAdvanceTable.add((int) getDivider() * Math.round(FontHelper.getFontAdvance(fnt, ch)));
Font advanceFont = font.deriveFont(fontStyle, 1024); // Not multiplied with divider as it causes problems to create font with height around 20k
fontAdvanceTable.add((int) getDivider() * Math.round(FontHelper.getFontAdvance(advanceFont, ch)));
}
}

View File

@@ -545,8 +545,8 @@ public class DefineFont3Tag extends FontTag {
SHAPE shp = SHAPERECORD.fontCharacterToSHAPE(font, (int) Math.round(getDivider() * 1024), ch);
fontBoundsTable.add(shp.getBounds());
int fontStyle = getFontStyle();
Font fnt = new Font(font.getFontName(), fontStyle, 1024); // Not multiplied with divider as it causes problems to create font with height around 20k
fontAdvanceTable.add((int) getDivider() * Math.round(FontHelper.getFontAdvance(fnt, ch)));
Font advanceFont = font.deriveFont(fontStyle, 1024); // Not multiplied with divider as it causes problems to create font with height around 20k
fontAdvanceTable.add((int) getDivider() * Math.round(FontHelper.getFontAdvance(advanceFont, ch)));
}
}