1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-21 12:40:08 +00:00

new option: --override-fstype

This commit is contained in:
Lu Wang 2013-07-02 08:04:20 +08:00
parent 1fc7027395
commit 132478c1c1
6 changed files with 21 additions and 1 deletions

View File

@ -178,6 +178,12 @@ If set to 1, glyphs narrower than described in PDF will be stretched; otherwise
.B --squeeze-wide-glyph <0|1> (Default: 1)
If set to 1, glyphs wider than described in PDF will be squeezed; otherwise it will be truncated.
.TP
.B --override-fstype <0|1> (Default: 0)
Clear the fstype bits in TTF/OTF fonts.
Turn this on if Internet Explorer complains about 'Permission must be Installable' AND you have permission to do so.
.SS Text
.TP
@ -231,6 +237,8 @@ Specify user password
.B --no-drm <0|1> (Default: 0)
Override document DRM settings
Turn this on only when you have permission.
.SS Misc.
.TP

View File

@ -561,7 +561,7 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
/*
* Step 5
* Generate the font and load the metrics
* Generate the font, load the metrics and set the embeddig bits (fstype)
*
* Ascent/Descent are not used in PDF, and the values in PDF may be wrong or inconsistent (there are 3 sets of them)
* We need to reload in order to retrieve/fix accurate ascent/descent, some info won't be written to the font by fontforge until saved.
@ -575,6 +575,8 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
ffw_load_font(cur_tmp_fn.c_str());
ffw_metric(&info.ascent, &info.descent);
if(param.override_fstype)
ffw_override_fstype();
ffw_save(fn.c_str());
ffw_close();

View File

@ -48,6 +48,7 @@ struct Param
std::string external_hint_tool;
int stretch_narrow_glyph;
int squeeze_wide_glyph;
int override_fstype;
// text
double h_eps, v_eps;

View File

@ -131,6 +131,7 @@ void parse_options (int argc, char **argv)
.add("external-hint-tool", &param.external_hint_tool, "", "external tool for hinting fonts (overrides --auto-hint)")
.add("stretch-narrow-glyph", &param.stretch_narrow_glyph, 0, "stretch narrow glyphs instead of padding them")
.add("squeeze-wide-glyph", &param.squeeze_wide_glyph, 1, "shrink wide glyphs instead of truncating them")
.add("override-fstype", &param.override_fstype, 0, "clear the fstype bits in TTF/OTF fonts")
// text
.add("heps", &param.h_eps, 1.0, "horizontal threshold for merging text, in pixels")

View File

@ -414,3 +414,10 @@ void ffw_auto_hint(void)
FVAutoHint(cur_fv);
FVAutoInstr(cur_fv);
}
void ffw_override_fstype(void)
{
*(int16 *)(&cur_fv->sf->pfminfo.fstype) = 0;
cur_fv->sf->pfminfo.pfmset = true;
cur_fv->sf->changed = true;
}

View File

@ -55,6 +55,7 @@ void ffw_set_widths(int * width_list, int mapping_len,
////////////////////////
// others
void ffw_auto_hint(void);
void ffw_override_fstype(void);
#ifdef __cplusplus
}