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


PHP TCPDF_FONTS::UTF8ArrayToUniArray方法代码示例

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


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

示例1: Write

 /**
  * This method prints text from the current position.<br />
  * @param $h (float) Line height
  * @param $txt (string) String to print
  * @param $link (mixed) URL or identifier returned by AddLink()
  * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false).
  * @param $align (string) Allows to center or align the text. Possible values are:<ul><li>L or empty string: left align (default value)</li><li>C: center</li><li>R: right align</li><li>J: justify</li></ul>
  * @param $ln (boolean) if true set cursor at the bottom of the line, otherwise set cursor at the top of the line.
  * @param $stretch (int) font stretch mode: <ul><li>0 = disabled</li><li>1 = horizontal scaling only if text is larger than cell width</li><li>2 = forced horizontal scaling to fit cell width</li><li>3 = character spacing only if text is larger than cell width</li><li>4 = forced character spacing to fit cell width</li></ul> General font stretching and scaling values will be preserved when possible.
  * @param $firstline (boolean) if true prints only the first line and return the remaining string.
  * @param $firstblock (boolean) if true the string is the starting of a line.
  * @param $maxh (float) maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature.
  * @param $wadj (float) first line width will be reduced by this amount (used in HTML mode).
  * @param $margin (array) margin array of the parent container
  * @return mixed Return the number of cells or the remaining string if $firstline = true.
  * @public
  * @since 1.5
  */
 public function Write($h, $txt, $link = '', $fill = false, $align = '', $ln = false, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0, $wadj = 0, $margin = '')
 {
     // check page for no-write regions and adapt page margins if necessary
     list($this->x, $this->y) = $this->checkPageRegions($h, $this->x, $this->y);
     if (strlen($txt) == 0) {
         // fix empty text
         $txt = ' ';
     }
     if ($margin === '') {
         // set default margins
         $margin = $this->cell_margin;
     }
     // remove carriage returns
     $s = str_replace("\r", '', $txt);
     // check if string contains arabic text
     if (preg_match(TCPDF_FONT_DATA::$uni_RE_PATTERN_ARABIC, $s)) {
         $arabic = true;
     } else {
         $arabic = false;
     }
     // check if string contains RTL text
     if ($arabic or $this->tmprtl == 'R' or preg_match(TCPDF_FONT_DATA::$uni_RE_PATTERN_RTL, $s)) {
         $rtlmode = true;
     } else {
         $rtlmode = false;
     }
     // get a char width
     $chrwidth = $this->GetCharWidth(46);
     // dot character
     // get array of unicode values
     $chars = TCPDF_FONTS::UTF8StringToArray($s, $this->isunicode, $this->CurrentFont);
     // calculate maximum width for a single character on string
     $chrw = $this->GetArrStringWidth($chars, '', '', 0, true);
     array_walk($chrw, array($this, 'getRawCharWidth'));
     $maxchwidth = max($chrw);
     // get array of chars
     $uchars = TCPDF_FONTS::UTF8ArrayToUniArray($chars, $this->isunicode);
     // get the number of characters
     $nb = count($chars);
     // replacement for SHY character (minus symbol)
     $shy_replacement = 45;
     $shy_replacement_char = TCPDF_FONTS::unichr($shy_replacement, $this->isunicode);
     // widht for SHY replacement
     $shy_replacement_width = $this->GetCharWidth($shy_replacement);
     // max Y
     $maxy = $this->y + $maxh - $h - $this->cell_padding['T'] - $this->cell_padding['B'];
     // page width
     $pw = $w = $this->w - $this->lMargin - $this->rMargin;
     // calculate remaining line width ($w)
     if ($this->rtl) {
         $w = $this->x - $this->lMargin;
     } else {
         $w = $this->w - $this->rMargin - $this->x;
     }
     // max column width
     $wmax = $w - $wadj;
     if (!$firstline) {
         $wmax -= $this->cell_padding['L'] + $this->cell_padding['R'];
     }
     if (!$firstline and ($chrwidth > $wmax or $maxchwidth > $wmax)) {
         // the maximum width character do not fit on column
         return '';
     }
     // minimum row height
     $row_height = max($h, $this->FontSize * $this->cell_height_ratio);
     $start_page = $this->page;
     $i = 0;
     // character position
     $j = 0;
     // current starting position
     $sep = -1;
     // position of the last blank space
     $shy = false;
     // true if the last blank is a soft hypen (SHY)
     $l = 0;
     // current string length
     $nl = 0;
     //number of lines
     $linebreak = false;
     $pc = 0;
     // previous character
     // for each character
//.........这里部分代码省略.........
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:101,代码来源:tcpdf.php


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