From 29ba79a378a8835967cb1d657e77237efe4638e4 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Mon, 17 Jun 2013 23:29:22 +0800 Subject: [PATCH] removed '--remove-unused-glyph' --- ChangeLog | 3 ++- pdf2htmlEX.1.in | 6 ------ src/HTMLRenderer/font.cc | 2 +- src/Param.h | 1 - src/pdf2htmlEX.cc | 8 +++++++- src/util/ffw.c | 15 ++------------- src/util/ffw.h | 3 +-- 7 files changed, 13 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6309d52..aa453f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,8 +7,9 @@ Developing v0.9 * New options: --embed --embed-*** -* Deprecated options: +* Deprecated/Removed options: --single-html + --remove-unused-glyph v0.8 2013.05.05 diff --git a/pdf2htmlEX.1.in b/pdf2htmlEX.1.in index e696683..f437a6f 100644 --- a/pdf2htmlEX.1.in +++ b/pdf2htmlEX.1.in @@ -158,12 +158,6 @@ Specify the suffix of fonts extracted from the PDF file. .B --decompose-ligature <0|1> (Default: 0) 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 .B --auto-hint <0|1> (Default: 0) If set to 1, hints will be generated for the fonts using fontforge. diff --git a/src/HTMLRenderer/font.cc b/src/HTMLRenderer/font.cc index 161bca0..53c3be6 100644 --- a/src/HTMLRenderer/font.cc +++ b/src/HTMLRenderer/font.cc @@ -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); diff --git a/src/Param.h b/src/Param.h index 1b3f1d3..7a4a66b 100644 --- a/src/Param.h +++ b/src/Param.h @@ -44,7 +44,6 @@ struct Param int embed_external_font; std::string font_suffix; int decompose_ligature; - int remove_unused_glyph; int auto_hint; std::string external_hint_tool; int stretch_narrow_glyph; diff --git a/src/pdf2htmlEX.cc b/src/pdf2htmlEX.cc index f9f9ff6..f54aafd 100644 --- a/src/pdf2htmlEX.cc +++ b/src/pdf2htmlEX.cc @@ -42,6 +42,12 @@ void deprecated_single_html(const char * dummy = nullptr) 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) { cerr << "Usage: pdf2htmlEX [options] []" << endl; @@ -121,7 +127,6 @@ void parse_options (int argc, char **argv) .add("embed-external-font", ¶m.embed_external_font, 1, "embed local match for external fonts") .add("font-suffix", ¶m.font_suffix, ".ttf", "suffix for embedded font files (.ttf,.otf,.woff,.svg)") .add("decompose-ligature", ¶m.decompose_ligature, 0, "decompose ligatures, such as \uFB01 -> fi") - .add("remove-unused-glyph", ¶m.remove_unused_glyph, 0, "remove unused glyphs in embedded fonts") .add("auto-hint", ¶m.auto_hint, 0, "use fontforge autohint on fonts without hints") .add("external-hint-tool", ¶m.external_hint_tool, "", "external tool for hinting fonts (overrides --auto-hint)") .add("stretch-narrow-glyph", ¶m.stretch_narrow_glyph, 0, "stretch narrow glyphs instead of padding them") @@ -154,6 +159,7 @@ void parse_options (int argc, char **argv) // deprecated .add("single-html", "", &deprecated_single_html) + .add("remove-unused-glyph", "", &removed_remove_unsed_glyph) .add("", ¶m.input_filename, "", "") .add("", ¶m.output_filename, "", "") diff --git a/src/util/ffw.c b/src/util/ffw.c index 4a2d679..122691e 100644 --- a/src/util/ffw.c +++ b/src/util/ffw.c @@ -353,11 +353,9 @@ void ffw_metric(double * ascent, double * descent) /* * 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, - int stretch_narrow, int squeeze_wide, - int remove_unused) + int stretch_narrow, int squeeze_wide) { 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"); } - - memset(cur_fv->selected, 0, cur_fv->map->enccount); EncMap * map = cur_fv->map; int i; @@ -376,11 +372,10 @@ void ffw_set_widths(int * width_list, int mapping_len, 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) { - cur_fv->selected[i] = 1; continue; } @@ -405,12 +400,6 @@ void ffw_set_widths(int * width_list, int mapping_len, 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) diff --git a/src/util/ffw.h b/src/util/ffw.h index de90cc7..2cfb9ef 100644 --- a/src/util/ffw.h +++ b/src/util/ffw.h @@ -50,8 +50,7 @@ int ffw_get_em_size(void); void ffw_metric(double * ascent, double * descent); void ffw_set_widths(int * width_list, int mapping_len, - int stretch_narrow, int squeeze_wide, - int remove_unused); + int stretch_narrow, int squeeze_wide); //////////////////////// // others