summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2023-01-03 10:13:52 +1030
committerAdrian Johnson <ajohnson@redneon.com>2023-01-14 09:56:57 +1030
commit53115a05b7b4480ef06165199c8f1cb3982ab13d (patch)
treec38b53d3990b1718c66553a71d7d728e5037e088
parentda39bd930fee9369071a97b93ffe3ea0987acedc (diff)
Fix cairo rendering of color type 3 fonts
The bug fix in 448f03cf needs to be disabled for color fonts.
-rw-r--r--poppler/CairoFontEngine.cc2
-rw-r--r--poppler/CairoOutputDev.cc6
-rw-r--r--poppler/CairoOutputDev.h12
3 files changed, 13 insertions, 7 deletions
diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index 841e9efd..538795c3 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -482,7 +482,7 @@ static cairo_status_t _render_type3_glyph(cairo_scaled_font_t *scaled_font, unsi
auto gfx = std::make_unique<Gfx>(info->doc, output_dev, resDict, &box, nullptr);
output_dev->startDoc(info->doc, info->fontEngine);
output_dev->startType3Render(gfx->getState(), gfx->getXRef());
- output_dev->setInType3Char(true);
+ output_dev->setType3RenderType(color ? CairoOutputDev::Type3RenderColor : CairoOutputDev::Type3RenderMask);
charProc = charProcs->getVal(glyph);
if (!charProc.isStream()) {
return CAIRO_STATUS_USER_FONT_ERROR;
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 91c05bc5..0fb7add2 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -155,7 +155,7 @@ CairoOutputDev::CairoOutputDev()
printing = true;
use_show_text_glyphs = false;
inUncoloredPattern = false;
- inType3Char = false;
+ t3_render_state = Type3RenderNone;
t3_glyph_has_bbox = false;
t3_glyph_has_color = false;
text_matrix_valid = true;
@@ -888,7 +888,7 @@ void CairoOutputDev::doPath(cairo_t *c, GfxState *state, const GfxPath *path)
void CairoOutputDev::stroke(GfxState *state)
{
- if (inType3Char) {
+ if (t3_render_state == Type3RenderMask) {
GfxGray gray;
state->getFillGray(&gray);
if (colToDbl(gray) > 0.5) {
@@ -919,7 +919,7 @@ void CairoOutputDev::stroke(GfxState *state)
void CairoOutputDev::fill(GfxState *state)
{
- if (inType3Char) {
+ if (t3_render_state == Type3RenderMask) {
GfxGray gray;
state->getFillGray(&gray);
if (colToDbl(gray) > 0.5) {
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index 5ce877d2..ee748540 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -263,9 +263,15 @@ public:
}
void copyAntialias(cairo_t *cr, cairo_t *source_cr);
- void setInType3Char(bool inType3CharA)
+ enum Type3RenderType
{
- inType3Char = inType3CharA;
+ Type3RenderNone,
+ Type3RenderMask,
+ Type3RenderColor
+ };
+ void setType3RenderType(Type3RenderType state)
+ {
+ t3_render_state = state;
}
void getType3GlyphWidth(double *wx, double *wy)
{
@@ -348,7 +354,7 @@ protected:
int utf8Max;
cairo_path_t *textClipPath;
bool inUncoloredPattern; // inside a uncolored pattern (PaintType = 2)
- bool inType3Char; // inside a Type 3 CharProc
+ Type3RenderType t3_render_state;
double t3_glyph_wx, t3_glyph_wy;
bool t3_glyph_has_bbox;
bool t3_glyph_has_color;