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

always generate ttf first; use woff as default

This commit is contained in:
Lu Wang 2013-11-08 13:53:42 +08:00
parent ef7e04f890
commit c57085f600
4 changed files with 13 additions and 13 deletions

View File

@ -151,7 +151,7 @@ Specify whether the local matched fonts, for fonts not embedded in PDF, should b
If this switch is off, only font names are exported such that web browsers may try to find proper fonts themselves, and that might cause issues about incorrect font metrics. If this switch is off, only font names are exported such that web browsers may try to find proper fonts themselves, and that might cause issues about incorrect font metrics.
.TP .TP
.B --font-format <format> (Default: ttf) .B --font-format <format> (Default: woff)
Specify the format of fonts extracted from the PDF file. Specify the format of fonts extracted from the PDF file.
.TP .TP

View File

@ -183,15 +183,15 @@
// scale the content box // scale the content box
{ {
var s = this.content_box.style; var cbs = this.content_box.style;
s.msTransform = s.webkitTransform = s.transform = 'scale('+this.cur_scale.toFixed(3)+')'; cbs.msTransform = cbs.webkitTransform = cbs.transform = 'scale('+this.cur_scale.toFixed(3)+')';
} }
// stretch the page frame to hold the place // stretch the page frame to hold the place
{ {
var s = this.p.style; var ps = this.p.style;
s.height = (this.original_height * this.cur_scale) + 'px'; ps.height = (this.original_height * this.cur_scale) + 'px';
s.width = (this.original_width * this.cur_scale) + 'px'; ps.width = (this.original_width * this.cur_scale) + 'px';
} }
}, },
/* return if any part of this page is shown in the container */ /* return if any part of this page is shown in the container */

View File

@ -746,17 +746,17 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
/* /*
* Step 3 * Step 3
*
* Reencode to Unicode Full such that FontForge won't ditch unicode values larger than 0xFFFF
*
* Generate the font as desired * Generate the font as desired
*
*/ */
// Reencode to Unicode Full such that FontForge won't ditch unicode values larger than 0xFFFF
ffw_reencode_unicode_full(); ffw_reencode_unicode_full();
string cur_tmp_fn = (char*)str_fmt("%s/__tmp_font1.%s", param.tmp_dir.c_str(), param.font_format.c_str()); // Due to a bug of Fontforge about pfa -> woff conversion
// we always generate TTF first, instead of the format specified by user
string cur_tmp_fn = (char*)str_fmt("%s/__tmp_font1.%s", param.tmp_dir.c_str(), "ttf");
tmp_files.add(cur_tmp_fn); tmp_files.add(cur_tmp_fn);
string other_tmp_fn = (char*)str_fmt("%s/__tmp_font2.%s", param.tmp_dir.c_str(), param.font_format.c_str()); string other_tmp_fn = (char*)str_fmt("%s/__tmp_font2.%s", param.tmp_dir.c_str(), "ttf");
tmp_files.add(other_tmp_fn); tmp_files.add(other_tmp_fn);
ffw_save(cur_tmp_fn.c_str()); ffw_save(cur_tmp_fn.c_str());

View File

@ -140,7 +140,7 @@ void parse_options (int argc, char **argv)
// fonts // fonts
.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-format", &param.font_format, "ttf", "suffix for embedded font files (ttf,otf,woff,svg)") .add("font-format", &param.font_format, "woff", "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("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)")