From 12dfd1035e21db4827289a28b43956450bf91bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20Cesar=20Laura=20Avenda=C3=B1o?= Date: Mon, 31 Aug 2020 22:55:44 +0000 Subject: [PATCH] PMCORE-2099 --- workflow/engine/controllers/designer.php | 9 +++++++++ workflow/engine/templates/designer/index.html | 4 ++++ workflow/public_html/fonts/styles.php | 13 ++++--------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/workflow/engine/controllers/designer.php b/workflow/engine/controllers/designer.php index 40f508f93..3148853b3 100644 --- a/workflow/engine/controllers/designer.php +++ b/workflow/engine/controllers/designer.php @@ -144,6 +144,15 @@ class Designer extends Controller } } + // Load additional fonts registered by TCPDF library + $tcPdfFonts = []; + OutputDocument::checkTcPdfFontsPath(); + foreach (OutputDocument::loadTcPdfFontsList() as $font) { + $font['friendlyName'] = !empty($font['friendlyName']) ? $font['friendlyName'] : $font['familyName']; + $tcPdfFonts[] = "{$font['friendlyName']}={$font['familyName']}"; + } + $this->setVar('tcPdfFonts', implode(';', $tcPdfFonts)); + //plugin set source path $sourceCss = array(); $sourceJs = array(); diff --git a/workflow/engine/templates/designer/index.html b/workflow/engine/templates/designer/index.html index 8c899c42c..9fd6f4245 100644 --- a/workflow/engine/templates/designer/index.html +++ b/workflow/engine/templates/designer/index.html @@ -17,6 +17,7 @@ + @@ -77,6 +79,7 @@ {foreach from=$sourceCss item=pathFile} {/foreach} + {foreach from=$sourceJs item=pathFile} diff --git a/workflow/public_html/fonts/styles.php b/workflow/public_html/fonts/styles.php index 14548d42f..a595b393e 100644 --- a/workflow/public_html/fonts/styles.php +++ b/workflow/public_html/fonts/styles.php @@ -9,16 +9,11 @@ $pathHome = implode('/', $sections) . '/'; // Include the "paths_installed.php" file require_once $pathHome . 'engine/config/paths_installed.php'; -// Set the fonts styles file +// Set the fonts styles file, for now the value is fixed (Maybe later we have another PDF engine) $fileName = 'fonts.css'; -// Check if the requested css file exists and if is accessible -if (!file_exists(PATH_DATA . 'fonts/tcpdf/' . $fileName)) { - // Redirect to error page 404 - header('Location: /errors/error404.php'); - die(); -} else { - // Stream the font file - header('Content-Type: text/css'); +// Stream the requested css file if exists and if is accessible +header('Content-Type: text/css'); +if (file_exists(PATH_DATA . 'fonts/tcpdf/' . $fileName)) { readfile(PATH_DATA . 'fonts/tcpdf/' . $fileName); }