From 0399372ec240d23e0e70548237a541f2b5bf0f34 Mon Sep 17 00:00:00 2001
From: KrIr17 <elendil.krir17@gmail.com>
Date: Tue, 5 Nov 2024 00:40:15 +0100
Subject: [PATCH] Fix building with Poppler 24.11

Poppler 24.11 no longer sets the default value for faceIndex to 0 in
`FoFiTrueType::make()` and `FoFiTrueType::load()` [1], so we do it
on our end instead.

Fixes https://gitlab.com/inkscape/inkscape/-/issues/5370

[1] https://gitlab.freedesktop.org/poppler/poppler/-/commit/94467509a013dd5cf46c942baa598f2b296571f4
---
 .../internal/pdfinput/poppler-cairo-font-engine.cpp  | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp b/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
index 34a8eed682d..728b1d1aac4 100644
--- a/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
+++ b/src/extension/internal/pdfinput/poppler-cairo-font-engine.cpp
@@ -419,9 +419,9 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li
                 FoFiTrueType *ff;
 #endif
                 if (!font_data.empty()) {
-                    ff = FoFiTrueType::make((fontchar)font_data.data(), font_data.size());
+                    ff = FoFiTrueType::make((fontchar)font_data.data(), font_data.size(), 0);
                 } else {
-                    ff = FoFiTrueType::load(fileName.c_str());
+                    ff = FoFiTrueType::load(fileName.c_str(), 0);
                 }
                 if (!ff) {
                     goto err2;
@@ -444,9 +444,9 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li
             FoFiTrueType *ff;
 #endif
             if (!font_data.empty()) {
-                ff = FoFiTrueType::make((fontchar)font_data.data(), font_data.size());
+                ff = FoFiTrueType::make((fontchar)font_data.data(), font_data.size(), 0);
             } else {
-                ff = FoFiTrueType::load(fileName.c_str());
+                ff = FoFiTrueType::load(fileName.c_str(), 0);
             }
             if (!ff) {
                 error(errSyntaxError, -1, "failed to load truetype font\n");
@@ -512,9 +512,9 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, FT_Li
                     FoFiTrueType *ff;
 #endif
                     if (!font_data.empty()) {
-                        ff = FoFiTrueType::make((fontchar)font_data.data(), font_data.size());
+                        ff = FoFiTrueType::make((fontchar)font_data.data(), font_data.size(), 0);
                     } else {
-                        ff = FoFiTrueType::load(fileName.c_str());
+                        ff = FoFiTrueType::load(fileName.c_str(), 0);
                     }
                     if (ff) {
                         if (ff->isOpenTypeCFF()) {
-- 
GitLab