More work on user linking to existing defined system
This commit is contained in:
@@ -47,23 +47,23 @@ class Font
|
||||
*/
|
||||
private function chars(): Collection
|
||||
{
|
||||
static $chars = NULL;
|
||||
static $chars = [];
|
||||
|
||||
if (is_null($chars) && $this->text) {
|
||||
if ($this->text && empty($chars[$this->text])) {
|
||||
// Trim any leading/trailing spaces
|
||||
$text = trim(strtolower($this->text));
|
||||
$chars = collect();
|
||||
$chars[$this->text] = collect();
|
||||
|
||||
// Work out the characters we need
|
||||
foreach (array_unique(str_split($text)) as $c) {
|
||||
if (! $x=Arr::get(static::FONT,$c))
|
||||
continue;
|
||||
|
||||
$chars->put($c,$x);
|
||||
$chars[$this->text]->put($c,$x);
|
||||
}
|
||||
}
|
||||
|
||||
return $chars ?: collect();
|
||||
return $chars[$this->text] ?: collect();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,7 +94,7 @@ class Font
|
||||
|
||||
// If the last character is a space, we'll reduce the width
|
||||
$space = TRUE;
|
||||
foreach ($chars->get($c) as $line => $x)
|
||||
foreach ($chars->get($c) as $x)
|
||||
if (array_pop($x) != 32) {
|
||||
$space = FALSE;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user