Skip to content

Commit 19affcb

Browse files
committed
some bug fixed for show art font
1 parent 842d7db commit 19affcb

File tree

5 files changed

+22
-124
lines changed

5 files changed

+22
-124
lines changed

examples/Controllers/HomeController.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,22 @@ public function blockMsgCommand()
101101
/**
102102
* output art font text
103103
* @options
104-
* --font Set the art font name(allow: {internalFonts}).
105-
* --style Set the art font style.
104+
* --font Set the art font name(allow: {internalFonts}).
105+
* --italic Set the art font type is italic.
106+
* --style Set the art font style.
106107
* @return int
107108
*/
108109
public function artFontCommand()
109110
{
110-
ArtFont::create()->show('404', ArtFont::INTERNAL_GROUP,[
111-
'style' => $this->input->getOpt('style')
111+
$name = $this->input->getLongOpt('font', '404');
112+
113+
if (!ArtFont::isInternalFont($name)) {
114+
return $this->output->liteError("Your input font name: $name, is not exists. Please use '-h' see allowed.");
115+
}
116+
117+
ArtFont::create()->show($name, ArtFont::INTERNAL_GROUP,[
118+
'type' => $this->input->getBoolOpt('italic') ? 'italic' : '',
119+
'style' => $this->input->getOpt('style'),
112120
]);
113121

114122
return 0;

src/BuiltIn/ArtFonts/ArtFontsBlock.php

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/BuiltIn/ArtFonts/ArtFontsItalic.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/BuiltIn/Resources/art-fonts/success_italic.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/ ___/__ _______________ __________
33
\__ \/ / / / ___/ ___/ _ \/ ___/ ___/
44
___/ / /_/ / /__/ /__/ __(__ |__ )
5-
/____/\__,_/\___/\___/\___/____/____/
5+
/____/\____/\___/\___/\___/____/____/

src/Components/ArtFont.php

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ class ArtFont
4848
*/
4949
private $fontContents = [];
5050

51-
/**
52-
* @see ArtFontsBlock
53-
* @var array
54-
*/
55-
private $classFonts = [];
56-
5751
/**
5852
* @return self
5953
*/
@@ -218,6 +212,15 @@ public function addPath(string $name, string $path)
218212
return $this;
219213
}
220214

215+
/**
216+
* @param string $name
217+
* @return bool
218+
*/
219+
public static function isInternalFont($name): bool
220+
{
221+
return \in_array((string)$name, self::$internalFonts, true);
222+
}
223+
221224
/**
222225
* @return array
223226
*/
@@ -259,20 +262,4 @@ public function setFonts(array $fonts)
259262
$this->addFont($name, $font);
260263
}
261264
}
262-
263-
/**
264-
* @return array
265-
*/
266-
public function getClassFonts(): array
267-
{
268-
return $this->classFonts;
269-
}
270-
271-
/**
272-
* @param array $classFonts
273-
*/
274-
public function setClassFonts(array $classFonts)
275-
{
276-
$this->classFonts = $classFonts;
277-
}
278265
}

0 commit comments

Comments
 (0)