TrueTypeEmbedder.java (pdfbox-2.0.23-src) | : | TrueTypeEmbedder.java (pdfbox-2.0.24-src) | ||
---|---|---|---|---|
skipping to change at line 154 | skipping to change at line 154 | |||
{ | { | |||
IOUtils.closeQuietly(input); | IOUtils.closeQuietly(input); | |||
} | } | |||
stream.getCOSObject().setLong(COSName.LENGTH1, ttf.getOriginalDataSize() ); | stream.getCOSObject().setLong(COSName.LENGTH1, ttf.getOriginalDataSize() ); | |||
fontDescriptor.setFontFile2(stream); | fontDescriptor.setFontFile2(stream); | |||
} | } | |||
/** | /** | |||
* Returns true if the fsType in the OS/2 table permits embedding. | * Returns true if the fsType in the OS/2 table permits embedding. | |||
*/ | */ | |||
private boolean isEmbeddingPermitted(TrueTypeFont ttf) throws IOException | boolean isEmbeddingPermitted(TrueTypeFont ttf) throws IOException | |||
{ | { | |||
if (ttf.getOS2Windows() != null) | if (ttf.getOS2Windows() != null) | |||
{ | { | |||
int fsType = ttf.getOS2Windows().getFsType(); | int fsType = ttf.getOS2Windows().getFsType(); | |||
if ((fsType & OS2WindowsMetricsTable.FSTYPE_RESTRICTED) == | int maskedFsType = fsType & 0x000F; | |||
OS2WindowsMetricsTable.FSTYPE_RESTRICTED) | // PDFBOX-5191: don't check the bit because permissions are exclusiv | |||
e | ||||
if (maskedFsType == OS2WindowsMetricsTable.FSTYPE_RESTRICTED) | ||||
{ | { | |||
// restricted License embedding | // restricted License embedding | |||
return false; | return false; | |||
} | } | |||
else if ((fsType & OS2WindowsMetricsTable.FSTYPE_BITMAP_ONLY) == | else if ((fsType & OS2WindowsMetricsTable.FSTYPE_BITMAP_ONLY) == | |||
OS2WindowsMetricsTable.FSTYPE_BITMAP_ONLY) | OS2WindowsMetricsTable.FSTYPE_BITMAP_ONLY) | |||
{ | { | |||
// bitmap embedding only | // bitmap embedding only | |||
return false; | return false; | |||
} | } | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 5 lines changed or added |