Skip to content

Commit

Permalink
Fix weight, ascent and descent calculation for Type1FontProgram
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Aug 29, 2024
1 parent b965f37 commit e8a1d63
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/verapdf/pd/font/type1/Type1FontProgram.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public ASFileStreamCloser getFontProgramResource() {
public String getWeight() {
COSObject weight = this.getObjectFromUserDict(ASAtom.getASAtom(
Type1StringConstants.WEIGHT));
if (weight.getType() == COSObjType.COS_STRING) {
if (weight != null && weight.getType() == COSObjType.COS_STRING) {
return weight.getString();
}
return null;
Expand All @@ -351,7 +351,7 @@ public String getWeight() {
public Double getAscent() {
COSObject ascent = this.getObjectFromUserDict(ASAtom.getASAtom(
Type1StringConstants.ASCENT));
if (ascent.getType().isNumber()) {
if (ascent != null && ascent.getType().isNumber()) {
return ascent.getReal();
}
return null;
Expand All @@ -361,7 +361,7 @@ public Double getAscent() {
public Double getDescent() {
COSObject descent = this.getObjectFromUserDict(ASAtom.getASAtom(
Type1StringConstants.DESCENT));
if (descent.getType().isNumber()) {
if (descent != null && descent.getType().isNumber()) {
return descent.getReal();
}
return null;
Expand Down

0 comments on commit e8a1d63

Please sign in to comment.