mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
use the code2gid table when there is no one embedded
This commit is contained in:
parent
e6ca51087f
commit
8bad93c8e5
5
TODO
5
TODO
@ -1,9 +1,6 @@
|
|||||||
- font issue
|
- font issue
|
||||||
- cjkmix2*.pdf
|
- cjkmix2*.pdf
|
||||||
- decision about reencoding external fonts
|
- smarter space-as-offset
|
||||||
- pc1.pdf
|
|
||||||
- jyb.pdf
|
|
||||||
- SVD.pdf
|
|
||||||
- show hints about possible useful parameters
|
- show hints about possible useful parameters
|
||||||
- optimization levels
|
- optimization levels
|
||||||
- don't dump image when it is empty
|
- don't dump image when it is empty
|
||||||
|
@ -236,13 +236,15 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
|
|||||||
* re-encoding the font by glyph names
|
* re-encoding the font by glyph names
|
||||||
*
|
*
|
||||||
* for 8bit + TrueType
|
* for 8bit + TrueType
|
||||||
* sort the glpyhs as the original order, and later will map GID (instead of char code) to Unicode
|
* sort the glpyhs as the original order, and load the code2GID table
|
||||||
|
* later we will map GID (instead of char code) to Unicode
|
||||||
*
|
*
|
||||||
* for CID + nonTrueType
|
* for CID + nonTrueType
|
||||||
* Flatten the font
|
* Flatten the font
|
||||||
*
|
*
|
||||||
* for CID Truetype
|
* for CID Truetype
|
||||||
* same as 8bitTrueType, except for that we have to check 65536 charcodes
|
* same as 8bitTrueType, except for that we have to check 65536 charcodes
|
||||||
|
* use the embedded code2GID table if there is, otherwise use the one in the font
|
||||||
*/
|
*/
|
||||||
if(font_8bit)
|
if(font_8bit)
|
||||||
{
|
{
|
||||||
@ -305,11 +307,24 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
|
|||||||
|
|
||||||
GfxCIDFont * _font = dynamic_cast<GfxCIDFont*>(font);
|
GfxCIDFont * _font = dynamic_cast<GfxCIDFont*>(font);
|
||||||
|
|
||||||
// code2GID has been stored for embedded CID fonts
|
// To locate CID2GID for the font
|
||||||
code2GID = _font->getCIDToGID();
|
// as in CairoFontEngine.cc
|
||||||
|
if(code2GID = _font->getCIDToGID())
|
||||||
|
{
|
||||||
|
// use the mapping stored in _font
|
||||||
code2GID_len = _font->getCIDToGIDLen();
|
code2GID_len = _font->getCIDToGIDLen();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// use the mapping stored in the file
|
||||||
|
if(FoFiTrueType * fftt = FoFiTrueType::load((char*)filepath.c_str()))
|
||||||
|
{
|
||||||
|
code2GID = _font->getCodeToGIDMap(fftt, &code2GID_len);
|
||||||
|
delete fftt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ffw_cidflatten();
|
ffw_cidflatten();
|
||||||
}
|
}
|
||||||
@ -454,13 +469,6 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
|
|||||||
|
|
||||||
ffw_set_widths(width_list, max_key + 1, param.stretch_narrow_glyph, param.squeeze_wide_glyph, param.remove_unused_glyph);
|
ffw_set_widths(width_list, max_key + 1, param.stretch_narrow_glyph, param.squeeze_wide_glyph, param.remove_unused_glyph);
|
||||||
|
|
||||||
/*
|
|
||||||
* Reencoding is not likely to work for external fonts,
|
|
||||||
* Just hope that we can get correct Unicode values, and let the browser choose the correct glyphs
|
|
||||||
*
|
|
||||||
* TODO: maybe add an option here, but anyway according to the DPF spec, this is implement-dependent
|
|
||||||
*/
|
|
||||||
// if(info.is_embeded)
|
|
||||||
ffw_reencode_raw(cur_mapping, max_key + 1, 1);
|
ffw_reencode_raw(cur_mapping, max_key + 1, 1);
|
||||||
|
|
||||||
// In some space offsets in HTML, we insert a ' ' there in order to improve text copy&paste
|
// In some space offsets in HTML, we insert a ' ' there in order to improve text copy&paste
|
||||||
|
Loading…
Reference in New Issue
Block a user