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

removed '--remove-unused-glyph'

This commit is contained in:
Lu Wang 2013-06-17 23:29:22 +08:00
parent 4a7e067059
commit 29ba79a378
7 changed files with 13 additions and 25 deletions

View File

@ -7,8 +7,9 @@ Developing v0.9
* New options: * New options:
--embed --embed
--embed-*** --embed-***
* Deprecated options: * Deprecated/Removed options:
--single-html --single-html
--remove-unused-glyph
v0.8 v0.8
2013.05.05 2013.05.05

View File

@ -158,12 +158,6 @@ Specify the suffix of fonts extracted from the PDF file.
.B --decompose-ligature <0|1> (Default: 0) .B --decompose-ligature <0|1> (Default: 0)
Decompose ligatures. For example 'fi' -> 'f''i'. Decompose ligatures. For example 'fi' -> 'f''i'.
.TP
.B --remove-unused-glyph <0|1> (Default: 0)
If set to 1, remove unused glyphs in embedded fonts in order to reduce the file size.
Currently this option is experimental, turning it on may cause segmentation fault or debris-like fonts.
.TP .TP
.B --auto-hint <0|1> (Default: 0) .B --auto-hint <0|1> (Default: 0)
If set to 1, hints will be generated for the fonts using fontforge. If set to 1, hints will be generated for the fonts using fontforge.

View File

@ -470,7 +470,7 @@ 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);
ffw_reencode_raw(cur_mapping, max_key + 1, 1); ffw_reencode_raw(cur_mapping, max_key + 1, 1);

View File

@ -44,7 +44,6 @@ struct Param
int embed_external_font; int embed_external_font;
std::string font_suffix; std::string font_suffix;
int decompose_ligature; int decompose_ligature;
int remove_unused_glyph;
int auto_hint; int auto_hint;
std::string external_hint_tool; std::string external_hint_tool;
int stretch_narrow_glyph; int stretch_narrow_glyph;

View File

@ -42,6 +42,12 @@ void deprecated_single_html(const char * dummy = nullptr)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
void removed_remove_unsed_glyph(const char * dummy = nullptr)
{
cerr << "--remove-unsed-glyph is removed. Use a PDF optimization tool instead." << endl;
exit(EXIT_FAILURE);
}
void show_usage_and_exit(const char * dummy = nullptr) void show_usage_and_exit(const char * dummy = nullptr)
{ {
cerr << "Usage: pdf2htmlEX [options] <input.pdf> [<output.html>]" << endl; cerr << "Usage: pdf2htmlEX [options] <input.pdf> [<output.html>]" << endl;
@ -121,7 +127,6 @@ void parse_options (int argc, char **argv)
.add("embed-external-font", &param.embed_external_font, 1, "embed local match for external fonts") .add("embed-external-font", &param.embed_external_font, 1, "embed local match for external fonts")
.add("font-suffix", &param.font_suffix, ".ttf", "suffix for embedded font files (.ttf,.otf,.woff,.svg)") .add("font-suffix", &param.font_suffix, ".ttf", "suffix for embedded font files (.ttf,.otf,.woff,.svg)")
.add("decompose-ligature", &param.decompose_ligature, 0, "decompose ligatures, such as \uFB01 -> fi") .add("decompose-ligature", &param.decompose_ligature, 0, "decompose ligatures, such as \uFB01 -> fi")
.add("remove-unused-glyph", &param.remove_unused_glyph, 0, "remove unused glyphs in embedded fonts")
.add("auto-hint", &param.auto_hint, 0, "use fontforge autohint on fonts without hints") .add("auto-hint", &param.auto_hint, 0, "use fontforge autohint on fonts without hints")
.add("external-hint-tool", &param.external_hint_tool, "", "external tool for hinting fonts (overrides --auto-hint)") .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("stretch-narrow-glyph", &param.stretch_narrow_glyph, 0, "stretch narrow glyphs instead of padding them")
@ -154,6 +159,7 @@ void parse_options (int argc, char **argv)
// deprecated // deprecated
.add("single-html", "", &deprecated_single_html) .add("single-html", "", &deprecated_single_html)
.add("remove-unused-glyph", "", &removed_remove_unsed_glyph)
.add("", &param.input_filename, "", "") .add("", &param.input_filename, "", "")
.add("", &param.output_filename, "", "") .add("", &param.output_filename, "", "")

View File

@ -353,11 +353,9 @@ void ffw_metric(double * ascent, double * descent)
/* /*
* TODO:bitmap, reference have not been considered in this function * TODO:bitmap, reference have not been considered in this function
* TODO:remove_unused may not be suitable to be done here
*/ */
void ffw_set_widths(int * width_list, int mapping_len, void ffw_set_widths(int * width_list, int mapping_len,
int stretch_narrow, int squeeze_wide, int stretch_narrow, int squeeze_wide)
int remove_unused)
{ {
SplineFont * sf = cur_fv->sf; SplineFont * sf = cur_fv->sf;
@ -367,8 +365,6 @@ void ffw_set_widths(int * width_list, int mapping_len,
{ {
printf("TODO: width vs bitmap\n"); printf("TODO: width vs bitmap\n");
} }
memset(cur_fv->selected, 0, cur_fv->map->enccount);
EncMap * map = cur_fv->map; EncMap * map = cur_fv->map;
int i; int i;
@ -376,11 +372,10 @@ void ffw_set_widths(int * width_list, int mapping_len,
for(i = 0; i < imax; ++i) for(i = 0; i < imax; ++i)
{ {
/* /*
* Do mess with it if the glyphs is not used. * Don't mess with it if the glyphs is not used.
*/ */
if(width_list[i] == -1) if(width_list[i] == -1)
{ {
cur_fv->selected[i] = 1;
continue; continue;
} }
@ -405,12 +400,6 @@ void ffw_set_widths(int * width_list, int mapping_len,
SCSynchronizeWidth(sc, width_list[i], sc->width, cur_fv); SCSynchronizeWidth(sc, width_list[i], sc->width, cur_fv);
} }
for(; i < map->enccount; ++i)
cur_fv->selected[i] = 1;
if(remove_unused)
FVDetachAndRemoveGlyphs(cur_fv);
} }
void ffw_auto_hint(void) void ffw_auto_hint(void)

View File

@ -50,8 +50,7 @@ int ffw_get_em_size(void);
void ffw_metric(double * ascent, double * descent); void ffw_metric(double * ascent, double * descent);
void ffw_set_widths(int * width_list, int mapping_len, void ffw_set_widths(int * width_list, int mapping_len,
int stretch_narrow, int squeeze_wide, int stretch_narrow, int squeeze_wide);
int remove_unused);
//////////////////////// ////////////////////////
// others // others