fpdf custom font works but not on any other computer

229 views Asked by At

I'm generating PDF invoices using fpdf and I would like to use a custom font. I got that working by converting the font and adding it to the fpdf and it works but if I open the PDF on any other computer the font is gone

the sample of converted font (OpenSans)

<?php
$type='TrueType';
$name='OpenSans';
$desc=array('Ascent'=>1069,'Descent'=>-293,'CapHeight'=>714,'Flags'=>32,'FontBBox'=>'[-550 -271 1204 1048]','ItalicAngle'=>0,'StemV'=>70,'MissingWidth'=>600);
$up=-75;
$ut=50;
$cw=array(
    chr(0)=>600,chr(1)=>600,chr(2)=>600,chr(3)=>600,chr(4)=>600,chr(5)=>600,chr(6)=>600,chr(7)=>600,chr(8)=>600,chr(9)=>600,chr(10)=>600,chr(11)=>600,chr(12)=>600,chr(13)=>600,chr(14)=>600,chr(15)=>600,chr(16)=>600,chr(17)=>600,chr(18)=>600,chr(19)=>600,chr(20)=>600,chr(21)=>600,
    chr(22)=>600,chr(23)=>600,chr(24)=>600,chr(25)=>600,chr(26)=>600,chr(27)=>600,chr(28)=>600,chr(29)=>600,chr(30)=>600,chr(31)=>600,' '=>260,'!'=>267,'"'=>401,'#'=>646,'$'=>572,'%'=>823,'&'=>730,'\''=>221,'('=>296,')'=>296,'*'=>552,'+'=>572,
    ','=>245,'-'=>322,'.'=>266,'/'=>367,'0'=>572,'1'=>572,'2'=>572,'3'=>572,'4'=>572,'5'=>572,'6'=>572,'7'=>572,'8'=>572,'9'=>572,':'=>266,';'=>266,'<'=>572,'='=>572,'>'=>572,'?'=>429,'@'=>899,'A'=>633,
    'B'=>648,'C'=>631,'D'=>729,'E'=>556,'F'=>516,'G'=>728,'H'=>738,'I'=>279,'J'=>267,'K'=>614,'L'=>519,'M'=>903,'N'=>754,'O'=>779,'P'=>602,'Q'=>779,'R'=>618,'S'=>549,'T'=>553,'U'=>728,'V'=>595,'W'=>926,
    'X'=>577,'Y'=>560,'Z'=>571,'['=>329,'\\'=>367,']'=>329,'^'=>542,'_'=>448,'`'=>577,'a'=>556,'b'=>613,'c'=>476,'d'=>613,'e'=>561,'f'=>339,'g'=>548,'h'=>614,'i'=>253,'j'=>253,'k'=>525,'l'=>253,'m'=>930,
    'n'=>614,'o'=>604,'p'=>613,'q'=>613,'r'=>408,'s'=>477,'t'=>353,'u'=>614,'v'=>501,'w'=>778,'x'=>524,'y'=>504,'z'=>468,'{'=>379,'|'=>551,'}'=>379,'~'=>572,chr(127)=>600,chr(128)=>590,chr(129)=>600,chr(130)=>245,chr(131)=>600,
    chr(132)=>405,chr(133)=>784,chr(134)=>502,chr(135)=>510,chr(136)=>600,chr(137)=>1202,chr(138)=>549,chr(139)=>304,chr(140)=>549,chr(141)=>553,chr(142)=>571,chr(143)=>571,chr(144)=>600,chr(145)=>170,chr(146)=>170,chr(147)=>350,chr(148)=>350,chr(149)=>376,chr(150)=>500,chr(151)=>1000,chr(152)=>600,chr(153)=>776,
    chr(154)=>477,chr(155)=>304,chr(156)=>477,chr(157)=>353,chr(158)=>468,chr(159)=>468,chr(160)=>260,chr(161)=>592,chr(162)=>592,chr(163)=>523,chr(164)=>572,chr(165)=>633,chr(166)=>551,chr(167)=>516,chr(168)=>577,chr(169)=>832,chr(170)=>549,chr(171)=>497,chr(172)=>572,chr(173)=>322,chr(174)=>832,chr(175)=>571,
    chr(176)=>428,chr(177)=>572,chr(178)=>197,chr(179)=>261,chr(180)=>577,chr(181)=>619,chr(182)=>655,chr(183)=>266,chr(184)=>227,chr(185)=>556,chr(186)=>477,chr(187)=>497,chr(188)=>519,chr(189)=>577,chr(190)=>253,chr(191)=>468,chr(192)=>618,chr(193)=>633,chr(194)=>633,chr(195)=>633,chr(196)=>633,chr(197)=>519,
    chr(198)=>631,chr(199)=>631,chr(200)=>631,chr(201)=>556,chr(202)=>556,chr(203)=>556,chr(204)=>556,chr(205)=>279,chr(206)=>279,chr(207)=>729,chr(208)=>722,chr(209)=>754,chr(210)=>754,chr(211)=>779,chr(212)=>779,chr(213)=>779,chr(214)=>779,chr(215)=>572,chr(216)=>618,chr(217)=>728,chr(218)=>728,chr(219)=>728,
    chr(220)=>728,chr(221)=>560,chr(222)=>553,chr(223)=>622,chr(224)=>408,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>253,chr(230)=>476,chr(231)=>476,chr(232)=>476,chr(233)=>561,chr(234)=>561,chr(235)=>561,chr(236)=>561,chr(237)=>253,chr(238)=>253,chr(239)=>613,chr(240)=>613,chr(241)=>614,
    chr(242)=>614,chr(243)=>604,chr(244)=>604,chr(245)=>604,chr(246)=>604,chr(247)=>572,chr(248)=>408,chr(249)=>614,chr(250)=>614,chr(251)=>614,chr(252)=>614,chr(253)=>504,chr(254)=>353,chr(255)=>253);
$enc='cp1250';
$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 /Zdotaccent 178 /ogonek /lslash 185 /aogonek /scedilla 188 /Lcaron /hungarumlaut /lcaron /zdotaccent /Racute 195 /Abreve 197 /Lacute /Cacute 200 /Ccaron 202 /Eogonek 204 /Ecaron 207 /Dcaron /Dcroat /Nacute /Ncaron 213 /Ohungarumlaut 216 /Rcaron /Uring 219 /Uhungarumlaut 222 /Tcedilla 224 /racute 227 /abreve 229 /lacute /cacute 232 /ccaron 234 /eogonek 236 /ecaron 239 /dcaron /dcroat /nacute /ncaron 245 /ohungarumlaut 248 /rcaron /uring 251 /uhungarumlaut 254 /tcedilla /dotaccent';
$originalsize=217360;
?>
0

There are 0 answers