mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
commit of initial update of pdf2htmlEX to poppler 68
This commit is contained in:
parent
665ddaaa27
commit
356d3f103d
4
.gitignore
vendored
4
.gitignore
vendored
@ -18,3 +18,7 @@ src/pdf2htmlEX-config.h
|
||||
src/util/css_const.h
|
||||
test export-ignore
|
||||
Testing/*
|
||||
DartConfiguration.tcl
|
||||
test/test.py
|
||||
*.swp
|
||||
|
||||
|
66
3rdparty/poppler/git/CairoFontEngine.cc
vendored
66
3rdparty/poppler/git/CairoFontEngine.cc
vendored
@ -17,7 +17,7 @@
|
||||
// Copyright (C) 2005-2007 Jeff Muizelaar <jeff@infidigm.net>
|
||||
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com>
|
||||
// Copyright (C) 2005 Martin Kretzschmar <martink@gnome.org>
|
||||
// Copyright (C) 2005, 2009, 2012, 2013, 2015, 2017 Albert Astals Cid <aacid@kde.org>
|
||||
// Copyright (C) 2005, 2009, 2012, 2013, 2015, 2017, 2018 Albert Astals Cid <aacid@kde.org>
|
||||
// Copyright (C) 2006, 2007, 2010, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
|
||||
// Copyright (C) 2007 Koji Otani <sho@bbr.jp>
|
||||
// Copyright (C) 2008, 2009 Chris Wilson <chris@chris-wilson.co.uk>
|
||||
@ -69,17 +69,17 @@
|
||||
// CairoFont
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
CairoFont::CairoFont(Ref ref,
|
||||
cairo_font_face_t *cairo_font_face,
|
||||
int *codeToGID,
|
||||
Guint codeToGIDLen,
|
||||
GBool substitute,
|
||||
GBool printing) : ref(ref),
|
||||
cairo_font_face(cairo_font_face),
|
||||
codeToGID(codeToGID),
|
||||
codeToGIDLen(codeToGIDLen),
|
||||
substitute(substitute),
|
||||
printing(printing) { }
|
||||
CairoFont::CairoFont(Ref refA,
|
||||
cairo_font_face_t *cairo_font_faceA,
|
||||
int *codeToGIDA,
|
||||
Guint codeToGIDLenA,
|
||||
GBool substituteA,
|
||||
GBool printingA) : ref(refA),
|
||||
cairo_font_face(cairo_font_faceA),
|
||||
codeToGID(codeToGIDA),
|
||||
codeToGIDLen(codeToGIDLenA),
|
||||
substitute(substituteA),
|
||||
printing(printingA) { }
|
||||
|
||||
CairoFont::~CairoFont() {
|
||||
cairo_font_face_destroy (cairo_font_face);
|
||||
@ -378,22 +378,21 @@ _ft_new_face (FT_Library lib,
|
||||
#define _ft_new_face _ft_new_face_uncached
|
||||
#endif
|
||||
|
||||
CairoFreeTypeFont::CairoFreeTypeFont(Ref ref,
|
||||
cairo_font_face_t *cairo_font_face,
|
||||
int *codeToGID,
|
||||
Guint codeToGIDLen,
|
||||
GBool substitute) : CairoFont(ref,
|
||||
cairo_font_face,
|
||||
codeToGID,
|
||||
codeToGIDLen,
|
||||
substitute,
|
||||
CairoFreeTypeFont::CairoFreeTypeFont(Ref refA,
|
||||
cairo_font_face_t *cairo_font_faceA,
|
||||
int *codeToGIDA,
|
||||
Guint codeToGIDLenA,
|
||||
GBool substituteA) : CairoFont(refA,
|
||||
cairo_font_faceA,
|
||||
codeToGIDA,
|
||||
codeToGIDLenA,
|
||||
substituteA,
|
||||
gTrue) { }
|
||||
|
||||
CairoFreeTypeFont::~CairoFreeTypeFont() { }
|
||||
|
||||
CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref,
|
||||
FT_Library lib, GBool useCIDs) {
|
||||
Object refObj, strObj;
|
||||
GooString *fileName;
|
||||
char *fileNameC;
|
||||
char *font_data;
|
||||
@ -735,7 +734,6 @@ _render_type3_glyph (cairo_scaled_font_t *scaled_font,
|
||||
CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc,
|
||||
CairoFontEngine *fontEngine,
|
||||
GBool printing, XRef *xref) {
|
||||
Object refObj, strObj;
|
||||
type3_font_info_t *info;
|
||||
cairo_font_face_t *font_face;
|
||||
Ref ref;
|
||||
@ -778,18 +776,18 @@ CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc,
|
||||
return new CairoType3Font(ref, doc, font_face, codeToGID, codeToGIDLen, printing, xref);
|
||||
}
|
||||
|
||||
CairoType3Font::CairoType3Font(Ref ref,
|
||||
PDFDoc *doc,
|
||||
cairo_font_face_t *cairo_font_face,
|
||||
int *codeToGID,
|
||||
Guint codeToGIDLen,
|
||||
GBool printing, XRef *xref) : CairoFont(ref,
|
||||
cairo_font_face,
|
||||
codeToGID,
|
||||
codeToGIDLen,
|
||||
CairoType3Font::CairoType3Font(Ref refA,
|
||||
PDFDoc *docA,
|
||||
cairo_font_face_t *cairo_font_faceA,
|
||||
int *codeToGIDA,
|
||||
Guint codeToGIDLenA,
|
||||
GBool printingA, XRef *xref) : CairoFont(refA,
|
||||
cairo_font_faceA,
|
||||
codeToGIDA,
|
||||
codeToGIDLenA,
|
||||
gFalse,
|
||||
printing),
|
||||
doc(doc) { }
|
||||
printingA),
|
||||
doc(docA) { }
|
||||
|
||||
CairoType3Font::~CairoType3Font() { }
|
||||
|
||||
|
22
3rdparty/poppler/git/CairoOutputDev.cc
vendored
22
3rdparty/poppler/git/CairoOutputDev.cc
vendored
@ -16,9 +16,9 @@
|
||||
//
|
||||
// Copyright (C) 2005-2008 Jeff Muizelaar <jeff@infidigm.net>
|
||||
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com>
|
||||
// Copyright (C) 2005, 2009, 2012, 2017 Albert Astals Cid <aacid@kde.org>
|
||||
// Copyright (C) 2005, 2009, 2012, 2017, 2018 Albert Astals Cid <aacid@kde.org>
|
||||
// Copyright (C) 2005 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
|
||||
// Copyright (C) 2006-2011, 2013, 2014, 2017 Carlos Garcia Campos <carlosgc@gnome.org>
|
||||
// Copyright (C) 2006-2011, 2013, 2014, 2017, 2018 Carlos Garcia Campos <carlosgc@gnome.org>
|
||||
// Copyright (C) 2008 Carl Worth <cworth@cworth.org>
|
||||
// Copyright (C) 2008-2017 Adrian Johnson <ajohnson@redneon.com>
|
||||
// Copyright (C) 2008 Michael Vrable <mvrable@cs.ucsd.edu>
|
||||
@ -29,6 +29,7 @@
|
||||
// Copyright (C) 2012 Patrick Pfeifer <p2000@mailinator.com>
|
||||
// Copyright (C) 2012, 2015, 2016 Jason Crain <jason@aquaticape.us>
|
||||
// Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich
|
||||
//
|
||||
// To see a description of the changes please see the Changelog file that
|
||||
// came with your tarball or type make ChangeLog if you are building from git
|
||||
@ -959,7 +960,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat
|
||||
adjusted_stroke_width_tmp = adjusted_stroke_width;
|
||||
maskTmp = mask;
|
||||
mask = nullptr;
|
||||
gfx = new Gfx(doc, this, resDict, &box, nullptr, nullptr, nullptr, gfxA->getXRef());
|
||||
gfx = new Gfx(doc, this, resDict, &box, nullptr, nullptr, nullptr, gfxA);
|
||||
if (paintType == 2)
|
||||
inUncoloredPattern = gTrue;
|
||||
gfx->display(str);
|
||||
@ -1379,7 +1380,7 @@ void CairoOutputDev::fillToStrokePathClip(GfxState *state) {
|
||||
cairo_restore (cairo);
|
||||
}
|
||||
|
||||
void CairoOutputDev::beginString(GfxState *state, GooString *s)
|
||||
void CairoOutputDev::beginString(GfxState *state, const GooString *s)
|
||||
{
|
||||
int len = s->getLength();
|
||||
|
||||
@ -1588,7 +1589,7 @@ void CairoOutputDev::endTextObject(GfxState *state) {
|
||||
}
|
||||
}
|
||||
|
||||
void CairoOutputDev::beginActualText(GfxState *state, GooString *text)
|
||||
void CairoOutputDev::beginActualText(GfxState *state, const GooString *text)
|
||||
{
|
||||
if (this->text)
|
||||
actualText->begin(state, text);
|
||||
@ -1970,7 +1971,7 @@ CairoOutputDev::getFilterForSurface(cairo_surface_t *image,
|
||||
GBool interpolate)
|
||||
{
|
||||
if (interpolate)
|
||||
return CAIRO_FILTER_BEST;
|
||||
return CAIRO_FILTER_GOOD;
|
||||
|
||||
int orig_width = cairo_image_surface_get_width (image);
|
||||
int orig_height = cairo_image_surface_get_height (image);
|
||||
@ -1990,7 +1991,7 @@ CairoOutputDev::getFilterForSurface(cairo_surface_t *image,
|
||||
if (scaled_width / orig_width >= 4 || scaled_height / orig_height >= 4)
|
||||
return CAIRO_FILTER_NEAREST;
|
||||
|
||||
return CAIRO_FILTER_BEST;
|
||||
return CAIRO_FILTER_GOOD;
|
||||
}
|
||||
|
||||
void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
|
||||
@ -2458,7 +2459,7 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream
|
||||
* cairo doesn't yet do minifaction filtering causing scaled down
|
||||
* images with CAIRO_FILTER_NEAREST to look really bad */
|
||||
cairo_pattern_set_filter (pattern,
|
||||
interpolate ? CAIRO_FILTER_BEST : CAIRO_FILTER_FAST);
|
||||
interpolate ? CAIRO_FILTER_GOOD : CAIRO_FILTER_FAST);
|
||||
|
||||
if (state->getFillColorSpace()->getMode() == csPattern) {
|
||||
cairo_matrix_init_translate (&matrix, 0, scaledHeight);
|
||||
@ -3193,7 +3194,6 @@ public:
|
||||
}
|
||||
|
||||
void getRow(int row_num, uint32_t *row_data) override {
|
||||
int i;
|
||||
Guchar *pix;
|
||||
|
||||
if (row_num <= current_row)
|
||||
@ -3214,7 +3214,7 @@ public:
|
||||
Guchar *p = pix;
|
||||
GfxRGB rgb;
|
||||
|
||||
for (i = 0; i < width; i++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
rgb = lookup[*p];
|
||||
row_data[i] =
|
||||
((int) colToByte(rgb.r) << 16) |
|
||||
@ -3259,7 +3259,7 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
|
||||
cairo_matrix_t matrix;
|
||||
int width, height;
|
||||
int scaledWidth, scaledHeight;
|
||||
cairo_filter_t filter = CAIRO_FILTER_BEST;
|
||||
cairo_filter_t filter = CAIRO_FILTER_GOOD;
|
||||
RescaleDrawImage rescale;
|
||||
|
||||
LOG (printf ("drawImage %dx%d\n", widthA, heightA));
|
||||
|
13
3rdparty/poppler/git/CairoOutputDev.h
vendored
13
3rdparty/poppler/git/CairoOutputDev.h
vendored
@ -18,12 +18,13 @@
|
||||
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com>
|
||||
// Copyright (C) 2005 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
|
||||
// Copyright (C) 2006-2011, 2013 Carlos Garcia Campos <carlosgc@gnome.org>
|
||||
// Copyright (C) 2008, 2009, 2011-2016 Adrian Johnson <ajohnson@redneon.com>
|
||||
// Copyright (C) 2008, 2009, 2011-2017 Adrian Johnson <ajohnson@redneon.com>
|
||||
// Copyright (C) 2008 Michael Vrable <mvrable@cs.ucsd.edu>
|
||||
// Copyright (C) 2010-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
|
||||
// Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
||||
// Copyright (C) 2016 Jason Crain <jason@aquaticape.us>
|
||||
// Copyright (C) 2018 Albert Astals Cid <aacid@kde.org>
|
||||
// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich
|
||||
//
|
||||
// To see a description of the changes please see the Changelog file that
|
||||
// came with your tarball or type make ChangeLog if you are building from git
|
||||
@ -191,13 +192,13 @@ public:
|
||||
void eoClip(GfxState *state) override;
|
||||
|
||||
//----- text drawing
|
||||
void beginString(GfxState *state, GooString *s) override;
|
||||
void beginString(GfxState *state, const GooString *s) override;
|
||||
void endString(GfxState *state) override;
|
||||
void drawChar(GfxState *state, double x, double y,
|
||||
double dx, double dy,
|
||||
double originX, double originY,
|
||||
CharCode code, int nBytes, Unicode *u, int uLen) override;
|
||||
void beginActualText(GfxState *state, GooString *text) override;
|
||||
void beginActualText(GfxState *state, const GooString *text) override;
|
||||
void endActualText(GfxState *state) override;
|
||||
|
||||
GBool beginType3Char(GfxState *state, double x, double y,
|
||||
@ -269,10 +270,10 @@ public:
|
||||
|
||||
void setCairo (cairo_t *cr);
|
||||
void setTextPage (TextPage *text);
|
||||
void setPrinting (GBool printing) { this->printing = printing; needFontUpdate = gTrue; }
|
||||
void setPrinting (GBool printingA) { printing = printingA; needFontUpdate = gTrue; }
|
||||
void setAntialias(cairo_antialias_t antialias);
|
||||
|
||||
void setInType3Char(GBool inType3Char) { this->inType3Char = inType3Char; }
|
||||
void setInType3Char(GBool inType3CharA) { inType3Char = inType3CharA; }
|
||||
void getType3GlyphWidth (double *wx, double *wy) { *wx = t3_glyph_wx; *wy = t3_glyph_wy; }
|
||||
GBool hasType3GlyphBBox () { return t3_glyph_has_bbox; }
|
||||
double *getType3GlyphBBox () { return t3_glyph_bbox; }
|
||||
@ -335,7 +336,6 @@ protected:
|
||||
GBool printing;
|
||||
GBool use_show_text_glyphs;
|
||||
GBool text_matrix_valid;
|
||||
cairo_surface_t *surface;
|
||||
cairo_glyph_t *glyphs;
|
||||
int glyphCount;
|
||||
cairo_text_cluster_t *clusters;
|
||||
@ -359,7 +359,6 @@ protected:
|
||||
cairo_pattern_t *shape;
|
||||
cairo_pattern_t *mask;
|
||||
cairo_matrix_t mask_matrix;
|
||||
cairo_surface_t *cairo_shape_surface;
|
||||
cairo_t *cairo_shape;
|
||||
int knockoutCount;
|
||||
struct ColorSpaceStack {
|
||||
|
@ -170,7 +170,7 @@ protected:
|
||||
void post_process(void);
|
||||
|
||||
void process_outline(void);
|
||||
void process_outline_items(GooList * items);
|
||||
void process_outline_items(const GooList * items);
|
||||
|
||||
void process_form(std::ofstream & out);
|
||||
|
||||
@ -179,7 +179,7 @@ protected:
|
||||
void dump_css(void);
|
||||
|
||||
// convert a LinkAction to a string that our Javascript code can understand
|
||||
std::string get_linkaction_str(LinkAction *, std::string & detail);
|
||||
std::string get_linkaction_str(const LinkAction *, std::string & detail);
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/*
|
||||
|
@ -634,7 +634,9 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
|
||||
Unicode u, *pu=&u;
|
||||
if(info.use_tounicode)
|
||||
{
|
||||
int n = ctu ? (ctu->mapToUnicode(cur_code, &pu)) : 0;
|
||||
int n = ctu ?
|
||||
(((CharCodeToUnicode *)ctu)->mapToUnicode(cur_code, &pu)) :
|
||||
0;
|
||||
u = check_unicode(pu, n, cur_code, font);
|
||||
}
|
||||
else
|
||||
@ -756,7 +758,7 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
|
||||
}
|
||||
|
||||
if(ctu)
|
||||
ctu->decRefCnt();
|
||||
((CharCodeToUnicode *)ctu)->decRefCnt();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -126,7 +126,7 @@ static string get_linkdest_detail_str(LinkDest * dest, Catalog * catalog, int &
|
||||
return sout.str();
|
||||
}
|
||||
|
||||
string HTMLRenderer::get_linkaction_str(LinkAction * action, string & detail)
|
||||
string HTMLRenderer::get_linkaction_str(const LinkAction * action, string & detail)
|
||||
{
|
||||
string dest_str;
|
||||
detail = "";
|
||||
@ -137,7 +137,7 @@ string HTMLRenderer::get_linkaction_str(LinkAction * action, string & detail)
|
||||
{
|
||||
case actionGoTo:
|
||||
{
|
||||
auto * real_action = dynamic_cast<LinkGoTo*>(action);
|
||||
auto * real_action = dynamic_cast<const LinkGoTo*>(action);
|
||||
LinkDest * dest = nullptr;
|
||||
if(auto _ = real_action->getDest())
|
||||
dest = _->copy();
|
||||
@ -162,7 +162,7 @@ string HTMLRenderer::get_linkaction_str(LinkAction * action, string & detail)
|
||||
break;
|
||||
case actionURI:
|
||||
{
|
||||
auto * real_action = dynamic_cast<LinkURI*>(action);
|
||||
auto * real_action = dynamic_cast<const LinkURI*>(action);
|
||||
assert(real_action != nullptr);
|
||||
dest_str = real_action->getURI()->getCString();
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace pdf2htmlEX {
|
||||
|
||||
using std::ostream;
|
||||
|
||||
void HTMLRenderer::process_outline_items(GooList * items)
|
||||
void HTMLRenderer::process_outline_items(const GooList * items)
|
||||
{
|
||||
if((!items) || (items->getLength() == 0))
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user