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

fixed the script error

This commit is contained in:
Lu Wang 2012-08-06 01:21:16 +08:00
parent bf5ab11639
commit e53b57f562
2 changed files with 28 additions and 3 deletions

View File

@ -6,6 +6,11 @@ SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"/
# Execute # Execute
${SCRIPT_DIR}/pdftohtmlEX $* ${SCRIPT_DIR}/pdftohtmlEX $*
# for ttf files, convert the encoding
for f in *.ttf; do
fontforge -script "${SCRIPT_DIR}/convert.pe" $f 2>/dev/null
done
# convert to ttf
for f in *.pfa; do for f in *.pfa; do
fontforge -script "${SCRIPT_DIR}/convert.pe" $f 2>/dev/null fontforge -script "${SCRIPT_DIR}/convert.pe" $f 2>/dev/null
rm $f rm $f

View File

@ -394,11 +394,31 @@ void HTMLRenderer::endString(GfxState *state) {
GfxState * cur_state = cur_string -> getState(); GfxState * cur_state = cur_string -> getState();
// fix if font size too small
long long new_fs_id;
long long new_tm_id = 0;
if((cur_font_size < 1) && _is_positive(cur_font_size))
{
new_fs_id = install_font_size(1);
double tmp_text_mat[6];
memcpy(tmp_text_mat, cur_text_mat, sizeof(tmp_text_mat));
tmp_text_mat[0] *= cur_font_size;
tmp_text_mat[3] *= cur_font_size;
new_tm_id = install_transform_matrix(tmp_text_mat);
}
else
{
new_fs_id = cur_fs_id;
new_tm_id = install_transform_matrix(cur_text_mat);
}
// TODO: optimize text matrix search/install // TODO: optimize text matrix search/install
html_fout << boost::format("<div class=\"l f%|1$x| s%|2$x| t%|3$x|\" style=\"") % cur_fn_id % cur_fs_id % install_transform_matrix(cur_text_mat) // TODO: position might not be accurate
<< "bottom:" << cur_string->getY() + cur_state->getFont()->getDescent() * cur_state->getFontSize() << "px;" html_fout << boost::format("<div class=\"l f%|1$x| s%|2$x| t%|3$x|\" style=\"") % cur_fn_id % new_fs_id % new_tm_id
<< "bottom:" << cur_string->getY() << "px;"
<< "left:" << cur_string->getX() << "px;" << "left:" << cur_string->getX() << "px;"
// << "top:" << (pageHeight - cur_string->getY() - cur_state->getFont()->getAscent() * cur_state->getFontSize()) << "px;" << "top:" << (pageHeight - cur_string->getY() - cur_state->getFont()->getAscent() * cur_state->getFontSize()) << "px;"
; ;
// letter & word spacing // letter & word spacing