Skip to content

Commit 6397287

Browse files
fix: glyph issue with encodings (#129)
Signed-off-by: Peter Staar <[email protected]>
1 parent f5cbc74 commit 6397287

File tree

102 files changed

+187006
-105687
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+187006
-105687
lines changed

src/v2/pdf_resources/page_font.h

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,12 @@ namespace pdflib
387387
}
388388
else
389389
{
390-
LOG_S(WARNING) << "could not decode character with value=" << c
390+
LOG_S(ERROR) << "could not decode character with value=" << c
391391
<< " for encoding=" << to_string(encoding)
392392
<< ", fontname=" << font_name
393393
<< " and subtype=" << subtype;
394394

395-
result = "glyph<c="+std::to_string(c)+",font="+font_name+">";
395+
result = "GLYPH<c="+std::to_string(c)+",font="+font_name+">";
396396
}
397397

398398
return result;
@@ -429,11 +429,11 @@ namespace pdflib
429429
}
430430
else
431431
{
432-
LOG_S(WARNING) << "could not decode character with value=" << c
432+
LOG_S(ERROR) << "could not decode character with value=" << c
433433
<< " for encoding=" << to_string(encoding)
434434
<< ", fontname=" << font_name
435435
<< " and subtype=" << subtype;
436-
return "glyph<c="+std::to_string(c)+",font="+font_name+">";
436+
return "GLYPH<c="+std::to_string(c)+",font="+font_name+">";
437437
}
438438
}
439439
break;
@@ -445,7 +445,7 @@ namespace pdflib
445445
<< ", fontname=" << font_name
446446
<< " and subtype=" << subtype;
447447

448-
return std::string("glyph<UNKNOWN>");
448+
return std::string("GLYPH<UNKNOWN>");
449449
}
450450
}
451451
}
@@ -503,6 +503,7 @@ namespace pdflib
503503
}
504504
else
505505
{
506+
/*
506507
std::string notdef="GLYPH<"+std::to_string(c)+">";
507508
508509
unknown_numbs[c] += 1;
@@ -513,6 +514,14 @@ namespace pdflib
513514
<< " (corresponding font: " << fontname << ")";
514515
515516
return notdef;
517+
*/
518+
519+
LOG_S(WARNING) << " Symbol not found in special font: " << c
520+
<< "; Encoding: " << to_string(encoding)
521+
<< "; font-name: " << font_name
522+
<< " (corresponding font: " << fontname << ")";
523+
524+
return get_character_from_encoding(c);
516525
}
517526
}
518527
else
@@ -1546,10 +1555,12 @@ namespace pdflib
15461555
if(cmap_initialized) // we found a `ToUnicode` before. No need to go deeper!
15471556
{
15481557
LOG_S(WARNING) << "We found a `ToUnicode` before. No need to go deeper!";
1549-
return;
1558+
// return;
15501559
}
1551-
else if(subtype==TYPE_0 and desc_font!=NULL and
1552-
cids.has(encoding_name) )
1560+
//else
1561+
1562+
if(subtype==TYPE_0 and desc_font!=NULL and
1563+
cids.has(encoding_name) )
15531564
{
15541565
try
15551566
{

src/v2/pdf_resources/page_font/font_cid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ namespace pdflib
255255
}
256256
else
257257
{
258-
LOG_S(WARNING) << "ignoring cid: " << cid << "\tname: " << name;
259-
cid2utf8[cid] = "glyph<cid:"+std::to_string(cid)+">";
258+
LOG_S(ERROR) << "ignoring cid: " << cid << "\tname: " << name;
259+
cid2utf8[cid] = "GLYPH<cid:"+std::to_string(cid)+">";
260260
}
261261
}
262262
}

0 commit comments

Comments
 (0)