You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2026/09/01 17:27:39 UTC
svn commit: r1937735 - pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font
Author: tilman
Date: Tue Sep 1 17:27:39 2026
New Revision: 1937735
Log:
PDFBOX-6249: correct wrongly set bits
Modified:
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapperImpl.java
Modified: pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapperImpl.java
==============================================================================
--- pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapperImpl.java Tue Sep 1 17:27:35 2026 (r1937734)
+++ pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapperImpl.java Tue Sep 1 17:27:39 2026 (r1937735)
@@ -704,11 +704,38 @@ final class FontMapperImpl implements Fo
long KOREAN_WANSUNG = 1 << 19;
long CHINESE_TRADITIONAL = 1 << 20;
long KOREAN_JOHAB = 1 << 21;
-
- if ("MalgunGothic-Semilight".equals(info.getPostScriptName()))
+
+ String postScriptName = info.getPostScriptName();
+ if (postScriptName != null)
{
- // PDFBOX-4793 and PDF.js 10699: This font has only Korean, but has bits 17-21 set.
- codePageRange &= ~(JIS_JAPAN | CHINESE_SIMPLIFIED | CHINESE_TRADITIONAL);
+ if ("MalgunGothic-Semilight".equals(postScriptName))
+ {
+ // PDFBOX-4793 and PDF.js 10699: This font has only Korean, but has bits 17-21 set.
+ codePageRange &= ~(JIS_JAPAN | CHINESE_SIMPLIFIED | CHINESE_TRADITIONAL);
+ }
+ if (postScriptName.startsWith("NotoSans"))
+ {
+ String suffix = postScriptName.substring(8);
+ if (suffix.startsWith("HK") ||
+ suffix.startsWith("TC") ||
+ suffix.startsWith("CJKsc") ||
+ suffix.startsWith("CJKtc") ||
+ suffix.startsWith("CJKhk") ||
+ suffix.startsWith("KR") ||
+ suffix.startsWith("CJKkr"))
+ {
+ // PDFBOX-6249: These fonts have bit 17 set.
+ codePageRange &= ~(JIS_JAPAN);
+ }
+ if (suffix.startsWith("JP") ||
+ suffix.startsWith("CJKjp") ||
+ suffix.startsWith("KR") ||
+ suffix.startsWith("CJKkr"))
+ {
+ // PDFBOX-6249: These fonts have at least one chinese bit set.
+ codePageRange &= ~(CHINESE_SIMPLIFIED | CHINESE_TRADITIONAL);
+ }
+ }
}
if (ordering.equals("GB1") &&
(codePageRange & CHINESE_SIMPLIFIED) == CHINESE_SIMPLIFIED)