1
0
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:
Stephen Gaito 2019-05-06 13:03:24 +01:00
parent 665ddaaa27
commit 356d3f103d
8 changed files with 90 additions and 87 deletions

4
.gitignore vendored
View File

@ -18,3 +18,7 @@ src/pdf2htmlEX-config.h
src/util/css_const.h src/util/css_const.h
test export-ignore test export-ignore
Testing/* Testing/*
DartConfiguration.tcl
test/test.py
*.swp

View File

@ -17,7 +17,7 @@
// Copyright (C) 2005-2007 Jeff Muizelaar <jeff@infidigm.net> // Copyright (C) 2005-2007 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com> // Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2005 Martin Kretzschmar <martink@gnome.org> // 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) 2006, 2007, 2010, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2007 Koji Otani <sho@bbr.jp> // Copyright (C) 2007 Koji Otani <sho@bbr.jp>
// Copyright (C) 2008, 2009 Chris Wilson <chris@chris-wilson.co.uk> // Copyright (C) 2008, 2009 Chris Wilson <chris@chris-wilson.co.uk>
@ -69,17 +69,17 @@
// CairoFont // CairoFont
//------------------------------------------------------------------------ //------------------------------------------------------------------------
CairoFont::CairoFont(Ref ref, CairoFont::CairoFont(Ref refA,
cairo_font_face_t *cairo_font_face, cairo_font_face_t *cairo_font_faceA,
int *codeToGID, int *codeToGIDA,
Guint codeToGIDLen, Guint codeToGIDLenA,
GBool substitute, GBool substituteA,
GBool printing) : ref(ref), GBool printingA) : ref(refA),
cairo_font_face(cairo_font_face), cairo_font_face(cairo_font_faceA),
codeToGID(codeToGID), codeToGID(codeToGIDA),
codeToGIDLen(codeToGIDLen), codeToGIDLen(codeToGIDLenA),
substitute(substitute), substitute(substituteA),
printing(printing) { } printing(printingA) { }
CairoFont::~CairoFont() { CairoFont::~CairoFont() {
cairo_font_face_destroy (cairo_font_face); 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 #define _ft_new_face _ft_new_face_uncached
#endif #endif
CairoFreeTypeFont::CairoFreeTypeFont(Ref ref, CairoFreeTypeFont::CairoFreeTypeFont(Ref refA,
cairo_font_face_t *cairo_font_face, cairo_font_face_t *cairo_font_faceA,
int *codeToGID, int *codeToGIDA,
Guint codeToGIDLen, Guint codeToGIDLenA,
GBool substitute) : CairoFont(ref, GBool substituteA) : CairoFont(refA,
cairo_font_face, cairo_font_faceA,
codeToGID, codeToGIDA,
codeToGIDLen, codeToGIDLenA,
substitute, substituteA,
gTrue) { } gTrue) { }
CairoFreeTypeFont::~CairoFreeTypeFont() { } CairoFreeTypeFont::~CairoFreeTypeFont() { }
CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref,
FT_Library lib, GBool useCIDs) { FT_Library lib, GBool useCIDs) {
Object refObj, strObj;
GooString *fileName; GooString *fileName;
char *fileNameC; char *fileNameC;
char *font_data; char *font_data;
@ -411,7 +410,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref,
int *codeToGID; int *codeToGID;
Guint codeToGIDLen; Guint codeToGIDLen;
codeToGID = nullptr; codeToGID = nullptr;
codeToGIDLen = 0; codeToGIDLen = 0;
font_data = nullptr; font_data = nullptr;
@ -420,7 +419,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref,
fileNameC = nullptr; fileNameC = nullptr;
GBool substitute = gFalse; GBool substitute = gFalse;
ref = *gfxFont->getID(); ref = *gfxFont->getID();
fontType = gfxFont->getType(); fontType = gfxFont->getType();
@ -456,9 +455,9 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref,
error(errSyntaxError, -1, "could not create type1 face"); error(errSyntaxError, -1, "could not create type1 face");
goto err2; goto err2;
} }
enc = ((Gfx8BitFont *)gfxFont)->getEncoding(); enc = ((Gfx8BitFont *)gfxFont)->getEncoding();
codeToGID = (int *)gmallocn(256, sizeof(int)); codeToGID = (int *)gmallocn(256, sizeof(int));
codeToGIDLen = 256; codeToGIDLen = 256;
for (i = 0; i < 256; ++i) { for (i = 0; i < 256; ++i) {
@ -525,7 +524,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref,
goto err2; goto err2;
} }
break; break;
case fontCIDType0: case fontCIDType0:
case fontCIDType0C: case fontCIDType0C:
@ -735,7 +734,6 @@ _render_type3_glyph (cairo_scaled_font_t *scaled_font,
CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc, CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc,
CairoFontEngine *fontEngine, CairoFontEngine *fontEngine,
GBool printing, XRef *xref) { GBool printing, XRef *xref) {
Object refObj, strObj;
type3_font_info_t *info; type3_font_info_t *info;
cairo_font_face_t *font_face; cairo_font_face_t *font_face;
Ref ref; Ref ref;
@ -778,18 +776,18 @@ CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc,
return new CairoType3Font(ref, doc, font_face, codeToGID, codeToGIDLen, printing, xref); return new CairoType3Font(ref, doc, font_face, codeToGID, codeToGIDLen, printing, xref);
} }
CairoType3Font::CairoType3Font(Ref ref, CairoType3Font::CairoType3Font(Ref refA,
PDFDoc *doc, PDFDoc *docA,
cairo_font_face_t *cairo_font_face, cairo_font_face_t *cairo_font_faceA,
int *codeToGID, int *codeToGIDA,
Guint codeToGIDLen, Guint codeToGIDLenA,
GBool printing, XRef *xref) : CairoFont(ref, GBool printingA, XRef *xref) : CairoFont(refA,
cairo_font_face, cairo_font_faceA,
codeToGID, codeToGIDA,
codeToGIDLen, codeToGIDLenA,
gFalse, gFalse,
printing), printingA),
doc(doc) { } doc(docA) { }
CairoType3Font::~CairoType3Font() { } CairoType3Font::~CairoType3Font() { }
@ -810,7 +808,7 @@ CairoFontEngine::CairoFontEngine(FT_Library libA) {
for (i = 0; i < cairoFontCacheSize; ++i) { for (i = 0; i < cairoFontCacheSize; ++i) {
fontCache[i] = nullptr; fontCache[i] = nullptr;
} }
FT_Int major, minor, patch; FT_Int major, minor, patch;
// as of FT 2.1.8, CID fonts are indexed by CID instead of GID // as of FT 2.1.8, CID fonts are indexed by CID instead of GID
FT_Library_Version(lib, &major, &minor, &patch); FT_Library_Version(lib, &major, &minor, &patch);
@ -823,7 +821,7 @@ CairoFontEngine::CairoFontEngine(FT_Library libA) {
CairoFontEngine::~CairoFontEngine() { CairoFontEngine::~CairoFontEngine() {
int i; int i;
for (i = 0; i < cairoFontCacheSize; ++i) { for (i = 0; i < cairoFontCacheSize; ++i) {
if (fontCache[i]) if (fontCache[i])
delete fontCache[i]; delete fontCache[i];
@ -839,7 +837,7 @@ CairoFontEngine::getFont(GfxFont *gfxFont, PDFDoc *doc, GBool printing, XRef *xr
Ref ref; Ref ref;
CairoFont *font; CairoFont *font;
GfxFontType fontType; GfxFontType fontType;
fontEngineLocker(); fontEngineLocker();
ref = *gfxFont->getID(); ref = *gfxFont->getID();
@ -853,7 +851,7 @@ CairoFontEngine::getFont(GfxFont *gfxFont, PDFDoc *doc, GBool printing, XRef *xr
return font; return font;
} }
} }
fontType = gfxFont->getType(); fontType = gfxFont->getType();
if (fontType == fontType3) if (fontType == fontType3)
font = CairoType3Font::create (gfxFont, doc, this, printing, xref); font = CairoType3Font::create (gfxFont, doc, this, printing, xref);

View File

@ -16,9 +16,9 @@
// //
// Copyright (C) 2005-2008 Jeff Muizelaar <jeff@infidigm.net> // Copyright (C) 2005-2008 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com> // 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) 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 Carl Worth <cworth@cworth.org>
// Copyright (C) 2008-2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2008-2017 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2008 Michael Vrable <mvrable@cs.ucsd.edu> // Copyright (C) 2008 Michael Vrable <mvrable@cs.ucsd.edu>
@ -29,6 +29,7 @@
// Copyright (C) 2012 Patrick Pfeifer <p2000@mailinator.com> // Copyright (C) 2012 Patrick Pfeifer <p2000@mailinator.com>
// Copyright (C) 2012, 2015, 2016 Jason Crain <jason@aquaticape.us> // Copyright (C) 2012, 2015, 2016 Jason Crain <jason@aquaticape.us>
// Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> // 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 // 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 // came with your tarball or type make ChangeLog if you are building from git
@ -195,10 +196,10 @@ CairoOutputDev::~CairoOutputDev() {
cairo_pattern_destroy (mask); cairo_pattern_destroy (mask);
if (shape) if (shape)
cairo_pattern_destroy (shape); cairo_pattern_destroy (shape);
if (text) if (text)
text->decRefCnt(); text->decRefCnt();
if (actualText) if (actualText)
delete actualText; delete actualText;
} }
void CairoOutputDev::setCairo(cairo_t *cairo) void CairoOutputDev::setCairo(cairo_t *cairo)
@ -225,7 +226,7 @@ void CairoOutputDev::setCairo(cairo_t *cairo)
void CairoOutputDev::setTextPage(TextPage *text) void CairoOutputDev::setTextPage(TextPage *text)
{ {
if (this->text) if (this->text)
this->text->decRefCnt(); this->text->decRefCnt();
if (actualText) if (actualText)
delete actualText; delete actualText;
@ -669,7 +670,7 @@ void CairoOutputDev::updateFont(GfxState *state) {
//FIXME: use cairo font engine? //FIXME: use cairo font engine?
if (text) if (text)
text->updateFont(state); text->updateFont(state);
currentFont = fontEngine->getFont (state->getFont(), doc, printing, xref); currentFont = fontEngine->getFont (state->getFont(), doc, printing, xref);
if (!currentFont) if (!currentFont)
@ -680,7 +681,7 @@ void CairoOutputDev::updateFont(GfxState *state) {
use_show_text_glyphs = state->getFont()->hasToUnicodeCMap() && use_show_text_glyphs = state->getFont()->hasToUnicodeCMap() &&
cairo_surface_has_show_text_glyphs (cairo_get_target (cairo)); cairo_surface_has_show_text_glyphs (cairo_get_target (cairo));
double fontSize = state->getFontSize(); double fontSize = state->getFontSize();
double *m = state->getTextMat(); double *m = state->getTextMat();
/* NOTE: adjusting by a constant is hack. The correct solution /* NOTE: adjusting by a constant is hack. The correct solution
@ -959,7 +960,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat
adjusted_stroke_width_tmp = adjusted_stroke_width; adjusted_stroke_width_tmp = adjusted_stroke_width;
maskTmp = mask; maskTmp = mask;
mask = nullptr; 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) if (paintType == 2)
inUncoloredPattern = gTrue; inUncoloredPattern = gTrue;
gfx->display(str); gfx->display(str);
@ -1379,7 +1380,7 @@ void CairoOutputDev::fillToStrokePathClip(GfxState *state) {
cairo_restore (cairo); cairo_restore (cairo);
} }
void CairoOutputDev::beginString(GfxState *state, GooString *s) void CairoOutputDev::beginString(GfxState *state, const GooString *s)
{ {
int len = s->getLength(); int len = s->getLength();
@ -1493,11 +1494,11 @@ void CairoOutputDev::endString(GfxState *state)
} }
cairo_path_destroy (textClipPath); cairo_path_destroy (textClipPath);
} }
// append the glyph path // append the glyph path
cairo_glyph_path (cairo, glyphs, glyphCount); cairo_glyph_path (cairo, glyphs, glyphCount);
// move the path back into textClipPath // move the path back into textClipPath
// and clear the current path // and clear the current path
textClipPath = cairo_copy_path (cairo); textClipPath = cairo_copy_path (cairo);
cairo_new_path (cairo); cairo_new_path (cairo);
@ -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) if (this->text)
actualText->begin(state, text); actualText->begin(state, text);
@ -1970,7 +1971,7 @@ CairoOutputDev::getFilterForSurface(cairo_surface_t *image,
GBool interpolate) GBool interpolate)
{ {
if (interpolate) if (interpolate)
return CAIRO_FILTER_BEST; return CAIRO_FILTER_GOOD;
int orig_width = cairo_image_surface_get_width (image); int orig_width = cairo_image_surface_get_width (image);
int orig_height = cairo_image_surface_get_height (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) if (scaled_width / orig_width >= 4 || scaled_height / orig_height >= 4)
return CAIRO_FILTER_NEAREST; return CAIRO_FILTER_NEAREST;
return CAIRO_FILTER_BEST; return CAIRO_FILTER_GOOD;
} }
void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
@ -2033,7 +2034,7 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
cairo_matrix_t matrix; cairo_matrix_t matrix;
cairo_get_matrix (cairo, &matrix); cairo_get_matrix (cairo, &matrix);
//XXX: it is possible that we should only do sub pixel positioning if //XXX: it is possible that we should only do sub pixel positioning if
// we are rendering fonts */ // we are rendering fonts */
if (!printing && prescaleImages if (!printing && prescaleImages
/* not rotated */ /* not rotated */
@ -2086,7 +2087,7 @@ void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stre
cairo_matrix_t matrix; cairo_matrix_t matrix;
cairo_get_matrix (cairo, &matrix); cairo_get_matrix (cairo, &matrix);
//XXX: it is possible that we should only do sub pixel positioning if //XXX: it is possible that we should only do sub pixel positioning if
// we are rendering fonts */ // we are rendering fonts */
if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) { if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) {
drawImageMaskPrescaled(state, ref, str, width, height, invert, gFalse, inlineImg); drawImageMaskPrescaled(state, ref, str, width, height, invert, gFalse, inlineImg);
@ -2458,7 +2459,7 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream
* cairo doesn't yet do minifaction filtering causing scaled down * cairo doesn't yet do minifaction filtering causing scaled down
* images with CAIRO_FILTER_NEAREST to look really bad */ * images with CAIRO_FILTER_NEAREST to look really bad */
cairo_pattern_set_filter (pattern, cairo_pattern_set_filter (pattern,
interpolate ? CAIRO_FILTER_BEST : CAIRO_FILTER_FAST); interpolate ? CAIRO_FILTER_GOOD : CAIRO_FILTER_FAST);
if (state->getFillColorSpace()->getMode() == csPattern) { if (state->getFillColorSpace()->getMode() == csPattern) {
cairo_matrix_init_translate (&matrix, 0, scaledHeight); cairo_matrix_init_translate (&matrix, 0, scaledHeight);
@ -2588,7 +2589,7 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref,
* so check its underlying color space as well */ * so check its underlying color space as well */
int is_identity_transform; int is_identity_transform;
is_identity_transform = colorMap->getColorSpace()->getMode() == csDeviceRGB || is_identity_transform = colorMap->getColorSpace()->getMode() == csDeviceRGB ||
(colorMap->getColorSpace()->getMode() == csICCBased && (colorMap->getColorSpace()->getMode() == csICCBased &&
((GfxICCBasedColorSpace*)colorMap->getColorSpace())->getAlt()->getMode() == csDeviceRGB); ((GfxICCBasedColorSpace*)colorMap->getColorSpace())->getAlt()->getMode() == csDeviceRGB);
#endif #endif
@ -3193,7 +3194,6 @@ public:
} }
void getRow(int row_num, uint32_t *row_data) override { void getRow(int row_num, uint32_t *row_data) override {
int i;
Guchar *pix; Guchar *pix;
if (row_num <= current_row) if (row_num <= current_row)
@ -3214,7 +3214,7 @@ public:
Guchar *p = pix; Guchar *p = pix;
GfxRGB rgb; GfxRGB rgb;
for (i = 0; i < width; i++) { for (int i = 0; i < width; i++) {
rgb = lookup[*p]; rgb = lookup[*p];
row_data[i] = row_data[i] =
((int) colToByte(rgb.r) << 16) | ((int) colToByte(rgb.r) << 16) |
@ -3259,7 +3259,7 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
cairo_matrix_t matrix; cairo_matrix_t matrix;
int width, height; int width, height;
int scaledWidth, scaledHeight; int scaledWidth, scaledHeight;
cairo_filter_t filter = CAIRO_FILTER_BEST; cairo_filter_t filter = CAIRO_FILTER_GOOD;
RescaleDrawImage rescale; RescaleDrawImage rescale;
LOG (printf ("drawImage %dx%d\n", widthA, heightA)); LOG (printf ("drawImage %dx%d\n", widthA, heightA));
@ -3372,7 +3372,7 @@ CairoImageOutputDev::~CairoImageOutputDev()
} }
void CairoImageOutputDev::saveImage(CairoImage *image) void CairoImageOutputDev::saveImage(CairoImage *image)
{ {
if (numImages >= size) { if (numImages >= size) {
size += 16; size += 16;
images = (CairoImage **) greallocn (images, size, sizeof (CairoImage *)); images = (CairoImage **) greallocn (images, size, sizeof (CairoImage *));
@ -3491,10 +3491,10 @@ void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
setCairo (cr); setCairo (cr);
cairo_translate (cr, 0, height); cairo_translate (cr, 0, height);
cairo_scale (cr, width, -height); cairo_scale (cr, width, -height);
CairoOutputDev::drawImage(state, ref, str, width, height, colorMap, interpolate, maskColors, inlineImg); CairoOutputDev::drawImage(state, ref, str, width, height, colorMap, interpolate, maskColors, inlineImg);
image->setImage (surface); image->setImage (surface);
setCairo (nullptr); setCairo (nullptr);
cairo_surface_destroy (surface); cairo_surface_destroy (surface);
cairo_destroy (cr); cairo_destroy (cr);
@ -3526,11 +3526,11 @@ void CairoImageOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stre
setCairo (cr); setCairo (cr);
cairo_translate (cr, 0, height); cairo_translate (cr, 0, height);
cairo_scale (cr, width, -height); cairo_scale (cr, width, -height);
CairoOutputDev::drawSoftMaskedImage(state, ref, str, width, height, colorMap, interpolate, CairoOutputDev::drawSoftMaskedImage(state, ref, str, width, height, colorMap, interpolate,
maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate); maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate);
image->setImage (surface); image->setImage (surface);
setCairo (nullptr); setCairo (nullptr);
cairo_surface_destroy (surface); cairo_surface_destroy (surface);
cairo_destroy (cr); cairo_destroy (cr);
@ -3561,11 +3561,11 @@ void CairoImageOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *
setCairo (cr); setCairo (cr);
cairo_translate (cr, 0, height); cairo_translate (cr, 0, height);
cairo_scale (cr, width, -height); cairo_scale (cr, width, -height);
CairoOutputDev::drawMaskedImage(state, ref, str, width, height, colorMap, interpolate, CairoOutputDev::drawMaskedImage(state, ref, str, width, height, colorMap, interpolate,
maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate); maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate);
image->setImage (surface); image->setImage (surface);
setCairo (nullptr); setCairo (nullptr);
cairo_surface_destroy (surface); cairo_surface_destroy (surface);
cairo_destroy (cr); cairo_destroy (cr);

View File

@ -18,12 +18,13 @@
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com> // Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2005 Nickolay V. Shmyrev <nshmyrev@yandex.ru> // Copyright (C) 2005 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
// Copyright (C) 2006-2011, 2013 Carlos Garcia Campos <carlosgc@gnome.org> // 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) 2008 Michael Vrable <mvrable@cs.ucsd.edu>
// Copyright (C) 2010-2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2010-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> // Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
// Copyright (C) 2016 Jason Crain <jason@aquaticape.us> // Copyright (C) 2016 Jason Crain <jason@aquaticape.us>
// Copyright (C) 2018 Albert Astals Cid <aacid@kde.org> // 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 // 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 // came with your tarball or type make ChangeLog if you are building from git
@ -191,13 +192,13 @@ public:
void eoClip(GfxState *state) override; void eoClip(GfxState *state) override;
//----- text drawing //----- text drawing
void beginString(GfxState *state, GooString *s) override; void beginString(GfxState *state, const GooString *s) override;
void endString(GfxState *state) override; void endString(GfxState *state) override;
void drawChar(GfxState *state, double x, double y, void drawChar(GfxState *state, double x, double y,
double dx, double dy, double dx, double dy,
double originX, double originY, double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen) override; 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; void endActualText(GfxState *state) override;
GBool beginType3Char(GfxState *state, double x, double y, GBool beginType3Char(GfxState *state, double x, double y,
@ -269,10 +270,10 @@ public:
void setCairo (cairo_t *cr); void setCairo (cairo_t *cr);
void setTextPage (TextPage *text); 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 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; } void getType3GlyphWidth (double *wx, double *wy) { *wx = t3_glyph_wx; *wy = t3_glyph_wy; }
GBool hasType3GlyphBBox () { return t3_glyph_has_bbox; } GBool hasType3GlyphBBox () { return t3_glyph_has_bbox; }
double *getType3GlyphBBox () { return t3_glyph_bbox; } double *getType3GlyphBBox () { return t3_glyph_bbox; }
@ -335,7 +336,6 @@ protected:
GBool printing; GBool printing;
GBool use_show_text_glyphs; GBool use_show_text_glyphs;
GBool text_matrix_valid; GBool text_matrix_valid;
cairo_surface_t *surface;
cairo_glyph_t *glyphs; cairo_glyph_t *glyphs;
int glyphCount; int glyphCount;
cairo_text_cluster_t *clusters; cairo_text_cluster_t *clusters;
@ -359,7 +359,6 @@ protected:
cairo_pattern_t *shape; cairo_pattern_t *shape;
cairo_pattern_t *mask; cairo_pattern_t *mask;
cairo_matrix_t mask_matrix; cairo_matrix_t mask_matrix;
cairo_surface_t *cairo_shape_surface;
cairo_t *cairo_shape; cairo_t *cairo_shape;
int knockoutCount; int knockoutCount;
struct ColorSpaceStack { struct ColorSpaceStack {

View File

@ -170,7 +170,7 @@ protected:
void post_process(void); void post_process(void);
void process_outline(void); void process_outline(void);
void process_outline_items(GooList * items); void process_outline_items(const GooList * items);
void process_form(std::ofstream & out); void process_form(std::ofstream & out);
@ -179,7 +179,7 @@ protected:
void dump_css(void); void dump_css(void);
// convert a LinkAction to a string that our Javascript code can understand // 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);
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
/* /*

View File

@ -634,7 +634,9 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
Unicode u, *pu=&u; Unicode u, *pu=&u;
if(info.use_tounicode) 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); u = check_unicode(pu, n, cur_code, font);
} }
else else
@ -756,7 +758,7 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
} }
if(ctu) if(ctu)
ctu->decRefCnt(); ((CharCodeToUnicode *)ctu)->decRefCnt();
} }
/* /*

View File

@ -126,7 +126,7 @@ static string get_linkdest_detail_str(LinkDest * dest, Catalog * catalog, int &
return sout.str(); 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; string dest_str;
detail = ""; detail = "";
@ -137,7 +137,7 @@ string HTMLRenderer::get_linkaction_str(LinkAction * action, string & detail)
{ {
case actionGoTo: case actionGoTo:
{ {
auto * real_action = dynamic_cast<LinkGoTo*>(action); auto * real_action = dynamic_cast<const LinkGoTo*>(action);
LinkDest * dest = nullptr; LinkDest * dest = nullptr;
if(auto _ = real_action->getDest()) if(auto _ = real_action->getDest())
dest = _->copy(); dest = _->copy();
@ -162,7 +162,7 @@ string HTMLRenderer::get_linkaction_str(LinkAction * action, string & detail)
break; break;
case actionURI: case actionURI:
{ {
auto * real_action = dynamic_cast<LinkURI*>(action); auto * real_action = dynamic_cast<const LinkURI*>(action);
assert(real_action != nullptr); assert(real_action != nullptr);
dest_str = real_action->getURI()->getCString(); dest_str = real_action->getURI()->getCString();
} }

View File

@ -21,7 +21,7 @@ namespace pdf2htmlEX {
using std::ostream; using std::ostream;
void HTMLRenderer::process_outline_items(GooList * items) void HTMLRenderer::process_outline_items(const GooList * items)
{ {
if((!items) || (items->getLength() == 0)) if((!items) || (items->getLength() == 0))
return; return;