当前位置: 首页>>代码示例>>PHP>>正文


PHP Style::setBold方法代码示例

本文整理汇总了PHP中Style::setBold方法的典型用法代码示例。如果您正苦于以下问题:PHP Style::setBold方法的具体用法?PHP Style::setBold怎么用?PHP Style::setBold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Style的用法示例。


在下文中一共展示了Style::setBold方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parseString

 protected function parseString()
 {
     while ($this->lexer->moveNext()) {
         if (in_array($this->lexer->lookahead, $this->lookaheadToSkip)) {
             continue;
         }
         $value = $this->lexer->lookahead['value'];
         switch ($this->lexer->lookahead['type']) {
             case Lexer::T_NONE:
                 $this->none($value);
                 break;
             case Lexer::T_ESCAPED_CHAR:
                 $this->escapedCharacter($value);
                 break;
             case Lexer::T_COLOR:
                 $color = preg_replace('/([^0-9a-f])/iu', '0', $value);
                 $this->currentStyle->setColor($color);
                 $this->color();
                 break;
             case Lexer::T_NO_COLOR:
                 if ($this->stylesStack) {
                     $color = $this->stylesStack[count($this->stylesStack) - 1]->getColor();
                 } else {
                     $color = null;
                 }
                 $this->currentStyle->setColor($color);
                 $this->color();
                 break;
             case Lexer::T_SHADOWED:
                 $this->currentStyle->setShadowed(!$this->currentStyle->isShadowed());
                 $this->shadowed();
                 break;
             case Lexer::T_BOLD:
                 $this->currentStyle->setBold(!$this->currentStyle->isBold());
                 $this->bold();
                 break;
             case Lexer::T_ITALIC:
                 $this->currentStyle->setItalic(!$this->currentStyle->isItalic());
                 $this->italic();
                 break;
             case Lexer::T_WIDE:
                 $this->currentStyle->setWidth(2);
                 $this->wide();
                 break;
             case Lexer::T_NARROW:
                 $this->currentStyle->setWidth(0);
                 $this->narrow();
                 break;
             case Lexer::T_MEDIUM:
                 $this->currentStyle->setWidth(1);
                 $this->medium();
                 break;
             case Lexer::T_UPPERCASE:
                 $this->currentStyle->setUppercase(!$this->currentStyle->isUppercase());
                 $this->upperCase();
                 break;
             case Lexer::T_RESET_ALL:
                 if ($this->stylesStack) {
                     $style = $this->stylesStack[count($this->stylesStack) - 1];
                 } else {
                     $style = new Style();
                 }
                 $this->currentStyle = $style;
                 $this->isInLink = false;
                 $this->resetAll();
                 break;
             case Lexer::T_PUSH:
                 array_push($this->stylesStack, $this->currentStyle);
                 $this->currentStyle = clone $this->currentStyle;
                 $this->pushStyle();
                 break;
             case Lexer::T_POP:
                 if (count($this->stylesStack)) {
                     $this->currentStyle = array_pop($this->stylesStack);
                 }
                 $this->popStyle();
                 break;
             case Lexer::T_EXTERNAL_LINK:
                 $this->isInLink = !$this->isInLink;
                 if ($this->isInLink) {
                     $link = $this->getLink();
                     $this->openExternalLink($link);
                 } else {
                     $this->closeExternalLink();
                 }
                 break;
             case Lexer::T_INTERNAL_LINK:
                 $this->isInLink = !$this->isInLink;
                 if ($this->isInLink) {
                     $link = $this->getLink();
                     $this->openInternalLink($link);
                 } else {
                     $this->closeInternalLink();
                 }
                 break;
             case Lexer::T_UNKNOWN_MARKUP:
                 // We do nothing with unknown markup for the moment
                 break;
         }
     }
//.........这里部分代码省略.........
开发者ID:manialib,项目名称:formatting,代码行数:101,代码来源:Parser.php


注:本文中的Style::setBold方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。