From 01f61c57859225a613baa554b86c89ca7bfd456b Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 7 Mar 2022 16:07:02 +0000 Subject: [PATCH] wait #5147 @1 --- .../html5/master/class.ws.html5.links.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 3394519da..486f9365f 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -55,6 +55,7 @@ class wsHTML5Link public $attachLeft = false; public $allowsAnimation = true; public $forceTexture = false; + public $letterspacing = 0; protected $role = 'button'; @@ -621,6 +622,9 @@ class wsHTML5Link $this->blendmode = $animation['blendmode']; unset($animation['blendmode']); } + if (isset($animation['letterspacing'])) { + $this->letterspacing = $animation['letterspacing']; + } if (isset($animation['zindex'])) { if ($animation['zindex'] >= 10) { $this->zindex = $animation['zindex']; @@ -1794,10 +1798,23 @@ class textLink extends contentLink $fz = $this->height * $this->getCssScale(); $fz = round($fz / $font['capHeight'], 2); $res = parent::getCSS(); - $res .= 'line-height:' . $font['capHeight'] . ';font-size:' . $fz . 'px;font-family:' . $font['family'] . ';color:' . wsHTML5::colorToCSS($this->extra, 1) . ';'; + $res .= 'letter-spacing:' . $this->_css($this->letterspacing) . ';line-height:' . $font['capHeight'] . ';font-size:' . $fz . 'px;font-family:' . $font['family'] . ';color:' . wsHTML5::colorToCSS($this->extra, 1) . ';'; return $res; } + protected function _css($v, $unit = "px") + { + if (!$v) { + return 0; + } + if (preg_match('/^([0-9\.\-]+)([a-z]*)$/', $v, $matches)) { + $v = $matches[1]; + $unit = isset($matches[2]) && $matches[2] ? $matches[2] : $unit; + } + return $v . $unit; + + } + public function getHTMLContainerClass() { return parent::getHTMLContainerClass() . ' textLink'; -- 2.39.5