mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
new option --process-type3
This commit is contained in:
parent
7c0505ffec
commit
09203f61a4
@ -184,6 +184,13 @@ 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.
|
||||
|
||||
.TP
|
||||
.B --process-type3 <0|1> (Default: 0)
|
||||
If turned on, pdf2htmlEX will try to convert Type 3 fonts such that text can be rendered natively in HTML.
|
||||
Otherwise all text with Type 3 fonts will be rendered as image.
|
||||
|
||||
This feature is highly experimental.
|
||||
|
||||
.SS Text
|
||||
|
||||
.TP
|
||||
|
@ -210,10 +210,10 @@ string HTMLRenderer::dump_type3_font (GfxFont * font, FontInfo & info)
|
||||
tm_transform_bbox(font_matrix, transformed_bbox);
|
||||
double transformed_bbox_width = transformed_bbox[2] - transformed_bbox[0];
|
||||
double transformed_bbox_height = transformed_bbox[3] - transformed_bbox[1];
|
||||
// we want the glyphs is rendered in a box of size around 100 x 100
|
||||
// for rectangles, the longer edge should be 100
|
||||
info.font_size_scale = std::max(transformed_bbox_width, transformed_bbox_height);
|
||||
|
||||
// we want the glyphs is rendered in a box of size around GLYPH_DUMP_EM_SIZE x GLYPH_DUMP_EM_SIZE
|
||||
// for rectangles, the longer edge should be GLYPH_DUMP_EM_SIZE
|
||||
const double GLYPH_DUMP_EM_SIZE = 100.0;
|
||||
double scale = GLYPH_DUMP_EM_SIZE / info.font_size_scale;
|
||||
|
||||
@ -242,6 +242,7 @@ string HTMLRenderer::dump_type3_font (GfxFont * font, FontInfo & info)
|
||||
|
||||
auto glyph_width = ((Gfx8BitFont*)font)->getWidth(code);
|
||||
|
||||
#if 1
|
||||
{
|
||||
// pain the glyph
|
||||
cairo_set_font_face(cr, cur_font->getFontFace());
|
||||
@ -273,8 +274,7 @@ string HTMLRenderer::dump_type3_font (GfxFont * font, FontInfo & info)
|
||||
double dummy = 0;
|
||||
cairo_matrix_transform_distance(&m2, &glyph_width, &dummy);
|
||||
}
|
||||
|
||||
/*
|
||||
#else
|
||||
{
|
||||
// manually draw the char to get the metrics
|
||||
// adapted from _render_type3_glyph of poppler
|
||||
@ -308,6 +308,7 @@ string HTMLRenderer::dump_type3_font (GfxFont * font, FontInfo & info)
|
||||
|
||||
// calculate the position of origin
|
||||
cairo_matrix_transform_point(&ctm, &ox, &oy);
|
||||
oy -= transformed_bbox_height * scale;
|
||||
// calculate glyph width
|
||||
double dummy = 0;
|
||||
cairo_matrix_transform_distance(&ctm, &glyph_width, &dummy);
|
||||
@ -337,7 +338,7 @@ string HTMLRenderer::dump_type3_font (GfxFont * font, FontInfo & info)
|
||||
delete gfx;
|
||||
delete output_dev;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
{
|
||||
auto status = cairo_status(cr);
|
||||
|
@ -146,6 +146,7 @@ void parse_options (int argc, char **argv)
|
||||
.add("stretch-narrow-glyph", ¶m.stretch_narrow_glyph, 0, "stretch narrow glyphs instead of padding them")
|
||||
.add("squeeze-wide-glyph", ¶m.squeeze_wide_glyph, 1, "shrink wide glyphs instead of truncating them")
|
||||
.add("override-fstype", ¶m.override_fstype, 0, "clear the fstype bits in TTF/OTF fonts")
|
||||
.add("process-type3", ¶m.process_type3, 0, "convert Type 3 fonts for web (experimental)")
|
||||
|
||||
// text
|
||||
.add("heps", ¶m.h_eps, 1.0, "horizontal threshold for merging text, in pixels")
|
||||
@ -299,8 +300,13 @@ void check_param()
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
//test
|
||||
param.process_type3 = 1;
|
||||
#if not ENABLE_SVG
|
||||
if(param.process_type3)
|
||||
{
|
||||
cerr << "process-type3 is enabled, however SVG support is not built in this version of pdf2htmlEX." << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
Loading…
Reference in New Issue
Block a user