From 5ddb8fafb9fe4f9a796f4582e752213aa3121e8b Mon Sep 17 00:00:00 2001 From: soufiane Date: Wed, 23 Oct 2024 18:20:24 +0200 Subject: [PATCH] =?utf8?q?Ajout=20de=20isset()=20pour=20v=C3=A9rifier=20la?= =?utf8?q?=20d=C3=A9finition=20de=20la=20variable=20$fontHeight=20avant=20?= =?utf8?q?utilisation=20afin=20d'=C3=A9viter=20des=20erreurs=20type=20unde?= =?utf8?q?fined?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/FluidbookFontToWoff.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/FluidbookFontToWoff.php b/src/FluidbookFontToWoff.php index 8054d4d..60f6302 100644 --- a/src/FluidbookFontToWoff.php +++ b/src/FluidbookFontToWoff.php @@ -7,6 +7,12 @@ use Cubist\Util\Graphics\Color; class FluidbookFontToWoff { + /* + * + * Code à réutiliser dans le fichier Compiler.php + * Nom de la fonction : addFont() + * + */ public static function fontforge($dest, $filepath) { if (!file_exists($dest) || filemtime($dest) < filemtime($filepath)) { $script = resource_path('tools/fonts/convertrn.pe'); @@ -67,6 +73,6 @@ class FluidbookFontToWoff if (isset($fontCapHeight) && isset($fontHeight) && is_numeric($fontCapHeight) && is_numeric($fontHeight)) { $capHeight = $fontCapHeight / $fontHeight; } - return ['family' => $hash, 'capHeight' => $capHeight, 'ascender' => $fontHeight > 0 ? $ascender / $fontHeight : 1, 'descender' => $fontHeight > 0 ? $descender / $fontHeight : 1]; + return ['family' => $hash, 'capHeight' => $capHeight, 'ascender' => isset($fontHeight) && $fontHeight > 0 ? $ascender / $fontHeight : 1, 'descender' => isset($fontHeight) && $fontHeight > 0 ? $descender / $fontHeight : 1]; } } -- 2.39.5