Esempio n. 1
0
 /**
  * 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 = TcpdfStatic::pregSplit('//', 'u', $str, -1, PREG_SPLIT_NO_EMPTY);
         $carr = array_map(array('self', 'uniord'), $chars);
     } else {
         $chars = str_split($str);
         $carr = array_map('ord', $chars);
     }
     $currentfont['subsetchars'] += array_fill_keys($carr, true);
     return $carr;
 }