mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #7628 from Snuffleupagus/issue-7580
Fallback to the `StandardEncoding` for Nonsymbolic fonts without `/Encoding` entry (issue 7580)
This commit is contained in:
commit
451956c0b1
4 changed files with 110 additions and 3 deletions
|
@ -1746,11 +1746,18 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
if (baseEncodingName) {
|
||||
properties.defaultEncoding = getEncoding(baseEncodingName).slice();
|
||||
} else {
|
||||
encoding = (properties.type === 'TrueType' ?
|
||||
WinAnsiEncoding : StandardEncoding);
|
||||
var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
|
||||
var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
|
||||
// According to "Table 114" in section "9.6.6.1 General" (under
|
||||
// "9.6.6 Character Encoding") of the PDF specification, a Nonsymbolic
|
||||
// font should use the `StandardEncoding` if no encoding is specified.
|
||||
encoding = StandardEncoding;
|
||||
if (properties.type === 'TrueType' && !isNonsymbolicFont) {
|
||||
encoding = WinAnsiEncoding;
|
||||
}
|
||||
// The Symbolic attribute can be misused for regular fonts
|
||||
// Heuristic: we have to check if the font is a standard one also
|
||||
if (!!(properties.flags & FontFlags.Symbolic)) {
|
||||
if (isSymbolicFont) {
|
||||
encoding = MacRomanEncoding;
|
||||
if (!properties.file) {
|
||||
if (/Symbol/i.test(properties.name)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue