TCPDF_FONTS
class TCPDF_FONTS (View source)
Properties
static protected | $cache_uniord | Static cache used for speed up uniord performances |
Methods
Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable).
Returs the checksum of a TTF table.
Returns a subset of the TrueType font data without the unused glyphs.
Outputs font widths
Update the CIDToGIDMap string with a new value.
Return fonts path
Return font full path
Get a reference font size.
Returns the unicode caracter specified by the value
Returns the unicode caracter specified by UTF-8 value
Returns the unicode caracter specified by ASCII value
Converts array of UTF-8 characters to UTF16-BE string.
Based on: http://www.faqs.org/rfcs/rfc2781.html
Encoding UTF-16:
Convert an array of UTF8 values to array of unicode characters
Extract a slice of the $strarr array and return it as string.
Extract a slice of the $uniarr array and return it as string.
Converts UTF-8 characters array to array of Latin1 characters array
Converts UTF-8 characters array to Latin1 string
Converts UTF-8 character to integer value.
Uses the getUniord() method if the value is not cached.
Converts UTF-8 character to integer value.
Invalid byte sequences will be replaced with 0xFFFD (replacement character)
Based on: http://www.faqs.org/rfcs/rfc3629.html
Char. number range | UTF-8 octet sequence (hexadecimal) | (binary) --------------------+----------------------------------------------- 0000 0000-0000 007F | 0xxxxxxx 0000 0080-0000 07FF | 110xxxxx 10xxxxxx 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx ---------------------------------------------------------------------
Converts UTF-8 strings to codepoints array.
Invalid byte sequences will be replaced with 0xFFFD (replacement character)
Converts UTF-8 strings to Latin1 when using the standard 14 core fonts.
Converts UTF-8 strings to UTF16-BE.
Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).
Reverse the RLT substrings array using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).
Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).
Details
static string|false
addTTFfont(string $fontfile, string $fonttype = '', string $enc = '', int $flags = 32, string $outpath = '', int $platid = 3, int $encid = 1, bool $addcbbox = false, bool $link = false)
Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable).
static int
_getTTFtableChecksum(string $table, int $length)
Returs the checksum of a TTF table.
static string
_getTrueTypeFontSubset(string $font, array $subsetchars)
Returns a subset of the TrueType font data without the unused glyphs.
static string
_putfontwidths(array $font, int $cidoffset = 0)
Outputs font widths
static string
updateCIDtoGIDmap(string $map, int $cid, int $gid)
Update the CIDToGIDMap string with a new value.
static string
_getfontpath()
Return fonts path
static string
getFontFullPath(string $file, string $fontdir = false)
Return font full path
static float
getFontRefSize(string $size, float $refsize = 12)
Get a reference font size.
static string
unichr(int $c, bool $unicode = true)
Returns the unicode caracter specified by the value
static string
unichrUnicode(int $c)
Returns the unicode caracter specified by UTF-8 value
static string
unichrASCII(int $c)
Returns the unicode caracter specified by ASCII value
static protected string
arrUTF8ToUTF16BE(array $unicode, bool $setbom = false)
Converts array of UTF-8 characters to UTF16-BE string.
Based on: http://www.faqs.org/rfcs/rfc2781.html
Encoding UTF-16:Encoding of a single character from an ISO 10646 character value to UTF-16 proceeds as follows. Let U be the character number, no greater than 0x10FFFF.
1) If U < 0x10000, encode U as a 16-bit unsigned integer and terminate.
2) Let U' = U - 0x10000. Because U is less than or equal to 0x10FFFF, U' must be less than or equal to 0xFFFFF. That is, U' can be represented in 20 bits.
3) Initialize two 16-bit unsigned integers, W1 and W2, to 0xD800 and 0xDC00, respectively. These integers each have 10 bits free to encode the character value, for a total of 20 bits.
4) Assign the 10 high-order bits of the 20-bit U' to the 10 low-order bits of W1 and the 10 low-order bits of U' to the 10 low-order bits of W2. Terminate.
Graphically, steps 2 through 4 look like: U' = yyyyyyyyyyxxxxxxxxxx W1 = 110110yyyyyyyyyy W2 = 110111xxxxxxxxxx
static array
UTF8ArrayToUniArray(array $ta, bool $isunicode = true)
Convert an array of UTF8 values to array of unicode characters
static string
UTF8ArrSubString(string[] $strarr, int $start = '', int $end = '', bool $unicode = true)
Extract a slice of the $strarr array and return it as string.
static string
UniArrSubString(string[] $uniarr, int $start = '', int $end = '')
Extract a slice of the $uniarr array and return it as string.
static array
UTF8ArrToLatin1Arr(array $unicode)
Converts UTF-8 characters array to array of Latin1 characters array
static string
UTF8ArrToLatin1(array $unicode)
Converts UTF-8 characters array to Latin1 string
static int
uniord(string $uch)
Converts UTF-8 character to integer value.
Uses the getUniord() method if the value is not cached.
static int
getUniord(string $uch)
Converts UTF-8 character to integer value.
Invalid byte sequences will be replaced with 0xFFFD (replacement character)
Based on: http://www.faqs.org/rfcs/rfc3629.html
Char. number range | UTF-8 octet sequence (hexadecimal) | (binary) --------------------+----------------------------------------------- 0000 0000-0000 007F | 0xxxxxxx 0000 0080-0000 07FF | 110xxxxx 10xxxxxx 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx ---------------------------------------------------------------------ABFN notation:
UTF8-octets = *( UTF8-char ) UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4 UTF8-1 = %x00-7F UTF8-2 = %xC2-DF UTF8-tail
UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / %xF4 %x80-8F 2( UTF8-tail ) UTF8-tail = %x80-BF
static array
UTF8StringToArray(string $str, bool $isunicode, array $currentfont)
Converts UTF-8 strings to codepoints array.
Invalid byte sequences will be replaced with 0xFFFD (replacement character)
static string
UTF8ToLatin1(string $str, bool $isunicode, array $currentfont)
Converts UTF-8 strings to Latin1 when using the standard 14 core fonts.
static string
UTF8ToUTF16BE(string $str, bool $setbom, bool $isunicode, array $currentfont)
Converts UTF-8 strings to UTF16-BE.
static string
utf8StrRev(string $str, bool $setbom, bool $forcertl, bool $isunicode, array $currentfont)
Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).
static string
utf8StrArrRev(array $arr, string $str, bool $setbom, bool $forcertl, bool $isunicode, array $currentfont)
Reverse the RLT substrings array using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).
static array
utf8Bidi(array $ta, string $str, bool $forcertl, bool $isunicode, array $currentfont)
Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).