1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00

always-aply-tounicode now covers cid type0

This commit is contained in:
Lu Wang 2012-09-08 10:54:34 +08:00
parent 5cf7f2fdf2
commit 4baba1fa3c
2 changed files with 4 additions and 5 deletions

View File

@ -92,7 +92,7 @@ For some versions of Firefox, however, there will be a problem when the font siz
.B --always-apply-tounicode <0|1> (Default: 0) .B --always-apply-tounicode <0|1> (Default: 0)
A ToUnicode map may be provided for fonts in PDF which indicates the 'meaning' of the characters. A ToUnicode map may be provided for fonts in PDF which indicates the 'meaning' of the characters.
However often there is better "ToUnicode" info in Type 1 fonts, and sometimes the ToUnicode map provided is wrong. So by default pdf2htmlEX will find the Unicode value directly from the fonts instead of ToUnicode map. This behavior may be changed by turning on this switch. However often there is better "ToUnicode" info in Type 0/1 fonts, and sometimes the ToUnicode map provided is wrong. So by default pdf2htmlEX will find the Unicode value directly from the fonts instead of ToUnicode map. This behavior may be changed by turning on this switch.
.TP .TP
.B --space-as-offset <0|1> (Default: 0) .B --space-as-offset <0|1> (Default: 0)
Treat space characters as offsets, which may increase the size of the output. Treat space characters as offsets, which may increase the size of the output.

View File

@ -173,8 +173,7 @@ void HTMLRenderer::embed_font(const path & filepath, GfxFont * font, FontInfo &
Gfx8BitFont * font_8bit = nullptr; Gfx8BitFont * font_8bit = nullptr;
info.use_tounicode = ((suffix == ".ttf") || (font->isCIDFont()) || (param->always_apply_tounicode)); info.use_tounicode = ((suffix == ".ttf") || (param->always_apply_tounicode));
if(!get_metric_only) if(!get_metric_only)
{ {
@ -217,7 +216,7 @@ void HTMLRenderer::embed_font(const path & filepath, GfxFont * font, FontInfo &
unordered_set<string> nameset; unordered_set<string> nameset;
bool name_conflict_warned = false; bool name_conflict_warned = false;
memset(cur_mapping2, 0, 256 * sizeof(char*)); memset(cur_mapping2, 0, 0x100 * sizeof(char*));
for(int i = 0; i < 256; ++i) for(int i = 0; i < 256; ++i)
{ {
@ -287,7 +286,7 @@ void HTMLRenderer::embed_font(const path & filepath, GfxFont * font, FontInfo &
bool name_conflict_warned = false; bool name_conflict_warned = false;
auto ctu = font->getToUnicode(); auto ctu = font->getToUnicode();
memset(cur_mapping, 0, maxcode * sizeof(int32_t)); memset(cur_mapping, 0, 0x10000 * sizeof(int32_t));
if(code2GID) if(code2GID)
maxcode = min(maxcode, code2GID_len - 1); maxcode = min(maxcode, code2GID_len - 1);