mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
unify asc/dsc for ff/chrome, need more work
This commit is contained in:
parent
d72c5123e8
commit
6916ffb91b
@ -18,6 +18,6 @@ void BackgroundRenderer::drawChar(GfxState *state, double x, double y,
|
|||||||
double originX, double originY,
|
double originX, double originY,
|
||||||
CharCode code, int nBytes, Unicode *u, int uLen)
|
CharCode code, int nBytes, Unicode *u, int uLen)
|
||||||
{
|
{
|
||||||
// SplashOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code, nBytes, u, uLen);
|
SplashOutputDev::drawChar(state,x,y,dx,dy,originX,originY,code, nBytes, u, uLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,9 +251,9 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
|
|||||||
if(ctu)
|
if(ctu)
|
||||||
ctu->decRefCnt();
|
ctu->decRefCnt();
|
||||||
|
|
||||||
auto dest = ((param->single_html ? tmp_dir : dest_dir) / (fn+".ttf"));
|
auto dest = ((param->single_html ? tmp_dir : dest_dir) / (fn+(param->font_suffix)));
|
||||||
if(param->single_html)
|
if(param->single_html)
|
||||||
add_tmp_file(fn+".ttf");
|
add_tmp_file(fn+(param->font_suffix));
|
||||||
|
|
||||||
script_fout << format("Generate(%1%)") % dest << endl;
|
script_fout << format("Generate(%1%)") % dest << endl;
|
||||||
script_fout << "Close()" << endl;
|
script_fout << "Close()" << endl;
|
||||||
@ -267,6 +267,17 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Firefox & Chrome interprets the values in different ways
|
||||||
|
* Trying to unify them
|
||||||
|
*/
|
||||||
|
script_fout << "a=GetOS2Value(\"TypoAscent\")" << endl;
|
||||||
|
script_fout << "d=GetOS2Value(\"TypoDescent\")" << endl;
|
||||||
|
script_fout << "SetOS2Value(\"TypoAscent\", 0)" << endl;
|
||||||
|
script_fout << "SetOS2Value(\"TypoDescent\", -a-d)" << endl;
|
||||||
|
script_fout << format("Generate(%1%)") % dest << endl;
|
||||||
|
|
||||||
if(system((boost::format("fontforge -script %1% 1>%2% 2>%3%") % script_path % (tmp_dir / (fn+".info")) % (tmp_dir / NULL_FILENAME)).str().c_str()) != 0)
|
if(system((boost::format("fontforge -script %1% 1>%2% 2>%3%") % script_path % (tmp_dir / (fn+".info")) % (tmp_dir / NULL_FILENAME)).str().c_str()) != 0)
|
||||||
cerr << "Warning: fontforge failed." << endl;
|
cerr << "Warning: fontforge failed." << endl;
|
||||||
|
|
||||||
@ -302,7 +313,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
|
|||||||
cerr << "Ascent: " << info.ascent << " Descent: " << info.descent << endl;
|
cerr << "Ascent: " << info.ascent << " Descent: " << info.descent << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
export_remote_font(info, ".ttf", "truetype", font);
|
export_remote_font(info, param->font_suffix, param->font_format, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTMLRenderer::install_base_font(GfxFont * font, GfxFontLoc * font_loc, long long fn_id)
|
void HTMLRenderer::install_base_font(GfxFont * font, GfxFontLoc * font_loc, long long fn_id)
|
||||||
|
@ -29,6 +29,8 @@ struct Param
|
|||||||
int single_html;
|
int single_html;
|
||||||
int always_apply_tounicode;
|
int always_apply_tounicode;
|
||||||
|
|
||||||
|
std::string font_suffix, font_format;
|
||||||
|
|
||||||
int debug;
|
int debug;
|
||||||
int clean_tmp;
|
int clean_tmp;
|
||||||
};
|
};
|
||||||
|
@ -74,6 +74,8 @@ po::variables_map parse_options (int argc, char **argv)
|
|||||||
("veps", po::value<double>(¶m.v_eps)->default_value(1.0), "max tolerated vertical offset (in pixels)")
|
("veps", po::value<double>(¶m.v_eps)->default_value(1.0), "max tolerated vertical offset (in pixels)")
|
||||||
("single-html", po::value<int>(¶m.single_html)->default_value(1), "combine everything into one single HTML file")
|
("single-html", po::value<int>(¶m.single_html)->default_value(1), "combine everything into one single HTML file")
|
||||||
("always-apply-tounicode", po::value<int>(¶m.always_apply_tounicode)->default_value(0), "ToUnicode map is ignore for non-TTF fonts unless this switch is on")
|
("always-apply-tounicode", po::value<int>(¶m.always_apply_tounicode)->default_value(0), "ToUnicode map is ignore for non-TTF fonts unless this switch is on")
|
||||||
|
("font-suffix", po::value<string>(¶m.font_suffix)->default_value(".ttf"), "suffix for extracted font files")
|
||||||
|
("font-format", po::value<string>(¶m.font_format)->default_value("truetype"), "format for extracted font files")
|
||||||
("process-nontext", po::value<int>(¶m.process_nontext)->default_value(1), "process nontext objects")
|
("process-nontext", po::value<int>(¶m.process_nontext)->default_value(1), "process nontext objects")
|
||||||
("debug", po::value<int>(¶m.debug)->default_value(0), "output debug information")
|
("debug", po::value<int>(¶m.debug)->default_value(0), "output debug information")
|
||||||
("clean-tmp", po::value<int>(¶m.clean_tmp)->default_value(1), "clean temporary files after processing")
|
("clean-tmp", po::value<int>(¶m.clean_tmp)->default_value(1), "clean temporary files after processing")
|
||||||
|
Loading…
Reference in New Issue
Block a user