Skip to content

Commit 0ad7e44

Browse files
committed
PDFBOX-5920: make sure that the exception is thrown if space isn't in the font
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1922902 13f79535-47bb-0310-9956-ffa450edef68
1 parent 4e9a534 commit 0ad7e44

File tree

1 file changed

+2
-0
lines changed
  • pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font

1 file changed

+2
-0
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,8 @@ public float getSpaceWidth()
575575
try
576576
{
577577
// PDFBOX-5920: try with encoding, which gets the correct code
578+
encode(" "); // this throws an exception if space doesn't exist,
579+
// getStringWidth() not always
578580
fontWidthOfSpace = getStringWidth(" ");
579581
}
580582
catch (IllegalArgumentException | UnsupportedOperationException ex)

0 commit comments

Comments
 (0)