mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
better scripting; working on encoding
This commit is contained in:
parent
965c5d4c5a
commit
210aef28ac
@ -1,2 +1,3 @@
|
|||||||
Open($1);
|
Open($1);
|
||||||
|
Reencode("unicode");
|
||||||
Generate($1:r+".ttf");
|
Generate($1:r+".ttf");
|
||||||
|
@ -6,11 +6,22 @@ SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"/
|
|||||||
# Execute
|
# Execute
|
||||||
${SCRIPT_DIR}/pdftohtmlEX $*
|
${SCRIPT_DIR}/pdftohtmlEX $*
|
||||||
|
|
||||||
|
echo -n "Converting fonts: "
|
||||||
|
|
||||||
for f in *.ttf; do
|
for f in *.ttf; do
|
||||||
fontforge -script "${SCRIPT_DIR}/convert.pe" $f 2>/dev/null
|
if [ -f $f ]; then
|
||||||
|
fontforge -script "${SCRIPT_DIR}/convert.pe" $f 2>/dev/null
|
||||||
|
echo -n "."
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for f in *.pfa; do
|
for f in *.pfa; do
|
||||||
fontforge -script "${SCRIPT_DIR}/convert.pe" $f 2>/dev/null
|
if [ -f $f ]; then
|
||||||
# rm $f
|
fontforge -script "${SCRIPT_DIR}/convert.pe" $f 2>/dev/null
|
||||||
|
rm $f
|
||||||
|
echo -n "."
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Done."
|
||||||
|
@ -143,20 +143,16 @@ void TextString::addChars(GfxState *state, double x, double y,
|
|||||||
height += dy;
|
height += dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextString::addChar(GfxState *state, double x, double y,
|
void TextString::addUnicodes(GfxState *state, double x, double y,
|
||||||
double dx, double dy, Unicode u)
|
double dx, double dy, Unicode * u, int uLen)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (0 < u && u != 9 && u < 32) // skip non-printable not-tab character
|
if (0 < u && u != 9 && u < 32) // skip non-printable not-tab character
|
||||||
return;
|
return;
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
for(int i = 0; i < uLen; ++i)
|
||||||
if (unicodes.empty())
|
unicodes.push_back(u[i]);
|
||||||
{
|
|
||||||
this->x = x;
|
|
||||||
this->y = y;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
unicodes.push_back(u);
|
|
||||||
|
|
||||||
width += dx;
|
width += dx;
|
||||||
height += dy;
|
height += dy;
|
||||||
@ -226,7 +222,6 @@ void HTMLRenderer::process(PDFDoc *doc)
|
|||||||
delete bg_renderer;
|
delete bg_renderer;
|
||||||
|
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "Done." << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTMLRenderer::startPage(int pageNum, GfxState *state)
|
void HTMLRenderer::startPage(int pageNum, GfxState *state)
|
||||||
@ -459,29 +454,12 @@ void HTMLRenderer::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)
|
||||||
{
|
{
|
||||||
double x1, y1, w1, h1;
|
|
||||||
|
|
||||||
x1 = x;
|
|
||||||
y1 = y;
|
|
||||||
|
|
||||||
// if it is hidden, then return
|
// if it is hidden, then return
|
||||||
if ((state->getRender() & 3) == 3)
|
if ((state->getRender() & 3) == 3)
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
w1 = dx - state->getCharSpace() * state->getHorizScaling(),
|
//cur_string->addChars(state, x, y, dx, dy, code, nBytes);
|
||||||
h1 = dy;
|
cur_string->addUnicodes(state, x, y, dx, dy, u, uLen);
|
||||||
|
|
||||||
cur_string->addChars(state, x1, y1, w1, h1, code, nBytes);
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (uLen != 0) {
|
|
||||||
w1 /= uLen;
|
|
||||||
h1 /= uLen;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < uLen; ++i) {
|
|
||||||
cur_string->addChar(state, x1 + i*w1, y1 + i*h1, w1, h1, u[i]);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
@ -546,11 +524,6 @@ long long HTMLRenderer::install_font(GfxFont * font)
|
|||||||
return new_fn_id;
|
return new_fn_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//debug
|
|
||||||
{
|
|
||||||
std::cerr << "install font: " << new_fn_id << ' ' << font->getID()->num << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
string new_fn = (boost::format("f%|1$x|") % new_fn_id).str();
|
string new_fn = (boost::format("f%|1$x|") % new_fn_id).str();
|
||||||
|
|
||||||
if(font->getType() == fontType3) {
|
if(font->getType() == fontType3) {
|
||||||
|
@ -52,11 +52,9 @@ class TextString
|
|||||||
void addChars(GfxState * state, double x, double y,
|
void addChars(GfxState * state, double x, double y,
|
||||||
double dx, double dy,
|
double dx, double dy,
|
||||||
CharCode code, int nbytes);
|
CharCode code, int nbytes);
|
||||||
|
void addUnicodes(GfxState *state, double x, double y,
|
||||||
// Add a character to the string.
|
|
||||||
void addChar(GfxState *state, double x, double y,
|
|
||||||
double dx, double dy,
|
double dx, double dy,
|
||||||
Unicode u);
|
Unicode *u, int uLen);
|
||||||
double getX() const {return x;}
|
double getX() const {return x;}
|
||||||
double getY() const {return y;}
|
double getY() const {return y;}
|
||||||
double getWidth() const {return width;}
|
double getWidth() const {return width;}
|
||||||
|
Loading…
Reference in New Issue
Block a user