|
|
a2ba235 |
From 111f38a722eedddd94faa52dda8c5e0da561fb41 Mon Sep 17 00:00:00 2001
|
|
|
a2ba235 |
From: Marek Kasik <mkasik@redhat.com>
|
|
|
a2ba235 |
Date: Fri, 24 Jun 2022 22:00:09 +0200
|
|
|
a2ba235 |
Subject: [PATCH 1/2] Cairo: Update font after restore
|
|
|
a2ba235 |
|
|
|
a2ba235 |
Update font after restore (Q operator) if font has changed.
|
|
|
a2ba235 |
This is important when entering text into forms if there
|
|
|
a2ba235 |
are characters shown by default font after characters
|
|
|
a2ba235 |
which needed new font.
|
|
|
a2ba235 |
|
|
|
a2ba235 |
New method getRef() where added to CairoFont class to
|
|
|
a2ba235 |
be able to easily compare fonts.
|
|
|
a2ba235 |
---
|
|
|
a2ba235 |
poppler/CairoFontEngine.h | 3 +++
|
|
|
a2ba235 |
poppler/CairoOutputDev.cc | 7 ++++++-
|
|
|
a2ba235 |
poppler/CairoOutputDev.h | 2 ++
|
|
|
a2ba235 |
3 files changed, 11 insertions(+), 1 deletion(-)
|
|
|
a2ba235 |
|
|
|
a2ba235 |
diff --git a/poppler/CairoFontEngine.h b/poppler/CairoFontEngine.h
|
|
|
a2ba235 |
index 56cc8825..c97e0ea4 100644
|
|
|
a2ba235 |
--- a/poppler/CairoFontEngine.h
|
|
|
a2ba235 |
+++ b/poppler/CairoFontEngine.h
|
|
|
a2ba235 |
@@ -22,6 +22,7 @@
|
|
|
a2ba235 |
// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
|
|
|
a2ba235 |
// Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de>
|
|
|
a2ba235 |
// Copyright (C) 2022 Oliver Sander <oliver.sander@tu-dresden.de>
|
|
|
a2ba235 |
+// Copyright (C) 2022 Marek Kasik <mkasik@redhat.com>
|
|
|
a2ba235 |
//
|
|
|
a2ba235 |
// To see a description of the changes please see the Changelog file that
|
|
|
a2ba235 |
// came with your tarball or type make ChangeLog if you are building from git
|
|
|
a2ba235 |
@@ -59,6 +60,8 @@ public:
|
|
|
a2ba235 |
|
|
|
a2ba235 |
bool isSubstitute() { return substitute; }
|
|
|
a2ba235 |
|
|
|
a2ba235 |
+ Ref getRef() { return ref; }
|
|
|
a2ba235 |
+
|
|
|
a2ba235 |
protected:
|
|
|
a2ba235 |
Ref ref;
|
|
|
a2ba235 |
cairo_font_face_t *cairo_font_face;
|
|
|
a2ba235 |
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
|
|
|
a2ba235 |
index b402cc8b..a72c218a 100644
|
|
|
a2ba235 |
--- a/poppler/CairoOutputDev.cc
|
|
|
a2ba235 |
+++ b/poppler/CairoOutputDev.cc
|
|
|
a2ba235 |
@@ -31,7 +31,7 @@
|
|
|
a2ba235 |
// Copyright (C) 2015 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp>
|
|
|
a2ba235 |
// 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
|
|
|
a2ba235 |
// Copyright (C) 2018, 2020 Adam Reichold <adam.reichold@t-online.de>
|
|
|
a2ba235 |
-// Copyright (C) 2019, 2020 Marek Kasik <mkasik@redhat.com>
|
|
|
a2ba235 |
+// Copyright (C) 2019, 2020, 2022 Marek Kasik <mkasik@redhat.com>
|
|
|
a2ba235 |
// Copyright (C) 2020 Michal <sudolskym@gmail.com>
|
|
|
a2ba235 |
// Copyright (C) 2020, 2022 Oliver Sander <oliver.sander@tu-dresden.de>
|
|
|
a2ba235 |
// Copyright (C) 2021 Uli Schlachter <psychon@znc.in>
|
|
|
a2ba235 |
@@ -357,6 +357,7 @@ void CairoOutputDev::saveState(GfxState *state)
|
|
|
a2ba235 |
elem.stroke_opacity = stroke_opacity;
|
|
|
a2ba235 |
elem.mask = mask ? cairo_pattern_reference(mask) : nullptr;
|
|
|
a2ba235 |
elem.mask_matrix = mask_matrix;
|
|
|
a2ba235 |
+ elem.fontRef = currentFont ? currentFont->getRef() : Ref::INVALID();
|
|
|
a2ba235 |
saveStateStack.push_back(elem);
|
|
|
a2ba235 |
|
|
|
a2ba235 |
if (strokePathClip) {
|
|
|
a2ba235 |
@@ -384,6 +385,10 @@ void CairoOutputDev::restoreState(GfxState *state)
|
|
|
a2ba235 |
stroke_color = {};
|
|
|
a2ba235 |
stroke_opacity = saveStateStack.back().stroke_opacity;
|
|
|
a2ba235 |
|
|
|
a2ba235 |
+ if (saveStateStack.back().fontRef != (currentFont ? currentFont->getRef() : Ref::INVALID())) {
|
|
|
a2ba235 |
+ needFontUpdate = true;
|
|
|
a2ba235 |
+ }
|
|
|
a2ba235 |
+
|
|
|
a2ba235 |
/* This isn't restored by cairo_restore() since we keep it in the
|
|
|
a2ba235 |
* output device. */
|
|
|
a2ba235 |
updateBlendMode(state);
|
|
|
a2ba235 |
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
|
|
|
a2ba235 |
index c287bf5c..5ce877d2 100644
|
|
|
a2ba235 |
--- a/poppler/CairoOutputDev.h
|
|
|
a2ba235 |
+++ b/poppler/CairoOutputDev.h
|
|
|
a2ba235 |
@@ -27,6 +27,7 @@
|
|
|
a2ba235 |
// 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
|
|
|
a2ba235 |
// Copyright (C) 2020 Michal <sudolskym@gmail.com>
|
|
|
a2ba235 |
// Copyright (C) 2021 Christian Persch <chpe@src.gnome.org>
|
|
|
a2ba235 |
+// Copyright (C) 2022 Marek Kasik <mkasik@redhat.com>
|
|
|
a2ba235 |
//
|
|
|
a2ba235 |
// To see a description of the changes please see the Changelog file that
|
|
|
a2ba235 |
// came with your tarball or type make ChangeLog if you are building from git
|
|
|
a2ba235 |
@@ -381,6 +382,7 @@ protected:
|
|
|
a2ba235 |
double stroke_opacity;
|
|
|
a2ba235 |
cairo_pattern_t *mask; // can be null
|
|
|
a2ba235 |
cairo_matrix_t mask_matrix;
|
|
|
a2ba235 |
+ Ref fontRef;
|
|
|
a2ba235 |
};
|
|
|
a2ba235 |
std::vector<SaveStateElement> saveStateStack;
|
|
|
a2ba235 |
};
|
|
|
a2ba235 |
--
|
|
|
a2ba235 |
2.38.1
|
|
|
a2ba235 |
|