/** * creates a SVG Font out of SGV files from a directory * * @param InputInterface $input input * @param OutputInterface $output output * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $directory = $input->getArgument('directory'); $outputFile = $input->getArgument('output-file'); $generator = new IconFontGenerator(); $output->writeln('reading files from "' . $directory . '" ...'); $generator->generateFromDir($directory, array('id' => $input->getOption('name') ?: 'SVGFont'), $input->getOption('rename-files')); $output->writeln('writing font to "' . $outputFile . '" ...'); file_put_contents($outputFile, $generator->getFont()->getXML()); $output->getFormatter()->setStyle('success', new OutputFormatterStyle(null, null, array('bold', 'reverse'))); $output->writeln('<success>created ' . $outputFile . ' successfully</success>'); }
/** * creates a HTML list * * @param IconFontGenerator $generator icon font generator * @param string $fontFile font file name * @return string HTML unordered list */ protected function getHTMLListFromGenerator(IconFontGenerator $generator, $fontFile) { $fontOptions = $generator->getFont()->getOptions(); $html = '<ul>'; $glyphNames = $generator->getGlyphNames(); asort($glyphNames); foreach ($glyphNames as $unicode => $glyph) { $html .= "\n\t" . '<li data-icon="&#x' . $unicode . ';" title="' . htmlspecialchars($glyph) . '">' . htmlspecialchars($glyph) . '</li>'; } $html .= "\n" . '</ul>' . "\n"; return $html; }