Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorPeter Zhang <peter@innocraft.com>2022-01-11 03:07:47 +0300
committerGitHub <noreply@github.com>2022-01-11 03:07:47 +0300
commita0750b0a6bc278aeee467d3d27a79d6aa9cbcbf4 (patch)
tree5c3521c3d1650aed6912507d9fc9e66ef29e76e0 /core
parent40afe8b101537e1ca4c28d345b756a22cbaeac21 (diff)
unifont import, TCPDF use import fonts (#18577)
* if unifont import, use that font for the pdf if unifont import, use that font for the pdf * Update Pdf.php update function and comments
Diffstat (limited to 'core')
-rw-r--r--core/ReportRenderer/Pdf.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/ReportRenderer/Pdf.php b/core/ReportRenderer/Pdf.php
index 3875f1e484..ec72979ddb 100644
--- a/core/ReportRenderer/Pdf.php
+++ b/core/ReportRenderer/Pdf.php
@@ -16,6 +16,7 @@ use Piwik\Plugins\API\API;
use Piwik\Plugins\CoreAdminHome\CustomLogo;
use Piwik\ReportRenderer;
use Piwik\TCPDF;
+use TCPDF_FONTS;
/**
* @see libs/tcpdf
@@ -40,6 +41,8 @@ class Pdf extends ReportRenderer
const MAX_GRAPH_REPORTS = 3;
const MAX_2COL_TABLE_REPORTS = 2;
+ const IMPORT_FONT_PATH = 'plugins/ImageGraph/fonts/unifont.ttf';
+
const PDF_CONTENT_TYPE = 'pdf';
private $reportFontStyle = '';
@@ -136,6 +139,10 @@ class Pdf extends ReportRenderer
}
// WARNING: Did you read the warning above?
+ // When user follow the FAQ https://matomo.org/faq/how-to-install/faq_142/, imported unifont font, it will apply across the entire report
+ if (is_file(self::IMPORT_FONT_PATH)) {
+ $reportFont = TCPDF_FONTS::addTTFfont(self::IMPORT_FONT_PATH, 'TrueTypeUnicode');
+ }
$this->reportFont = $reportFont;
}