Esempio n. 1
0
 function strcode2utf($str, $lo = true)
 {
     //converts all the &#nnn; and &#xhhh; in a string to Unicode
     if ($lo) {
         $lo = 1;
     } else {
         $lo = 0;
     }
     $str = preg_replace_callback('/\\&\\#([0-9]+)\\;/m', function ($m) use($lo) {
         return code2utf($m[1], $lo);
     }, $str);
     $str = preg_replace_callback('/\\&\\#x([0-9a-fA-F]+)\\;/m', function ($m) use($lo) {
         return codeHex2utf($m[1], $lo);
     }, $str);
     return $str;
 }
Esempio n. 2
0
 function strcode2utf($str, $lo = true)
 {
     //converts all the &#nnn; and &#xhhh; in a string to Unicode
     if ($lo) {
         $lo = 1;
     } else {
         $lo = 0;
     }
     //	$str = preg_replace('/\&\#([0-9]+)\;/me', "code2utf('\\1',{$lo})",$str);
     //	$str = preg_replace('/\&\#x([0-9a-fA-F]+)\;/me', "codeHex2utf('\\1',{$lo})",$str);
     $str = preg_replace_callback('/\\&\\#([0-9]+)\\;/m', function ($matches) {
         return code2utf($matches[1], $lo);
     }, $str);
     $str = preg_replace_callback('/\\&\\#x([0-9a-fA-F]+)\\;/m', function ($matches) {
         return codeHex2utf($matches[1], $lo);
     }, $str);
     return $str;
 }
