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


PHP TCPDF_STATIC::pregSplit方法代码示例

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


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

示例1: writeHTML


//.........这里部分代码省略.........
                        }
                        $hrefstyle = -1;
                        if (isset($dom[$dom[$key]['parent']]['fontstyle']) and $dom[$dom[$key]['parent']]['fontstyle'] !== false) {
                            $hrefstyle = $dom[$dom[$key]['parent']]['fontstyle'];
                        }
                        $strrest = $this->addHtmlLink($this->HREF['url'], $dom[$key]['value'], $wfill, true, $hrefcolor, $hrefstyle, true);
                    } else {
                        $wadj = 0;
                        // space to leave for block continuity
                        if ($this->rtl) {
                            $cwa = $this->x - $this->lMargin;
                        } else {
                            $cwa = $this->w - $this->rMargin - $this->x;
                        }
                        if ($strlinelen < $cwa and isset($dom[$key + 1]) and $dom[$key + 1]['tag'] and !$dom[$key + 1]['block']) {
                            // check the next text blocks for continuity
                            $nkey = $key + 1;
                            $write_block = true;
                            $same_textdir = true;
                            $tmp_fontname = $this->FontFamily;
                            $tmp_fontstyle = $this->FontStyle;
                            $tmp_fontsize = $this->FontSizePt;
                            while ($write_block and isset($dom[$nkey])) {
                                if ($dom[$nkey]['tag']) {
                                    if ($dom[$nkey]['block']) {
                                        // end of block
                                        $write_block = false;
                                    }
                                    $tmp_fontname = isset($dom[$nkey]['fontname']) ? $dom[$nkey]['fontname'] : $this->FontFamily;
                                    $tmp_fontstyle = isset($dom[$nkey]['fontstyle']) ? $dom[$nkey]['fontstyle'] : $this->FontStyle;
                                    $tmp_fontsize = isset($dom[$nkey]['fontsize']) ? $dom[$nkey]['fontsize'] : $this->FontSizePt;
                                    $same_textdir = $dom[$nkey]['dir'] == $dom[$key]['dir'];
                                } else {
                                    $nextstr = TCPDF_STATIC::pregSplit('/' . $this->re_space['p'] . '+/', $this->re_space['m'], $dom[$nkey]['value']);
                                    if (isset($nextstr[0]) and $same_textdir) {
                                        $wadj += $this->GetStringWidth($nextstr[0], $tmp_fontname, $tmp_fontstyle, $tmp_fontsize);
                                        if (isset($nextstr[1])) {
                                            $write_block = false;
                                        }
                                    }
                                }
                                ++$nkey;
                            }
                        }
                        if ($wadj > 0 and $strlinelen + $wadj >= $cwa) {
                            $wadj = 0;
                            $nextstr = TCPDF_STATIC::pregSplit('/' . $this->re_space['p'] . '/', $this->re_space['m'], $dom[$key]['value']);
                            $numblks = count($nextstr);
                            if ($numblks > 1) {
                                // try to split on blank spaces
                                $wadj = $cwa - $strlinelen + $this->GetStringWidth($nextstr[$numblks - 1]);
                            } else {
                                // set the entire block on new line
                                $wadj = $this->GetStringWidth($nextstr[0]);
                            }
                        }
                        // check for reversed text direction
                        if ($wadj > 0 and ($this->rtl and $this->tmprtl === 'L' or !$this->rtl and $this->tmprtl === 'R')) {
                            // LTR text on RTL direction or RTL text on LTR direction
                            $reverse_dir = true;
                            $this->rtl = !$this->rtl;
                            $revshift = $strlinelen + $wadj + 1.0E-6;
                            // add little quantity for rounding problems
                            if ($this->rtl) {
                                $this->x += $revshift;
                            } else {
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:67,代码来源:tcpdf.php

示例2: UTF8StringToArray

	/**
	 * Converts UTF-8 strings to codepoints array.<br>
	 * Invalid byte sequences will be replaced with 0xFFFD (replacement character)<br>
	 * @param $str (string) string to process.
	 * @param $isunicode (boolean) True when the documetn is in Unicode mode, false otherwise.
	 * @param $currentfont (array) Reference to current font array.
	 * @return array containing codepoints (UTF-8 characters values)
	 * @author Nicola Asuni
	 * @public static
	 */
	public static function UTF8StringToArray($str, $isunicode=true, &$currentfont) {
		if ($isunicode) {
			// requires PCRE unicode support turned on
			$chars = TCPDF_STATIC::pregSplit('//','u', $str, -1, PREG_SPLIT_NO_EMPTY);
			$carr = array_map(array('TCPDF_FONTS', 'uniord'), $chars);
		} else {
			$chars = str_split($str);
			$carr = array_map('ord', $chars);
		}
		$currentfont['subsetchars'] += array_fill_keys($carr, true);
		return $carr;
	}
开发者ID:elcharlygraf,项目名称:Encuesta-YiiFramework,代码行数:22,代码来源:tcpdf_fonts.php


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