mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
add 'auto-hint'
This commit is contained in:
parent
ec1898cc00
commit
6b60c08c7e
6
TODO
6
TODO
@ -6,14 +6,10 @@ option for tounicode-map
|
|||||||
get unicode from charname using fontforge (test with 'Font' croc.pdf)
|
get unicode from charname using fontforge (test with 'Font' croc.pdf)
|
||||||
also for CID Type 0
|
also for CID Type 0
|
||||||
|
|
||||||
|
|
||||||
round coordinate and check if it'll be faster
|
|
||||||
|
|
||||||
|
|
||||||
add fallback font for ' ', or create glyph for it
|
|
||||||
rename single-html -> embed-font/image/css ...
|
rename single-html -> embed-font/image/css ...
|
||||||
|
|
||||||
argument auto-completion
|
argument auto-completion
|
||||||
|
add fallback font for ' ', or create glyph for it
|
||||||
|
|
||||||
==Future==
|
==Future==
|
||||||
use absolute positioning for long whitespace
|
use absolute positioning for long whitespace
|
||||||
|
@ -94,6 +94,9 @@ Specify a ratio greater than 1 would resolve this issue.
|
|||||||
|
|
||||||
For some versions of Firefox, however, there will be a problem when the font size is too large, in which case a smaller value should be specified here.
|
For some versions of Firefox, however, there will be a problem when the font size is too large, in which case a smaller value should be specified here.
|
||||||
.TP
|
.TP
|
||||||
|
.B --auto-hint <0|1> (Default: 1)
|
||||||
|
If set to 1, hints will be generated for the fonts.
|
||||||
|
.TP
|
||||||
.B --tounicode <-1|0|1> (Default: 0)
|
.B --tounicode <-1|0|1> (Default: 0)
|
||||||
A ToUnicode map may be provided for each font in PDF which indicates the 'meaning' of the characters. However often there is better "ToUnicode" info in Type 0/1 fonts, and sometimes the ToUnicode map provided is wrong.
|
A ToUnicode map may be provided for each font in PDF which indicates the 'meaning' of the characters. However often there is better "ToUnicode" info in Type 0/1 fonts, and sometimes the ToUnicode map provided is wrong.
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
right:0;
|
right:0;
|
||||||
overflow:auto;
|
overflow:auto;
|
||||||
background-color:grey;
|
background-color:grey;
|
||||||
/* for Chrome & Safari */
|
|
||||||
-webkit-text-stroke-width:0.13px;
|
|
||||||
}
|
}
|
||||||
.p {
|
.p {
|
||||||
position:relative;
|
position:relative;
|
||||||
|
@ -161,6 +161,8 @@ string HTMLRenderer::dump_embedded_font (GfxFont * font, long long fn_id)
|
|||||||
void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo & info, bool get_metric_only)
|
void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo & info, bool get_metric_only)
|
||||||
{
|
{
|
||||||
ffw_load_font(filepath.c_str());
|
ffw_load_font(filepath.c_str());
|
||||||
|
if(param->auto_hint)
|
||||||
|
ffw_auto_hint();
|
||||||
|
|
||||||
int * code2GID = nullptr;
|
int * code2GID = nullptr;
|
||||||
int code2GID_len = 0;
|
int code2GID_len = 0;
|
||||||
|
@ -308,5 +308,13 @@ void ffw_set_widths(int * width_list, int mapping_len)
|
|||||||
|
|
||||||
void ffw_auto_hint(void)
|
void ffw_auto_hint(void)
|
||||||
{
|
{
|
||||||
|
// convert to quadratic
|
||||||
|
if(!(cur_fv->sf->layers[ly_fore].order2))
|
||||||
|
{
|
||||||
|
SFCloseAllInstrs(cur_fv->sf);
|
||||||
|
SFConvertToOrder2(cur_fv->sf);
|
||||||
|
}
|
||||||
|
memset(cur_fv->selected, 1, cur_fv->map->enccount);
|
||||||
FVAutoHint(cur_fv);
|
FVAutoHint(cur_fv);
|
||||||
|
FVAutoInstr(cur_fv);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ struct Param
|
|||||||
double h_eps, v_eps;
|
double h_eps, v_eps;
|
||||||
double space_threshold;
|
double space_threshold;
|
||||||
double font_size_multiplier;
|
double font_size_multiplier;
|
||||||
|
int auto_hint;
|
||||||
int tounicode;
|
int tounicode;
|
||||||
int space_as_offset;
|
int space_as_offset;
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ void parse_options (int argc, char **argv)
|
|||||||
.add("veps", ¶m.v_eps, 1.0, "max tolerated vertical offset (in pixels)")
|
.add("veps", ¶m.v_eps, 1.0, "max tolerated vertical offset (in pixels)")
|
||||||
.add("space-threshold", ¶m.space_threshold, (1.0/8), "distance no thiner than (threshold * em) will be considered as a space character")
|
.add("space-threshold", ¶m.space_threshold, (1.0/8), "distance no thiner than (threshold * em) will be considered as a space character")
|
||||||
.add("font-size-multiplier", ¶m.font_size_multiplier, 10.0, "setting a value greater than 1 would increase the rendering accuracy")
|
.add("font-size-multiplier", ¶m.font_size_multiplier, 10.0, "setting a value greater than 1 would increase the rendering accuracy")
|
||||||
|
.add("auto-hint", ¶m.auto_hint, 1, "Whether to generate hints for fonts")
|
||||||
.add("tounicode", ¶m.tounicode, 0, "Specify how to deal with ToUnicode map, 0 for auto, 1 for forced, -1 for disabled")
|
.add("tounicode", ¶m.tounicode, 0, "Specify how to deal with ToUnicode map, 0 for auto, 1 for forced, -1 for disabled")
|
||||||
.add("space-as-offset", ¶m.space_as_offset, 0, "treat space characters as offsets")
|
.add("space-as-offset", ¶m.space_as_offset, 0, "treat space characters as offsets")
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ DIR = 'pdf'
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
with open('out.html','w') as outf:
|
with open('out.html','w') as outf:
|
||||||
outf.write('<html><head><meta charset=\"utf-8\"></head><body><div style="position:absolute;top:0;left:0;width:80%;height:100%;"><iframe width="100%" height="100%" name="pdf"></iframe></div><div style="position:absolute;top:0;right:0;width:20%;height:100%;overflow:auto;text-align:right;">')
|
outf.write('<!DOCTYPE html>\n<html><head><meta charset=\"utf-8\"></head><body><div style="position:absolute;top:0;left:0;width:80%;height:100%;"><iframe width="100%" height="100%" name="pdf"></iframe></div><div style="position:absolute;top:0;right:0;width:20%;height:100%;overflow:auto;text-align:right;">')
|
||||||
|
|
||||||
for f in os.listdir(DIR):
|
for f in os.listdir(DIR):
|
||||||
if not f.lower().endswith('.pdf'):
|
if not f.lower().endswith('.pdf'):
|
||||||
|
Loading…
Reference in New Issue
Block a user