Esempio n. 3
0
 function fixCSS($prop)
 {
     if (!is_array($prop) || count($prop) == 0) {
         return array();
     }
     $newprop = array();
     foreach ($prop as $k => $v) {
         if ($k != 'BACKGROUND-IMAGE' && $k != 'BACKGROUND' && $k != 'ODD-HEADER-NAME' && $k != 'EVEN-HEADER-NAME' && $k != 'ODD-FOOTER-NAME' && $k != 'EVEN-FOOTER-NAME' && $k != 'HEADER' && $k != 'FOOTER') {
             $v = strtolower($v);
         }
         if ($k == 'FONT') {
             $s = trim($v);
             preg_match_all('/\\"(.*?)\\"/', $s, $ff);
             if (count($ff[1])) {
                 foreach ($ff[1] as $ffp) {
                     $w = preg_split('/\\s+/', $ffp);
                     $s = preg_replace('/\\"' . $ffp . '\\"/', $w[0], $s);
                 }
             }
             preg_match_all('/\'(.*?)\'/', $s, $ff);
             if (count($ff[1])) {
                 foreach ($ff[1] as $ffp) {
                     $w = preg_split('/\\s+/', $ffp);
                     $s = preg_replace('/\'' . $ffp . '\'/', $w[0], $s);
                 }
             }
             $s = preg_replace('/\\s*,\\s*/', ',', $s);
             $bits = preg_split('/\\s+/', $s);
             if (count($bits) > 1) {
                 $k = 'FONT-FAMILY';
                 $v = $bits[count($bits) - 1];
                 $fs = $bits[count($bits) - 2];
                 if (preg_match('/(.*?)\\/(.*)/', $fs, $fsp)) {
                     $newprop['FONT-SIZE'] = $fsp[1];
                     $newprop['LINE-HEIGHT'] = $fsp[2];
                 } else {
                     $newprop['FONT-SIZE'] = $fs;
                 }
                 if (preg_match('/(italic|oblique)/i', $s)) {
                     $newprop['FONT-STYLE'] = 'italic';
                 } else {
                     $newprop['FONT-STYLE'] = 'normal';
                 }
                 if (preg_match('/bold/i', $s)) {
                     $newprop['FONT-WEIGHT'] = 'bold';
                 } else {
                     $newprop['FONT-WEIGHT'] = 'normal';
                 }
                 if (preg_match('/small-caps/i', $s)) {
                     $newprop['TEXT-TRANSFORM'] = 'uppercase';
                 }
             }
         }
         if ($k == 'FONT-FAMILY') {
             $aux_fontlist = explode(",", $v);
             $found = 0;
             foreach ($aux_fontlist as $f) {
                 $fonttype = trim($f);
                 $fonttype = preg_replace('/["\']*(.*?)["\']*/', '\\1', $fonttype);
                 $fonttype = preg_replace('/ /', '', $fonttype);
                 $v = strtolower(trim($fonttype));
                 if (isset($this->mpdf->fonttrans[$v]) && $this->mpdf->fonttrans[$v]) {
                     $v = $this->mpdf->fonttrans[$v];
                 }
                 if (!$this->mpdf->onlyCoreFonts && in_array($v, $this->mpdf->available_unifonts) || in_array($v, array('ccourier', 'ctimes', 'chelvetica')) || $this->mpdf->onlyCoreFonts && in_array($v, array('courier', 'times', 'helvetica', 'arial')) || in_array($v, array('sjis', 'uhc', 'big5', 'gb'))) {
                     $newprop[$k] = $v;
                     $found = 1;
                     break;
                 }
             }
             if (!$found) {
                 foreach ($aux_fontlist as $f) {
                     $fonttype = trim($f);
                     $fonttype = preg_replace('/["\']*(.*?)["\']*/', '\\1', $fonttype);
                     $fonttype = preg_replace('/ /', '', $fonttype);
                     $v = strtolower(trim($fonttype));
                     if (isset($this->mpdf->fonttrans[$v]) && $this->mpdf->fonttrans[$v]) {
                         $v = $this->mpdf->fonttrans[$v];
                     }
                     if (in_array($v, $this->mpdf->sans_fonts) || in_array($v, $this->mpdf->serif_fonts) || in_array($v, $this->mpdf->mono_fonts)) {
                         $newprop[$k] = $v;
                         break;
                     }
                 }
             }
         } else {
             if ($k == 'MARGIN') {
                 $tmp = $this->expand24($v);
                 $newprop['MARGIN-TOP'] = $tmp['T'];
                 $newprop['MARGIN-RIGHT'] = $tmp['R'];
                 $newprop['MARGIN-BOTTOM'] = $tmp['B'];
                 $newprop['MARGIN-LEFT'] = $tmp['L'];
             } else {
                 if ($k == 'BORDER-RADIUS' || $k == 'BORDER-TOP-LEFT-RADIUS' || $k == 'BORDER-TOP-RIGHT-RADIUS' || $k == 'BORDER-BOTTOM-LEFT-RADIUS' || $k == 'BORDER-BOTTOM-RIGHT-RADIUS') {
                     $tmp = $this->border_radius_expand($v, $k);
                     if (isset($tmp['TL-H'])) {
                         $newprop['BORDER-TOP-LEFT-RADIUS-H'] = $tmp['TL-H'];
                     }
                     if (isset($tmp['TL-V'])) {
                         $newprop['BORDER-TOP-LEFT-RADIUS-V'] = $tmp['TL-V'];
                     }
                     if (isset($tmp['TR-H'])) {
                         $newprop['BORDER-TOP-RIGHT-RADIUS-H'] = $tmp['TR-H'];
                     }
                     if (isset($tmp['TR-V'])) {
                         $newprop['BORDER-TOP-RIGHT-RADIUS-V'] = $tmp['TR-V'];
                     }
                     if (isset($tmp['BL-H'])) {
                         $newprop['BORDER-BOTTOM-LEFT-RADIUS-H'] = $tmp['BL-H'];
                     }
                     if (isset($tmp['BL-V'])) {
                         $newprop['BORDER-BOTTOM-LEFT-RADIUS-V'] = $tmp['BL-V'];
                     }
                     if (isset($tmp['BR-H'])) {
                         $newprop['BORDER-BOTTOM-RIGHT-RADIUS-H'] = $tmp['BR-H'];
                     }
                     if (isset($tmp['BR-V'])) {
                         $newprop['BORDER-BOTTOM-RIGHT-RADIUS-V'] = $tmp['BR-V'];
                     }
                 } else {
                     if ($k == 'PADDING') {
                         $tmp = $this->expand24($v);
                         $newprop['PADDING-TOP'] = $tmp['T'];
                         $newprop['PADDING-RIGHT'] = $tmp['R'];
                         $newprop['PADDING-BOTTOM'] = $tmp['B'];
                         $newprop['PADDING-LEFT'] = $tmp['L'];
                     } else {
                         if ($k == 'BORDER') {
                             if ($v == '1') {
                                 $v = '1px solid #000000';
                             } else {
                                 $v = $this->_fix_borderStr($v);
                             }
                             $newprop['BORDER-TOP'] = $v;
                             $newprop['BORDER-RIGHT'] = $v;
                             $newprop['BORDER-BOTTOM'] = $v;
                             $newprop['BORDER-LEFT'] = $v;
                         } else {
                             if ($k == 'BORDER-TOP') {
                                 $newprop['BORDER-TOP'] = $this->_fix_borderStr($v);
                             } else {
                                 if ($k == 'BORDER-RIGHT') {
                                     $newprop['BORDER-RIGHT'] = $this->_fix_borderStr($v);
                                 } else {
                                     if ($k == 'BORDER-BOTTOM') {
                                         $newprop['BORDER-BOTTOM'] = $this->_fix_borderStr($v);
                                     } else {
                                         if ($k == 'BORDER-LEFT') {
                                             $newprop['BORDER-LEFT'] = $this->_fix_borderStr($v);
                                         } else {
                                             if ($k == 'BORDER-STYLE') {
                                                 $e = $this->expand24($v);
                                                 $newprop['BORDER-TOP-STYLE'] = $e['T'];
                                                 $newprop['BORDER-RIGHT-STYLE'] = $e['R'];
                                                 $newprop['BORDER-BOTTOM-STYLE'] = $e['B'];
                                                 $newprop['BORDER-LEFT-STYLE'] = $e['L'];
                                             } else {
                                                 if ($k == 'BORDER-WIDTH') {
                                                     $e = $this->expand24($v);
                                                     $newprop['BORDER-TOP-WIDTH'] = $e['T'];
                                                     $newprop['BORDER-RIGHT-WIDTH'] = $e['R'];
                                                     $newprop['BORDER-BOTTOM-WIDTH'] = $e['B'];
                                                     $newprop['BORDER-LEFT-WIDTH'] = $e['L'];
                                                 } else {
                                                     if ($k == 'BORDER-COLOR') {
                                                         $e = $this->expand24($v);
                                                         $newprop['BORDER-TOP-COLOR'] = $e['T'];
                                                         $newprop['BORDER-RIGHT-COLOR'] = $e['R'];
                                                         $newprop['BORDER-BOTTOM-COLOR'] = $e['B'];
                                                         $newprop['BORDER-LEFT-COLOR'] = $e['L'];
                                                     } else {
                                                         if ($k == 'BORDER-SPACING') {
                                                             $prop = preg_split('/\\s+/', trim($v));
                                                             if (count($prop) == 1) {
                                                                 $newprop['BORDER-SPACING-H'] = $prop[0];
                                                                 $newprop['BORDER-SPACING-V'] = $prop[0];
                                                             } else {
                                                                 if (count($prop) == 2) {
                                                                     $newprop['BORDER-SPACING-H'] = $prop[0];
                                                                     $newprop['BORDER-SPACING-V'] = $prop[1];
                                                                 }
                                                             }
                                                         } else {
                                                             if ($k == 'TEXT-OUTLINE') {
                                                                 // mPDF 5.6.07
                                                                 $prop = preg_split('/\\s+/', trim($v));
                                                                 if (trim(strtolower($v)) == 'none') {
                                                                     $newprop['TEXT-OUTLINE'] = 'none';
                                                                 } else {
                                                                     if (count($prop) == 2) {
                                                                         $newprop['TEXT-OUTLINE-WIDTH'] = $prop[0];
                                                                         $newprop['TEXT-OUTLINE-COLOR'] = $prop[1];
                                                                     } else {
                                                                         if (count($prop) == 3) {
                                                                             $newprop['TEXT-OUTLINE-WIDTH'] = $prop[0];
                                                                             $newprop['TEXT-OUTLINE-COLOR'] = $prop[2];
                                                                         }
                                                                     }
                                                                 }
                                                             } else {
                                                                 if ($k == 'SIZE') {
                                                                     $prop = preg_split('/\\s+/', trim($v));
                                                                     if (preg_match('/(auto|portrait|landscape)/', $prop[0])) {
                                                                         $newprop['SIZE'] = strtoupper($prop[0]);
                                                                     } else {
                                                                         if (count($prop) == 1) {
                                                                             $newprop['SIZE']['W'] = $this->mpdf->ConvertSize($prop[0]);
                                                                             $newprop['SIZE']['H'] = $this->mpdf->ConvertSize($prop[0]);
                                                                         } else {
                                                                             if (count($prop) == 2) {
                                                                                 $newprop['SIZE']['W'] = $this->mpdf->ConvertSize($prop[0]);
                                                                                 $newprop['SIZE']['H'] = $this->mpdf->ConvertSize($prop[1]);
                                                                             }
                                                                         }
                                                                     }
                                                                 } else {
                                                                     if ($k == 'SHEET-SIZE') {
                                                                         $prop = preg_split('/\\s+/', trim($v));
                                                                         if (count($prop) == 2) {
                                                                             $newprop['SHEET-SIZE'] = array($this->mpdf->ConvertSize($prop[0]), $this->mpdf->ConvertSize($prop[1]));
                                                                         } else {
                                                                             if (preg_match('/([0-9a-zA-Z]*)-L/i', $v, $m)) {
                                                                                 // e.g. A4-L = A$ landscape
                                                                                 $ft = $this->mpdf->_getPageFormat($m[1]);
                                                                                 $format = array($ft[1], $ft[0]);
                                                                             } else {
                                                                                 $format = $this->mpdf->_getPageFormat($v);
                                                                             }
                                                                             if ($format) {
                                                                                 $newprop['SHEET-SIZE'] = array($format[0] / _MPDFK, $format[1] / _MPDFK);
                                                                             }
                                                                         }
                                                                     } else {
                                                                         if ($k == 'BACKGROUND') {
                                                                             $bg = $this->parseCSSbackground($v);
                                                                             if ($bg['c']) {
                                                                                 $newprop['BACKGROUND-COLOR'] = $bg['c'];
                                                                             } else {
                                                                                 $newprop['BACKGROUND-COLOR'] = 'transparent';
                                                                             }
                                                                             /*-- BACKGROUNDS --*/
                                                                             if ($bg['i']) {
                                                                                 $newprop['BACKGROUND-IMAGE'] = $bg['i'];
                                                                                 if ($bg['r']) {
                                                                                     $newprop['BACKGROUND-REPEAT'] = $bg['r'];
                                                                                 }
                                                                                 if ($bg['p']) {
                                                                                     $newprop['BACKGROUND-POSITION'] = $bg['p'];
                                                                                 }
                                                                             } else {
                                                                                 $newprop['BACKGROUND-IMAGE'] = '';
                                                                             }
                                                                             /*-- END BACKGROUNDS --*/
                                                                         } else {
                                                                             if ($k == 'BACKGROUND-IMAGE') {
                                                                                 if (preg_match('/(-moz-)*(repeating-)*(linear|radial)-gradient\\(.*\\)/i', $v, $m)) {
                                                                                     $newprop['BACKGROUND-IMAGE'] = $m[0];
                                                                                     continue;
                                                                                 }
                                                                                 if (preg_match('/url\\([\'\\"]{0,1}(.*?)[\'\\"]{0,1}\\)/i', $v, $m)) {
                                                                                     $newprop['BACKGROUND-IMAGE'] = $m[1];
                                                                                 } else {
                                                                                     if (strtolower($v) == 'none') {
                                                                                         $newprop['BACKGROUND-IMAGE'] = '';
                                                                                     }
                                                                                 }
                                                                             } else {
                                                                                 if ($k == 'BACKGROUND-REPEAT') {
                                                                                     if (preg_match('/(repeat-x|repeat-y|no-repeat|repeat)/i', $v, $m)) {
                                                                                         $newprop['BACKGROUND-REPEAT'] = strtolower($m[1]);
                                                                                     }
                                                                                 } else {
                                                                                     if ($k == 'BACKGROUND-POSITION') {
                                                                                         $s = $v;
                                                                                         $bits = preg_split('/\\s+/', trim($s));
                                                                                         // These should be Position x1 or x2
                                                                                         if (count($bits) == 1) {
                                                                                             if (preg_match('/bottom/', $bits[0])) {
                                                                                                 $bg['p'] = '50% 100%';
                                                                                             } else {
                                                                                                 if (preg_match('/top/', $bits[0])) {
                                                                                                     $bg['p'] = '50% 0%';
                                                                                                 } else {
                                                                                                     $bg['p'] = $bits[0] . ' 50%';
                                                                                                 }
                                                                                             }
                                                                                         } else {
                                                                                             if (count($bits) == 2) {
                                                                                                 // Can be either right center or center right
                                                                                                 if (preg_match('/(top|bottom)/', $bits[0]) || preg_match('/(left|right)/', $bits[1])) {
                                                                                                     $bg['p'] = $bits[1] . ' ' . $bits[0];
                                                                                                 } else {
                                                                                                     $bg['p'] = $bits[0] . ' ' . $bits[1];
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                         if ($bg['p']) {
                                                                                             $bg['p'] = preg_replace('/(left|top)/', '0%', $bg['p']);
                                                                                             $bg['p'] = preg_replace('/(right|bottom)/', '100%', $bg['p']);
                                                                                             $bg['p'] = preg_replace('/(center)/', '50%', $bg['p']);
                                                                                             if (!preg_match('/[\\-]{0,1}\\d+(in|cm|mm|pt|pc|em|ex|px|%)* [\\-]{0,1}\\d+(in|cm|mm|pt|pc|em|ex|px|%)*/', $bg['p'])) {
                                                                                                 $bg['p'] = false;
                                                                                             }
                                                                                         }
                                                                                         if ($bg['p']) {
                                                                                             $newprop['BACKGROUND-POSITION'] = $bg['p'];
                                                                                         }
                                                                                     } else {
                                                                                         if ($k == 'IMAGE-ORIENTATION') {
                                                                                             if (preg_match('/([\\-]*[0-9\\.]+)(deg|grad|rad)/i', $v, $m)) {
                                                                                                 $angle = $m[1] + 0;
                                                                                                 if (strtolower($m[2]) == 'deg') {
                                                                                                     $angle = $angle;
                                                                                                 } else {
                                                                                                     if (strtolower($m[2]) == 'grad') {
                                                                                                         $angle *= 360 / 400;
                                                                                                     } else {
                                                                                                         if (strtolower($m[2]) == 'rad') {
                                                                                                             $angle = rad2deg($angle);
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                                 while ($angle < 0) {
                                                                                                     $angle += 360;
                                                                                                 }
                                                                                                 $angle = $angle % 360;
                                                                                                 $angle /= 90;
                                                                                                 $angle = round($angle) * 90;
                                                                                                 $newprop['IMAGE-ORIENTATION'] = $angle;
                                                                                             }
                                                                                         } else {
                                                                                             if ($k == 'TEXT-ALIGN') {
                                                                                                 if (preg_match('/["\'](.){1}["\']/i', $v, $m)) {
                                                                                                     $d = array_search($m[1], $this->mpdf->decimal_align);
                                                                                                     if ($d !== false) {
                                                                                                         $newprop['TEXT-ALIGN'] = $d;
                                                                                                     }
                                                                                                     if (preg_match('/(center|left|right)/i', $v, $m)) {
                                                                                                         $newprop['TEXT-ALIGN'] .= strtoupper(substr($m[1], 0, 1));
                                                                                                     } else {
                                                                                                         $newprop['TEXT-ALIGN'] .= 'R';
                                                                                                     }
                                                                                                     // default = R
                                                                                                 } else {
                                                                                                     if (preg_match('/["\'](\\\\[a-fA-F0-9]{1,6})["\']/i', $v, $m)) {
                                                                                                         $utf8 = codeHex2utf(substr($m[1], 1, 6));
                                                                                                         $d = array_search($utf8, $this->mpdf->decimal_align);
                                                                                                         if ($d !== false) {
                                                                                                             $newprop['TEXT-ALIGN'] = $d;
                                                                                                         }
                                                                                                         if (preg_match('/(center|left|right)/i', $v, $m)) {
                                                                                                             $newprop['TEXT-ALIGN'] .= strtoupper(substr($m[1], 0, 1));
                                                                                                         } else {
                                                                                                             $newprop['TEXT-ALIGN'] .= 'R';
                                                                                                         }
                                                                                                         // default = R
                                                                                                     } else {
                                                                                                         $newprop[$k] = $v;
                                                                                                     }
                                                                                                 }
                                                                                             } else {
                                                                                                 if ($k == 'LIST-STYLE') {
                                                                                                     // mPDF 5.7.2
                                                                                                     if (preg_match('/(lower-roman|upper-roman|lower-latin|lower-alpha|upper-latin|upper-alpha|none|decimal|disc|circle|square|arabic-indic|bengali|devanagari|gujarati|gurmukhi|kannada|malayalam|oriya|persian|tamil|telugu|thai|urdu|cambodian|khmer|lao)/i', $v, $m) || preg_match('/U\\+([a-fA-F0-9]+)/i', $v, $m)) {
                                                                                                         $newprop['LIST-STYLE-TYPE'] = strtolower(trim($m[1]));
                                                                                                     }
                                                                                                 } else {
                                                                                                     $newprop[$k] = $v;
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $newprop;
 }
function codeHex2utf_lo_callback($matches)
{
    return codeHex2utf($matches[1], 1);
}
Esempio n. 5
0
function printlistbuffer() {
    //Save x coordinate
    $x = $this->lMargin + $this->blk[$this->blklvl]['outer_left_margin'];
    $this->cMarginL = 0;
    $this->cMarginR = 0;
    $currIndentLvl = -1;
    $lastIndent = array();
    $bak_page = $this->page;
    $indent = 0;  
    foreach($this->listitem as $item)
    {
	// COLS
	$oldcolumn = $this->CurrCol;

	$this->bulletarray = array();
	//Get list's buffered data
	$this->listlvl = $lvl = $item[0];
	$num = $item[1];
	$this->textbuffer = $item[2];
	$occur = $item[3];
	if ($item[4]) { $type = $item[4]; }	// listitemtype
	else { $type = $this->listlist[$lvl][$occur]['TYPE']; }
	$maxnum = $this->listlist[$lvl][$occur]['MAXNUM'];
	$this->restoreInlineProperties($this->InlineProperties['LIST'][$lvl][$occur]);
	$this->SetFont($this->FontFamily,$this->FontStyle,$this->FontSizePt,true,true);	// force to write
	$clh = $this->FontSize;

	$this->SetLineHeight($this->FontSizePt,$this->list_lineheight[$lvl][$occur]);
	$this->listOcc = $occur; 
	$this->listnum = $num; 

	if (isset($this->list_align[$this->listlvl][$occur])) { $this->divalign = $this->list_align[$this->listlvl][$occur]; }
	else { 
		if (isset($this->blk[$this->blklvl]['direction']) && $this->blk[$this->blklvl]['direction']=='rtl') { $this->divalign = 'R'; }
		else { $this->divalign = 'L'; }
	}

	// Set the bullet fontsize
	$bullfs = $this->InlineProperties['LISTITEM'][$lvl][$occur][$num]['size'];

	$space_width = $this->GetCharWidth(' ',false) * 1.5;

	//Set default width & height values
	$this->divwidth = $this->blk[$this->blklvl]['inner_width'];
	$this->divheight = $this->lineheight;
	$typefont = $this->FontFamily;
	if (preg_match('/U\+([a-fA-F0-9]+)/i',$type,$m)) {
		if ($this->_charDefined($this->CurrentFont['cw'],hexdec($m[1]))) { $list_item_marker = codeHex2utf($m[1]); }
		else { $list_item_marker = '-'; }
		$blt_width = $this->GetStringWidth($list_item_marker);
		$typefont = '';
		if (preg_match('/rgb\(.*?\)/',$type,$m)) {
			$list_item_color = $this->ConvertColor($m[0]); 
		}
	}
	else {
		$list_item_color = false; 

	  switch($type) //Format type
	  {
          case '1':
		  if ($this->listDir == 'rtl') { $list_item_marker = $this->list_number_suffix . $num; }
		  else { $list_item_marker = $num . $this->list_number_suffix; }
	        $blt_width = $this->GetStringWidth(str_repeat('5',strlen($maxnum)).$this->list_number_suffix);
              break;
          case 'none':
		  $list_item_marker = '';
  	        $blt_width = 0;
             break;
          case 'A':
		  $anum = $this->dec2alpha($num,true);
		  $maxnum = $this->dec2alpha($maxnum,true);
		  if ($this->listDir == 'rtl') { $list_item_marker = $this->list_number_suffix . $anum; }
		  else { $list_item_marker = $anum . $this->list_number_suffix; }
  	        $blt_width = $this->GetStringWidth(str_repeat('W',strlen($maxnum)).$this->list_number_suffix);
             break;
          case 'a':
              $anum = $this->dec2alpha($num,false);
		  $maxnum = $this->dec2alpha($maxnum,false);
		  if ($this->listDir == 'rtl') { $list_item_marker = $this->list_number_suffix . $anum; }
		  else { $list_item_marker = $anum . $this->list_number_suffix; }
		  $blt_width = $this->GetStringWidth(str_repeat('m',strlen($maxnum)).$this->list_number_suffix);
             break;
          case 'I':
              $anum = $this->dec2roman($num,true);
		  if ($this->listDir == 'rtl') { $list_item_marker = $this->list_number_suffix . $anum; }
		  else { $list_item_marker = $anum . $this->list_number_suffix; }
		  
		  if ($maxnum>87) { $bbit = 87; }
		  else if ($maxnum>86) { $bbit = 86; }
		  else if ($maxnum>37) { $bbit = 38; }
		  else if ($maxnum>36) { $bbit = 37; }
		  else if ($maxnum>27) { $bbit = 28; }
		  else if ($maxnum>26) { $bbit = 27; }
		  else if ($maxnum>17) { $bbit = 18; }
		  else if ($maxnum>16) { $bbit = 17; }
		  else if ($maxnum>7) { $bbit = 8; }
		  else if ($maxnum>6) { $bbit = 7; }
		  else if ($maxnum>3) { $bbit = 4; }
		  else { $bbit = $maxnum; }
              $maxlnum = $this->dec2roman($bbit,true);
	        $blt_width = $this->GetStringWidth($maxlnum.$this->list_number_suffix);
              break;
          case 'i':
              $anum = $this->dec2roman($num,false);
		  if ($this->listDir == 'rtl') { $list_item_marker = $this->list_number_suffix . $anum; }
		  else { $list_item_marker = $anum . $this->list_number_suffix; }
		  
		  if ($maxnum>87) { $bbit = 87; }
		  else if ($maxnum>86) { $bbit = 86; }
		  else if ($maxnum>37) { $bbit = 38; }
		  else if ($maxnum>36) { $bbit = 37; }
		  else if ($maxnum>27) { $bbit = 28; }
		  else if ($maxnum>26) { $bbit = 27; }
		  else if ($maxnum>17) { $bbit = 18; }
		  else if ($maxnum>16) { $bbit = 17; }
		  else if ($maxnum>7) { $bbit = 8; }
		  else if ($maxnum>6) { $bbit = 7; }
		  else if ($maxnum>3) { $bbit = 4; }
		  else { $bbit = $maxnum; }
              $maxlnum = $this->dec2roman($bbit,false);
		  
	        $blt_width = $this->GetStringWidth($maxlnum.$this->list_number_suffix);
              break;
          case 'disc':
		  if ($this->PDFA || $this->PDFX) {
			if ($this->_charDefined($this->CurrentFont['cw'],8226)) { $list_item_marker = "\xe2\x80\xa2"; } 	// &#8226; 
			else { $list_item_marker = '-'; }
  			$blt_width = $this->GetCharWidth($list_item_marker);
			break;
		  }
              $list_item_marker = chr(108); // bullet disc in Zapfdingbats  'l'
		  $typefont = 'czapfdingbats';
		  $blt_width = (0.791 * $this->FontSize/2.5); 
              break;
          case 'circle':
		  if ($this->PDFA || $this->PDFX) {
			if ($this->_charDefined($this->CurrentFont['cw'],9900)) { $list_item_marker = "\xe2\x9a\xac"; } // &#9900; 
			else { $list_item_marker = '-'; }
  			$blt_width = $this->GetCharWidth($list_item_marker);
			break;
		  }
              $list_item_marker = chr(109); // circle in Zapfdingbats   'm'
		  $typefont = 'czapfdingbats';
		  $blt_width = (0.873 * $this->FontSize/2.5); 
              break;
          case 'square':
		  if ($this->PDFA || $this->PDFX) {
			if ($this->_charDefined($this->CurrentFont['cw'],9642)) { $list_item_marker = "\xe2\x96\xaa"; } // &#9642; 
			else { $list_item_marker = '-'; }
  			$blt_width = $this->GetCharWidth($list_item_marker);
			break;
		  }
              $list_item_marker = chr(110); //black square in Zapfdingbats font   'n'
		  $typefont = 'czapfdingbats';
		  $blt_width = (0.761 * $this->FontSize/2.5); 
              break;

/*  CSS3 list-styles numeric + I added tamil
arabic-indic | bengali | cambodian | devanagari | gujarati | gurmukhi | kannada | khmer | lao | malayalam | mongolian | myanmar | oriya | persian | telugu | tibetan | thai | urdu 
*/
          case 'arabic-indic':
		  $cp = 0x0660;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $this->list_number_suffix . $rnum; 	// RTL
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(3, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
          case 'persian':
          case 'urdu':
		  $cp = 0x06F0;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $this->list_number_suffix . $rnum; 	// RTL
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(3, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
          case 'bengali':
		  $cp = 0x09E6;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $rnum . $this->list_number_suffix; 
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(3, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
          case 'devanagari':
		  $cp = 0x0966;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $rnum . $this->list_number_suffix; 
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(3, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
          case 'gujarati':
		  $cp = 0x0AE6;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $rnum . $this->list_number_suffix; 
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(3, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
          case 'gurmukhi':
		  $cp = 0x0A66;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $rnum . $this->list_number_suffix; 
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(3, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
          case 'kannada':
		  $cp = 0x0CE6;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $rnum . $this->list_number_suffix; 
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(3, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
          case 'malayalam':
		  $cp = 0x0D66;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $rnum . $this->list_number_suffix; 
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(6, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
          case 'oriya':
		  $cp = 0x0B66;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $rnum . $this->list_number_suffix; 
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(3, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
          case 'telugu':
		  $cp = 0x0C66;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $rnum . $this->list_number_suffix; 
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(3, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
          case 'tamil':
		  $cp = 0x0BE6;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $rnum . $this->list_number_suffix; 
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(9, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
          case 'thai':
		  $cp = 0x0E50;
		  $rnum = $this->dec2other($num, $cp);
		  $list_item_marker = $rnum . $this->list_number_suffix; 
  	        $blt_width = $this->GetStringWidth(str_repeat($this->dec2other(5, $cp),strlen($maxnum)).$this->list_number_suffix);
		  break;
	    default:
		  if ($this->listDir == 'rtl') { $list_item_marker = $this->list_number_suffix . $num; }
		  else { $list_item_marker = $num . $this->list_number_suffix; }
	        $blt_width = $this->GetStringWidth(str_repeat('5',strlen($maxnum)).$this->list_number_suffix);
              break;
	  }
	}

	if (isset($item[5]) && $item[5]) { $list_item_marker = ''; }

	if ($currIndentLvl < $lvl) {
		if ($lvl > 1 || $this->list_indent_first_level) { 
			$indent += $this->list_indent[$lvl][$occur]; 
			$lastIndent[$lvl] = $this->list_indent[$lvl][$occur];
		}
	}
	else if ($currIndentLvl > $lvl) {
	    while ($currIndentLvl > $lvl) {
		$indent -= $lastIndent[$currIndentLvl];
		$currIndentLvl--;
	    }
	}
	$currIndentLvl = $lvl;


/*-- RTL --*/

	if ($this->listDir == 'rtl') { 
	  // list_align_style  Determines alignment of numbers in numbered lists
	  if ($this->list_align_style == 'L') { $lalign = 'R'; }
	  else { $lalign = 'L';  }
        $this->divwidth = $this->blk[$this->blklvl]['width'] - ($indent + $blt_width + $space_width) ;
        $xb = $this->blk[$this->blklvl]['inner_width'] + $this->blk[$this->blklvl]['border_left']['w'] + $this->blk[$this->blklvl]['padding_left'] - $indent - $blt_width; //Bullet position (relative)
        //Output bullet
	  $this->bulletarray = array('w'=>$blt_width,'h'=>$clh,'txt'=>$list_item_marker,'x'=>$xb,'align'=>$lalign,'font'=>$typefont,'level'=>$lvl, 'occur'=>$occur, 'num'=>$num, 'fontsize'=>$bullfs, 'col'=>$list_item_color );
	  $this->x = $x;
	}
	else {
/*-- END RTL --*/
	  
	  if ($this->list_align_style == 'L') { $lalign = 'L'; }
	  else { $lalign = 'R';  }
        $this->divwidth = $this->blk[$this->blklvl]['width'] - ($indent + $blt_width + $space_width) ;
	  $xb =  $this->blk[$this->blklvl]['padding_left'] + $this->blk[$this->blklvl]['border_left']['w'] - $blt_width - $space_width; 
        //Output bullet
	  $this->bulletarray = array('w'=>$blt_width,'h'=>$clh,'txt'=>$list_item_marker,'x'=>$xb,'align'=>$lalign,'font'=>$typefont,'level'=>$lvl, 'occur'=>$occur, 'num'=>$num, 'fontsize'=>$bullfs, 'col'=>$list_item_color );
	  $this->x = $x + $indent + $blt_width + $space_width;
	}	// *RTL*

      //Print content
  	$this->printbuffer($this->textbuffer,'',false,true);
      $this->textbuffer=array();

	// Added to correct for OddEven Margins
   	if  ($this->page != $bak_page) {
		if (($this->page-$bak_page) % 2 == 1) {
			$x += $this->MarginCorrection;
		}
		$bak_page = $this->page;
	}
/*-- COLUMNS --*/
	// OR COLUMN CHANGE
	if ($this->CurrCol != $oldcolumn) {
		if ($this->directionality == 'rtl') {	// *RTL*
			$x -= ($this->CurrCol - $oldcolumn) * ($this->ColWidth+$this->ColGap);	// *RTL*
		}	// *RTL*
		else {	// *RTL*
			$x += ($this->CurrCol - $oldcolumn) * ($this->ColWidth+$this->ColGap);
		}	// *RTL*
		$oldcolumn = $this->CurrCol;
	}
/*-- END COLUMNS --*/

    }

    //Reset all used values
    $this->listoccur = array();
    $this->listitem = array();
    $this->listlist = array();
    $this->listlvl = 0;
    $this->listnum = 0;
    $this->listtype = '';
    $this->textbuffer = array();
    $this->divwidth = 0;
    $this->divheight = 0;
    $this->x = $this->lMargin + $this->blk[$this->blklvl]['outer_left_margin'];
}