百科狗-知识改变命运!

imagepsencodefont() - gd函数(图像处理)

是丫丫呀2年前 (2023-11-21)阅读数 17#技术干货
文章标签矢量

imagepsencodefont()

(PHP 4, PHP 5)

改变字体中的字符编码矢量

imagepsencodefont() - gd函数(图像处理)

说明

imagepsencodefont(resource $font_index,string $encodingfile): bool

从文件中加载字符编码矢量并用其替换给定字体的编码矢量。由于 PostScript 字体的默认矢量缺少大多数超过 127 的字符位置,因此如果使用其它非英语的语言的话肯定需要改变它。编码文件的确切格式定义在 T1lib 文档中。T1lib 包含有两个可马上使用的文件,IsoLatin1.enc 和 IsoLatin2.enc。

如果发现自己总是要用本函数,更好的定义编码的做法是在配置文件中将 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.encandIsoLatin2.enc.

返回值

成功时返回TRUE,或者在失败时返回FALSE

范例

imagepsencodefont()example


注释

Note:此函数仅在 PHP编译时指定了--with-t1lib[=DIR]时可用。

The t1lib-5.0.0 source includes 5 different encoding files under Fonts/enc/. For my text with German umlauts, using IsoLatin1.enc did not work, but PSLatin1.enc did the trick.
Because I have had problems with this function to find out that there is no result to store in a variable, a short example how to use:
$font = imagepsloadfont( "/home/www/font/Arial.pfb" );
imagepsencodefont( $font, "/home/www/font/IsoLatin1.enc" );
afterwards you can use the resource $font in each other ps function like imagepstext() or imagepsbbox().

内容声明:本文中引用的各种信息及资料(包括但不限于文字、数据、图表及超链接等)均来源于该信息及资料的相关主体(包括但不限于公司、媒体、协会等机构)的官方网站或公开发表的信息。部分内容参考包括:(百度百科,百度知道,头条百科,中国民法典,刑法,牛津词典,新华词典,汉语词典,国家院校,科普平台)等数据,内容仅供参考使用,不准确地方联系删除处理!本站为非盈利性质站点,本着为中国教育事业出一份力,发布内容不收取任何费用也不接任何广告!)
{if $zbp->Config('yd1125')->foot}