From: William Desportes <williamdes@wdes.fr>
Date: Thu, 2 Feb 2023 15:54:11 +0100
Subject: Change directory variables to Debian folders

Origin: vendor
Forwarded: not-needed
---
 src/Dompdf.php      |  4 ++--
 src/FontMetrics.php |  2 +-
 src/Image/Cache.php |  4 ++--
 src/Options.php     | 12 ++++++------
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/Dompdf.php b/src/Dompdf.php
index 6a43785..6c7d822 100644
--- a/src/Dompdf.php
+++ b/src/Dompdf.php
@@ -258,8 +258,8 @@ class Dompdf
             $this->setOptions(new Options());
         }
 
-        $versionFile = realpath(__DIR__ . '/../VERSION');
-        if (($version = file_get_contents($versionFile)) !== false) {
+        $versionFile = '/usr/share/php/dompdf/VERSION';
+        if (file_exists($versionFile) && ($version = file_get_contents($versionFile)) !== false) {
             $version = trim($version);
             if ($version !== '$Format:<%h>$') {
                 $this->version = sprintf('dompdf %s', $version);
diff --git a/src/FontMetrics.php b/src/FontMetrics.php
index 52cc3c7..9adfdb0 100644
--- a/src/FontMetrics.php
+++ b/src/FontMetrics.php
@@ -113,7 +113,7 @@ class FontMetrics
      */
     public function loadFontFamilies()
     {
-        $file = $this->options->getRootDir() . "/lib/fonts/installed-fonts.dist.json";
+        $file = $this->options->getFontDir() . "/installed-fonts.dist.json";
         $this->bundledFonts = json_decode(file_get_contents($file), true);
 
         if (is_readable($this->getUserFontsFilePath())) {
diff --git a/src/Image/Cache.php b/src/Image/Cache.php
index b9fd322..b00eef8 100644
--- a/src/Image/Cache.php
+++ b/src/Image/Cache.php
@@ -284,6 +284,6 @@ class Cache
     }
 }
 
-if (file_exists(realpath(__DIR__ . "/../../lib/res/broken_image.svg"))) {
-    Cache::$broken_image = realpath(__DIR__ . "/../../lib/res/broken_image.svg");
+if (file_exists('/usr/share/php/dompdf/lib/res/broken_image.svg')) {
+    Cache::$broken_image = '/usr/share/php/dompdf/lib/res/broken_image.svg';
 }
diff --git a/src/Options.php b/src/Options.php
index 8d0b7bd..9d2fe6d 100644
--- a/src/Options.php
+++ b/src/Options.php
@@ -332,16 +332,16 @@ class Options
      */
     public function __construct(?array $attributes = null)
     {
-        $rootDir = realpath(__DIR__ . "/../");
+        $rootDir = '/usr/share/php/dompdf';
         $this->setChroot(array($rootDir));
         $this->setRootDir($rootDir);
-        $this->setTempDir(sys_get_temp_dir());
-        $this->setFontDir($rootDir . "/lib/fonts");
-        $this->setFontCache($this->getFontDir());
+        $this->setTempDir('/var/cache/php-dompdf/tmp');
+        $this->setFontDir('/usr/share/php/dompdf/lib/fonts');
+        $this->setFontCache('/var/cache/php-dompdf/fonts/');
 
         $ver = "";
-        $versionFile = realpath(__DIR__ . '/../VERSION');
-        if (($version = file_get_contents($versionFile)) !== false) {
+        $versionFile = '/usr/share/php/dompdf/VERSION';
+        if (file_exists($versionFile) && ($version = file_get_contents($versionFile)) !== false) {
             $version = trim($version);
             if ($version !== '$Format:<%h>$') {
                 $ver = "/$version";
