mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
fix mem issue of 'selected'
This commit is contained in:
parent
7664fb5a79
commit
baf6ad22b6
11
src/ffw.c
11
src/ffw.c
@ -98,6 +98,8 @@ void ffw_fin(void)
|
||||
|
||||
void ffw_load_font(const char * filename)
|
||||
{
|
||||
assert((cur_fv == NULL) && "Previous font is not destroyed");
|
||||
|
||||
char * _filename = strcopy(filename);
|
||||
SplineFont * font = LoadSplineFont(_filename, 1);
|
||||
|
||||
@ -119,14 +121,10 @@ void ffw_load_font(const char * filename)
|
||||
*/
|
||||
void ffw_prepare_font(void)
|
||||
{
|
||||
/*
|
||||
* Disabled, because it causes crashing
|
||||
|
||||
memset(cur_fv->selected, 1, cur_fv->map->enccount);
|
||||
// remove kern
|
||||
FVRemoveKerns(cur_fv);
|
||||
FVRemoveVKerns(cur_fv);
|
||||
*/
|
||||
|
||||
/*
|
||||
* Remove Alternate Unicodes
|
||||
@ -169,6 +167,9 @@ static void ffw_do_reencode(Encoding * encoding, int force)
|
||||
}
|
||||
|
||||
SFReplaceEncodingBDFProps(cur_fv->sf, cur_fv->map);
|
||||
|
||||
free(cur_fv->selected);
|
||||
cur_fv->selected = gcalloc(cur_fv->map->enccount, sizeof(char));
|
||||
}
|
||||
|
||||
void ffw_reencode_glyph_order(void)
|
||||
@ -376,7 +377,7 @@ void ffw_set_widths(int * width_list, int mapping_len,
|
||||
sc->width = width_list[i];
|
||||
}
|
||||
|
||||
for(; i < cur_fv->map->enccount; ++i)
|
||||
for(; i < map->enccount; ++i)
|
||||
cur_fv->selected[i] = 1;
|
||||
|
||||
if(remove_unused)
|
||||
|
@ -4,6 +4,7 @@ DIR = 'pdf'
|
||||
#DIR = '../../pdf.js/test/pdfs'
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
with open('out.html','w') as outf:
|
||||
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;">')
|
||||
@ -12,7 +13,10 @@ with open('out.html','w') as outf:
|
||||
if not f.lower().endswith('.pdf'):
|
||||
continue
|
||||
print f
|
||||
os.system('pdf2htmlEX --dest-dir html --auto-hint=1 --external-hint-tool="ttfautohint" --remove-unused-glyph 1 "%s/%s"' % (DIR,f))
|
||||
if os.system('pdf2htmlEX --dest-dir html --auto-hint=1 --external-hint-tool="ttfautohint" --remove-unused-glyph 0 "%s/%s"' % (DIR,f)) != 0:
|
||||
print "error on ", f
|
||||
sys.exit(-1)
|
||||
|
||||
#os.system('pdf2htmlEX --dest-dir html --process-nontext 0 --css-draw 1 "%s/%s"' % (DIR,f))
|
||||
ff = f[:-3]
|
||||
outf.write('<a href="html/%shtml" target="pdf">%s</a><br/>' % (ff,ff))
|
||||
|
Loading…
Reference in New Issue
Block a user