0

您好,我创建了一种自定义字体。现在我想在我的 php 脚本中使用它,一切都很好,直到我想使用s带有急性的字母,因为我得到的不仅仅是一个字母,而是字母+空格。这是我的font.php

<?php
$type='TrueType';
$name='TimesNewRomanPSMT';
$desc=array('Ascent'=>891,'Descent'=>-216,'CapHeight'=>7,'Flags'=>32,'FontBBox'=>'[-77 -226 936 886]','ItalicAngle'=>0,'StemV'=>70,'MissingWidth'=>778);
$up=-109;
$ut=49;
$cw=array(
0=>778,1=>778,2=>778,3=>778,4=>778,5=>778,6=>778,7=>778,8=>778,9=>778,
10=>778,11=>778,12=>778,13=>778,14=>778,15=>778,16=>778,17=>778,18=>778,19=>778,
20=>778,21=>778,22=>778,23=>778,24=>778,25=>778,26=>778,27=>778,28=>778,29=>778,
30=>778,31=>778,32=>250,33=>333,34=>408,35=>500,36=>500,37=>833,38=>778,39=>180,
40=>333,41=>333,42=>500,43=>564,44=>250,45=>333,46=>250,47=>278,48=>500,49=>500,
50=>500,51=>500,52=>500,53=>500,54=>500,55=>500,56=>500,57=>500,58=>278,59=>278,
60=>564,61=>564,62=>564,63=>444,64=>921,65=>722,66=>667,67=>667,68=>722,69=>611,
70=>556,71=>722,72=>722,73=>333,74=>389,75=>722,76=>611,77=>889,78=>722,79=>722,
80=>556,81=>722,82=>667,83=>556,84=>611,85=>722,86=>722,87=>944,88=>722,89=>722,
90=>611,91=>333,92=>278,93=>333,94=>469,95=>500,96=>333,97=>444,98=>500,99=>444,
100=>500,101=>444,102=>333,103=>500,104=>500,105=>278,106=>278,107=>500,108=>278,109=>778,
110=>500,111=>500,112=>500,113=>500,114=>333,115=>389,116=>278,117=>500,118=>500,119=>722,
120=>500,121=>500,122=>444,123=>480,124=>200,125=>480,126=>541,127=>778,128=>778,129=>778,
130=>778,131=>778,132=>778,133=>778,134=>778,135=>778,136=>778,137=>778,138=>778,139=>778,
140=>778,141=>778,142=>778,143=>778,144=>778,145=>778,146=>778,147=>778,148=>778,149=>778,
150=>778,151=>778,152=>778,153=>778,154=>778,155=>778,156=>778,157=>778,158=>778,159=>778,
160=>250,161=>722,162=>333,163=>611,164=>500,165=>611,166=>556,167=>500,168=>333,169=>556,
170=>556,171=>611,172=>611,173=>333,174=>611,175=>611,176=>400,177=>444,178=>333,179=>278,
180=>333,181=>406,182=>389,183=>333,184=>333,185=>389,186=>389,187=>427,188=>444,189=>333,
190=>444,191=>444,192=>667,193=>722,194=>722,195=>722,196=>722,197=>611,198=>667,199=>667,
200=>667,201=>611,202=>611,203=>611,204=>611,205=>333,206=>333,207=>722,208=>722,209=>722,
210=>722,211=>722,212=>722,213=>722,214=>722,215=>564,216=>667,217=>722,218=>722,219=>722,
220=>722,221=>722,222=>611,223=>500,224=>333,225=>444,226=>444,227=>444,228=>444,229=>278,
230=>444,231=>444,232=>444,233=>444,234=>444,235=>444,236=>444,237=>278,238=>278,239=>646,
240=>500,241=>500,242=>500,243=>500,244=>500,245=>500,246=>500,247=>549,248=>333,249=>500,
250=>500,251=>500,252=>500,253=>500,254=>278,255=>333);

$enc='iso-8859-2';
$diff='131 /.notdef 136 /.notdef 140 /Sacute /Tcaron 143 /Zacute 152 /.notdef 156 /sacute /tcaron 159 /zacute 161 /caron /breve /Lslash 165 /Aogonek 170 /Scedilla 175 /Zdot 178 /ogonek /lslash 185 /aogonek /scedilla 188 /Lcaron /hungarumlaut /lcaron /zdot /Racute 195 /Abreve 197 /Lacute /Cacute 200 /Ccaron 202 /Eogonek 204 /Ecaron 207 /Dcaron /Dslash /Nacute /Ncaron 213 /Odblacute 216 /Rcaron /Uring 219 /Udblacute 222 /Tcedilla 224 /racute 227 /abreve 229 /lacute /cacute 232 /ccaron 234 /eogonek 236 /ecaron 239 /dcaron /dmacron /nacute /ncaron 245 /odblacute 248 /rcaron /uring 251 /udblacute 254 /tcedilla /dotaccent';
$file='times.z';
$originalsize=409280;
// --- EOF ---

我应该做什么来Ś代替Ś with space

4

1 回答 1

1

假设 Array$cw包含每个字符的字符宽度:

  • 字符0x53 (83)(S in ASCII) 的宽度为556
  • 字符0x73 (115)(s in ASCII) 的宽度为389
  • 字符0x8C (140)(Ś in cp1250) 的宽度为778
  • 字符0x9C (156)(ś in cp1250) 的宽度为778
  • 字符0xA6 (166)(Ś in iso-8859-2) 的宽度为556
  • 字符0xB6 (182)(ś in iso-8859-2) 的宽度为389

现在我不知道这些宽度的真正来源,但可能是因为你 -- 输出?-- 使用代码页的字体cp1250(你在评论中写了这个),但是在你的源代码中将编码设置为iso-8859-2. 您可以在Wikipedia Windows-1250中查找两个代码页之间的差异

因此,您可以使用iso-8859-2代码页再次导出,更改脚本中的代码页,或手动更改宽度。请记住,这两个代码页中还有其他不同的字符,因此您可能也想更改它们。

于 2013-04-25T11:51:49.660 回答