]> _ Git - fluidbook_tools.git/commitdiff
Ajout de isset() pour vérifier la définition de la variable $fontHeight avant utilisa...
authorsoufiane <soufiane@cubedesigners.com>
Wed, 23 Oct 2024 16:20:24 +0000 (18:20 +0200)
committersoufiane <soufiane@cubedesigners.com>
Wed, 23 Oct 2024 16:20:24 +0000 (18:20 +0200)
src/FluidbookFontToWoff.php

index 8054d4dea4620ada4bb64877e30e64ce5f6d6ebb..60f63020325ce1dc2834be639662f57480e33c7a 100644 (file)
@@ -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];
     }
 }