Skip to content

Commit 092a49b

Browse files
committed
PDFBOX-5660: optimize, as suggested by Valery Bokov; closes #263
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1928751 13f79535-47bb-0310-9956-ffa450edef68
1 parent 21fda23 commit 092a49b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,10 @@ public final void buildFontFile2(InputStream ttfStream) throws IOException
139139
*/
140140
final boolean isEmbeddingPermitted(TrueTypeFont ttf) throws IOException
141141
{
142-
if (ttf.getOS2Windows() != null)
142+
OS2WindowsMetricsTable os2 = ttf.getOS2Windows();
143+
if (os2 != null)
143144
{
144-
int fsType = ttf.getOS2Windows().getFsType();
145+
int fsType = os2.getFsType();
145146
int maskedFsType = fsType & 0x000F;
146147
// PDFBOX-5191: don't check the bit because permissions are exclusive
147148
if (maskedFsType == OS2WindowsMetricsTable.FSTYPE_RESTRICTED)
@@ -164,9 +165,10 @@ else if ((fsType & OS2WindowsMetricsTable.FSTYPE_BITMAP_ONLY) ==
164165
*/
165166
private boolean isSubsettingPermitted(TrueTypeFont ttf) throws IOException
166167
{
167-
if (ttf.getOS2Windows() != null)
168+
OS2WindowsMetricsTable os2 = ttf.getOS2Windows();
169+
if (os2 != null)
168170
{
169-
int fsType = ttf.getOS2Windows().getFsType();
171+
int fsType = os2.getFsType();
170172
if ((fsType & OS2WindowsMetricsTable.FSTYPE_NO_SUBSETTING) ==
171173
OS2WindowsMetricsTable.FSTYPE_NO_SUBSETTING)
172174
{

0 commit comments

Comments
 (0)