Created
August 15, 2011 22:38
-
-
Save maknoll/1148055 to your computer and use it in GitHub Desktop.
Fixes widths of german umlauts when loading ttf fonts with PdfBox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PDFont font = PDTrueTypeFont.loadTTF(document, "putr8a.ttf"); // example font (Utopia) | |
List<Float> widths = font.getWidths(); | |
for (int i = 1; i <= 22; i++) | |
widths.add(250f); // add 22 floats to cover all 255 ascii chars | |
widths.set(246, widths.get(111)); // copy width of o to ö | |
widths.set(252, widths.get(117)); // u to ü | |
font.setWidths(widths); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment