Skip to content

Commit

Permalink
PDFBOX-5920: check whether the name exists in PDType1CFont.getWidth()…
Browse files Browse the repository at this point in the history
…, as suggested by Andreas Lehmkühler

git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1922920 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Jan 6, 2025
1 parent ac3891a commit 134e202
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,12 @@ public float getStringWidth(String string) throws IOException
{
int codePoint = string.codePointAt(i);
String name = getGlyphList().codePointToName(codePoint);
if (!cffFont.hasGlyph(string))
{
throw new IllegalArgumentException(
String.format("U+%04X ('%s') is not available in font %s",
codePoint, name, getName()));
}
width += cffFont.getType1CharString(name).getWidth();
}
return width;
Expand Down

0 comments on commit 134e202

Please sign in to comment.