]> _ Git - fluidbook_tools.git/commitdiff
wip #4214
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 21 Sep 2023 07:59:04 +0000 (09:59 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 21 Sep 2023 07:59:04 +0000 (09:59 +0200)
src/Links/TextLink.php

index 9b1d2a1b0fb14e44162e143deced6d226278f317..96a24d09071348bcbb3cafaa912e189e3cc1ea2a 100644 (file)
@@ -8,13 +8,18 @@ class TextLink extends ContentLink
 {
     public function getCSS()
     {
-        $font = $this->compiler->addFont($this->image);
-        if (!$font['capHeight']) {
-            $font['capHeight'] = 1;
-        }
-        $fz = $this->height * $this->getCssScale();
-        $fz = round($fz / $font['capHeight'], 2);
         $res = parent::getCSS();
+        $fz = $this->height * $this->getCssScale();
+        $font['capHeight'] = 1;
+        if ($this->image) {
+            $font = $this->compiler->addFont($this->image);
+            if (!$font['capHeight']) {
+                $font['capHeight'] = 1;
+            }
+            $fz = round($fz / $font['capHeight'], 2);
+        } else {
+            $font['family'] = 'Arial, Helvetica, sans-serif';
+        }
         $res .= 'line-height:' . $font['capHeight'] . ';font-size:' . $fz . 'px;font-family:' . $font['family'] . ';color:' . Color::colorToCSS($this->extra, 1) . ';';
         return $res;
     }