1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-05 01:28:39 +00:00

Don't mess up original glyphs when inserting a new empty char

This commit is contained in:
Lu Wang 2013-02-21 17:36:43 +08:00
parent 5947b1b953
commit 1103f74b8a
3 changed files with 8 additions and 5 deletions

View File

@ -431,7 +431,7 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
char buf[2] = {0, ' '};
space_width = (int)floor(font_cid->getWidth(buf, 2) * info.em_size + 0.5);
}
ffw_make_char((int)' ', space_width);
ffw_add_empty_char((int32_t)' ', space_width);
}
if(ctu)

View File

@ -260,9 +260,12 @@ void ffw_cidflatten(void)
SFFlatten(cur_fv->sf->cidmaster);
}
void ffw_make_char(int enc, int width)
void ffw_add_empty_char(int32_t unicode, int width)
{
SFMakeChar(cur_fv->sf, cur_fv->map, enc)->width = width;
// append the new char to Enc
SplineChar * sc = SFMakeChar(cur_fv->sf, cur_fv->map, cur_fv->map->enccount);
sc->unicodeenc = unicode;
sc->width = width;
}
int ffw_get_em_size(void)

View File

@ -40,8 +40,8 @@ void ffw_reencode_raw(int32_t * mapping, int mapping_len, int force);
void ffw_reencode_raw2(char ** mapping, int mapping_len, int force);
void ffw_cidflatten(void);
// get or create the char, and set the width
void ffw_make_char(int enc, int width);
// add a new empty char into the font
void ffw_add_empty_char(int32_t unicode, int width);
////////////////////////
// metrics