(PHP 4, PHP 5)
imagepsencodefont — 改變字體中的字符編碼矢量
說明
bool imagepsencodefont ( resource$font_index
, string $encodingfile
)
從文件中加載字符編碼矢量并用其替換給定字體的編碼矢量。由于 PostScript 字體的默認矢量缺少大多數超過 127 的字符位置,因此如果使用其它非英語的語言的話肯定需要改變它。編碼文件的確切格式定義在 T1lib 文檔中。T1lib 包含有兩個可馬上使用的文件,IsoLatin1.enc 和 IsoLatin2.enc。
如果發(fā)現自己總是要用本函數,更好的定義編碼的做法是在配置文件中將 ps.default_encoding 設定為指向正確的編碼文件,這樣加載的所有字體就會自動具有正確編碼了。
Note: 此函數僅在 PHP 編譯時指定了 --with-t1lib[=DIR] 時可用。
參數
font_index
A font resource, returned by imagepsloadfont().
encodingfile
The exact format of this file is described in T1libs documentation. T1lib comes with two ready-to-use files, IsoLatin1.enc and IsoLatin2.enc.
返回值
成功時返回 TRUE
, 或者在失敗時返回 FALSE
。
范例
Example #1 imagepsencodefont() example
<?php
// Load a .pfb font file
$font = imagepsloadfont('./px3l.pfb');
// Tell T1lib to use ISO Latin 1 encoding
imagepsencode($font, './IsoLatin1.enc');
// Do any operations with the font here
// Free the font from memory
imagepsfreefont($font);
?>
注釋
Note: 此函數僅在 PHP 編譯時指定了 --with-t1lib[=DIR] 時可用。