@@ -4,18 +4,18 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
| 8 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564,
|
|
| 9 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, |
|
| 10 | - 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, |
|
| 11 | - 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, |
|
| 12 | - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
|
| 13 | - chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, |
|
| 14 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
| 15 | - chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
| 16 | - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | - chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
| 18 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); |
|
| 7 | + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
| 8 | + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564,
|
|
| 9 | + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, |
|
| 10 | + 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, |
|
| 11 | + 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, |
|
| 12 | + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
|
| 13 | + chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, |
|
| 14 | + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
| 15 | + chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
| 16 | + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | + chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
| 18 | + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); |
|
| 19 | 19 | $enc = 'cp1252'; |
| 20 | 20 | $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
| 21 | 21 | ?> |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
| 8 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564,
|
|
| 9 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, |
|
| 10 | - 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, |
|
| 11 | - 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, |
|
| 12 | - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
|
| 13 | - chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, |
|
| 14 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
| 15 | - chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
| 16 | - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | - chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
| 18 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); |
|
| 7 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
| 8 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>408, '#'=>500, '$'=>500, '%'=>833, '&'=>778, '\''=>180, '('=>333, ')'=>333, '*'=>500, '+'=>564,
|
|
| 9 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>278, ';'=>278, '<'=>564, '='=>564, '>'=>564, '?'=>444, '@'=>921, 'A'=>722, |
|
| 10 | + 'B'=>667, 'C'=>667, 'D'=>722, 'E'=>611, 'F'=>556, 'G'=>722, 'H'=>722, 'I'=>333, 'J'=>389, 'K'=>722, 'L'=>611, 'M'=>889, 'N'=>722, 'O'=>722, 'P'=>556, 'Q'=>722, 'R'=>667, 'S'=>556, 'T'=>611, 'U'=>722, 'V'=>722, 'W'=>944, |
|
| 11 | + 'X'=>722, 'Y'=>722, 'Z'=>611, '['=>333, '\\'=>278, ']'=>333, '^'=>469, '_'=>500, '`'=>333, 'a'=>444, 'b'=>500, 'c'=>444, 'd'=>500, 'e'=>444, 'f'=>333, 'g'=>500, 'h'=>500, 'i'=>278, 'j'=>278, 'k'=>500, 'l'=>278, 'm'=>778, |
|
| 12 | + 'n'=>500, 'o'=>500, 'p'=>500, 'q'=>500, 'r'=>333, 's'=>389, 't'=>278, 'u'=>500, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>444, '{'=>480, '|'=>200, '}'=>480, '~'=>541, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500,
|
|
| 13 | + chr(132)=>444, chr(133)=>1000, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>556, chr(139)=>333, chr(140)=>889, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>444, chr(148)=>444, chr(149)=>350, chr(150)=>500, chr(151)=>1000, chr(152)=>333, chr(153)=>980, |
|
| 14 | + chr(154)=>389, chr(155)=>333, chr(156)=>722, chr(157)=>350, chr(158)=>444, chr(159)=>722, chr(160)=>250, chr(161)=>333, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>200, chr(167)=>500, chr(168)=>333, chr(169)=>760, chr(170)=>276, chr(171)=>500, chr(172)=>564, chr(173)=>333, chr(174)=>760, chr(175)=>333, |
|
| 15 | + chr(176)=>400, chr(177)=>564, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>500, chr(182)=>453, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>310, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>444, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722, |
|
| 16 | + chr(198)=>889, chr(199)=>667, chr(200)=>611, chr(201)=>611, chr(202)=>611, chr(203)=>611, chr(204)=>333, chr(205)=>333, chr(206)=>333, chr(207)=>333, chr(208)=>722, chr(209)=>722, chr(210)=>722, chr(211)=>722, chr(212)=>722, chr(213)=>722, chr(214)=>722, chr(215)=>564, chr(216)=>722, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
| 17 | + chr(220)=>722, chr(221)=>722, chr(222)=>556, chr(223)=>500, chr(224)=>444, chr(225)=>444, chr(226)=>444, chr(227)=>444, chr(228)=>444, chr(229)=>444, chr(230)=>667, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>500, |
|
| 18 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>564, chr(248)=>500, chr(249)=>500, chr(250)=>500, chr(251)=>500, chr(252)=>500, chr(253)=>500, chr(254)=>500, chr(255)=>500); |
|
| 19 | 19 | $enc = 'cp1252'; |
| 20 | -$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
|
| 20 | +$uv = array(0=>array(0, 128), 128=>8364, 130=>8218, 131=>402, 132=>8222, 133=>8230, 134=>array(8224, 2), 136=>710, 137=>8240, 138=>352, 139=>8249, 140=>338, 142=>381, 145=>array(8216, 2), 147=>array(8220, 2), 149=>8226, 150=>array(8211, 2), 152=>732, 153=>8482, 154=>353, 155=>8250, 156=>339, 158=>382, 159=>376, 160=>array(160, 96)); |
|
| 21 | 21 | ?> |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
| 8 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675,
|
|
| 9 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, |
|
| 10 | - 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, |
|
| 11 | - 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, |
|
| 12 | - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
|
| 13 | - chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, |
|
| 14 | - chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
| 15 | - chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, |
|
| 16 | - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | - chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
| 18 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); |
|
| 7 | + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
| 8 | + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675,
|
|
| 9 | + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, |
|
| 10 | + 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, |
|
| 11 | + 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, |
|
| 12 | + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
|
| 13 | + chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, |
|
| 14 | + chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
| 15 | + chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, |
|
| 16 | + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | + chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
| 18 | + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); |
|
| 19 | 19 | $enc = 'cp1252'; |
| 20 | 20 | $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
| 21 | 21 | ?> |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
| 8 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675,
|
|
| 9 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, |
|
| 10 | - 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, |
|
| 11 | - 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, |
|
| 12 | - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
|
| 13 | - chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, |
|
| 14 | - chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
| 15 | - chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, |
|
| 16 | - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | - chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
| 18 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); |
|
| 7 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
| 8 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>420, '#'=>500, '$'=>500, '%'=>833, '&'=>778, '\''=>214, '('=>333, ')'=>333, '*'=>500, '+'=>675,
|
|
| 9 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>333, ';'=>333, '<'=>675, '='=>675, '>'=>675, '?'=>500, '@'=>920, 'A'=>611, |
|
| 10 | + 'B'=>611, 'C'=>667, 'D'=>722, 'E'=>611, 'F'=>611, 'G'=>722, 'H'=>722, 'I'=>333, 'J'=>444, 'K'=>667, 'L'=>556, 'M'=>833, 'N'=>667, 'O'=>722, 'P'=>611, 'Q'=>722, 'R'=>611, 'S'=>500, 'T'=>556, 'U'=>722, 'V'=>611, 'W'=>833, |
|
| 11 | + 'X'=>611, 'Y'=>556, 'Z'=>556, '['=>389, '\\'=>278, ']'=>389, '^'=>422, '_'=>500, '`'=>333, 'a'=>500, 'b'=>500, 'c'=>444, 'd'=>500, 'e'=>444, 'f'=>278, 'g'=>500, 'h'=>500, 'i'=>278, 'j'=>278, 'k'=>444, 'l'=>278, 'm'=>722, |
|
| 12 | + 'n'=>500, 'o'=>500, 'p'=>500, 'q'=>500, 'r'=>389, 's'=>389, 't'=>278, 'u'=>500, 'v'=>444, 'w'=>667, 'x'=>444, 'y'=>444, 'z'=>389, '{'=>400, '|'=>275, '}'=>400, '~'=>541, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500,
|
|
| 13 | + chr(132)=>556, chr(133)=>889, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>500, chr(139)=>333, chr(140)=>944, chr(141)=>350, chr(142)=>556, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>556, chr(148)=>556, chr(149)=>350, chr(150)=>500, chr(151)=>889, chr(152)=>333, chr(153)=>980, |
|
| 14 | + chr(154)=>389, chr(155)=>333, chr(156)=>667, chr(157)=>350, chr(158)=>389, chr(159)=>556, chr(160)=>250, chr(161)=>389, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>275, chr(167)=>500, chr(168)=>333, chr(169)=>760, chr(170)=>276, chr(171)=>500, chr(172)=>675, chr(173)=>333, chr(174)=>760, chr(175)=>333, |
|
| 15 | + chr(176)=>400, chr(177)=>675, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>500, chr(182)=>523, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>310, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>500, chr(192)=>611, chr(193)=>611, chr(194)=>611, chr(195)=>611, chr(196)=>611, chr(197)=>611, |
|
| 16 | + chr(198)=>889, chr(199)=>667, chr(200)=>611, chr(201)=>611, chr(202)=>611, chr(203)=>611, chr(204)=>333, chr(205)=>333, chr(206)=>333, chr(207)=>333, chr(208)=>722, chr(209)=>667, chr(210)=>722, chr(211)=>722, chr(212)=>722, chr(213)=>722, chr(214)=>722, chr(215)=>675, chr(216)=>722, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
| 17 | + chr(220)=>722, chr(221)=>556, chr(222)=>611, chr(223)=>500, chr(224)=>500, chr(225)=>500, chr(226)=>500, chr(227)=>500, chr(228)=>500, chr(229)=>500, chr(230)=>667, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>500, |
|
| 18 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>675, chr(248)=>500, chr(249)=>500, chr(250)=>500, chr(251)=>500, chr(252)=>500, chr(253)=>444, chr(254)=>500, chr(255)=>444); |
|
| 19 | 19 | $enc = 'cp1252'; |
| 20 | -$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
|
| 20 | +$uv = array(0=>array(0, 128), 128=>8364, 130=>8218, 131=>402, 132=>8222, 133=>8230, 134=>array(8224, 2), 136=>710, 137=>8240, 138=>352, 139=>8249, 140=>338, 142=>381, 145=>array(8216, 2), 147=>array(8220, 2), 149=>8226, 150=>array(8211, 2), 152=>732, 153=>8482, 154=>353, 155=>8250, 156=>339, 158=>382, 159=>376, 160=>array(160, 96)); |
|
| 21 | 21 | ?> |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | for($i=0;$i<=255;$i++) |
| 7 | - $cw[chr($i)] = 600; |
|
| 7 | + $cw[chr($i)] = 600; |
|
| 8 | 8 | $enc = 'cp1252'; |
| 9 | 9 | $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
| 10 | 10 | ?> |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | $name = 'Courier'; |
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | -for($i=0;$i<=255;$i++) |
|
| 6 | +for ($i = 0; $i <= 255; $i++) |
|
| 7 | 7 | $cw[chr($i)] = 600; |
| 8 | 8 | $enc = 'cp1252'; |
| 9 | -$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
|
| 9 | +$uv = array(0=>array(0, 128), 128=>8364, 130=>8218, 131=>402, 132=>8222, 133=>8230, 134=>array(8224, 2), 136=>710, 137=>8240, 138=>352, 139=>8249, 140=>338, 142=>381, 145=>array(8216, 2), 147=>array(8220, 2), 149=>8226, 150=>array(8211, 2), 152=>732, 153=>8482, 154=>353, 155=>8250, 156=>339, 158=>382, 159=>376, 160=>array(160, 96)); |
|
| 10 | 10 | ?> |
@@ -3,8 +3,9 @@ |
||
| 3 | 3 | $name = 'Courier'; |
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | -for($i=0;$i<=255;$i++) |
|
| 6 | +for($i=0;$i<=255;$i++) {
|
|
| 7 | 7 | $cw[chr($i)] = 600; |
| 8 | +} |
|
| 8 | 9 | $enc = 'cp1252'; |
| 9 | 10 | $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
| 10 | 11 | ?> |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
| 8 | - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
|
| 9 | - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, |
|
| 10 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
| 11 | - 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, |
|
| 12 | - 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
|
|
| 13 | - chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
| 14 | - chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
| 15 | - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, |
|
| 16 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, |
|
| 18 | - chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
| 7 | + chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
| 8 | + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
|
| 9 | + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, |
|
| 10 | + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
| 11 | + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, |
|
| 12 | + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
|
|
| 13 | + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
| 14 | + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
| 15 | + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, |
|
| 16 | + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, |
|
| 18 | + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
| 19 | 19 | $enc = 'cp1252'; |
| 20 | 20 | $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
| 21 | 21 | ?> |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
| 8 | - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
|
| 9 | - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, |
|
| 10 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
| 11 | - 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, |
|
| 12 | - 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
|
|
| 13 | - chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
| 14 | - chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
| 15 | - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, |
|
| 16 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, |
|
| 18 | - chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
| 7 | + chr(0)=>278, chr(1)=>278, chr(2)=>278, chr(3)=>278, chr(4)=>278, chr(5)=>278, chr(6)=>278, chr(7)=>278, chr(8)=>278, chr(9)=>278, chr(10)=>278, chr(11)=>278, chr(12)=>278, chr(13)=>278, chr(14)=>278, chr(15)=>278, chr(16)=>278, chr(17)=>278, chr(18)=>278, chr(19)=>278, chr(20)=>278, chr(21)=>278, |
|
| 8 | + chr(22)=>278, chr(23)=>278, chr(24)=>278, chr(25)=>278, chr(26)=>278, chr(27)=>278, chr(28)=>278, chr(29)=>278, chr(30)=>278, chr(31)=>278, ' '=>278, '!'=>278, '"'=>355, '#'=>556, '$'=>556, '%'=>889, '&'=>667, '\''=>191, '('=>333, ')'=>333, '*'=>389, '+'=>584,
|
|
| 9 | + ','=>278, '-'=>333, '.'=>278, '/'=>278, '0'=>556, '1'=>556, '2'=>556, '3'=>556, '4'=>556, '5'=>556, '6'=>556, '7'=>556, '8'=>556, '9'=>556, ':'=>278, ';'=>278, '<'=>584, '='=>584, '>'=>584, '?'=>556, '@'=>1015, 'A'=>667, |
|
| 10 | + 'B'=>667, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>722, 'I'=>278, 'J'=>500, 'K'=>667, 'L'=>556, 'M'=>833, 'N'=>722, 'O'=>778, 'P'=>667, 'Q'=>778, 'R'=>722, 'S'=>667, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>944, |
|
| 11 | + 'X'=>667, 'Y'=>667, 'Z'=>611, '['=>278, '\\'=>278, ']'=>278, '^'=>469, '_'=>556, '`'=>333, 'a'=>556, 'b'=>556, 'c'=>500, 'd'=>556, 'e'=>556, 'f'=>278, 'g'=>556, 'h'=>556, 'i'=>222, 'j'=>222, 'k'=>500, 'l'=>222, 'm'=>833, |
|
| 12 | + 'n'=>556, 'o'=>556, 'p'=>556, 'q'=>556, 'r'=>333, 's'=>500, 't'=>278, 'u'=>556, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>500, '{'=>334, '|'=>260, '}'=>334, '~'=>584, chr(127)=>350, chr(128)=>556, chr(129)=>350, chr(130)=>222, chr(131)=>556,
|
|
| 13 | + chr(132)=>333, chr(133)=>1000, chr(134)=>556, chr(135)=>556, chr(136)=>333, chr(137)=>1000, chr(138)=>667, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>222, chr(146)=>222, chr(147)=>333, chr(148)=>333, chr(149)=>350, chr(150)=>556, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
| 14 | + chr(154)=>500, chr(155)=>333, chr(156)=>944, chr(157)=>350, chr(158)=>500, chr(159)=>667, chr(160)=>278, chr(161)=>333, chr(162)=>556, chr(163)=>556, chr(164)=>556, chr(165)=>556, chr(166)=>260, chr(167)=>556, chr(168)=>333, chr(169)=>737, chr(170)=>370, chr(171)=>556, chr(172)=>584, chr(173)=>333, chr(174)=>737, chr(175)=>333, |
|
| 15 | + chr(176)=>400, chr(177)=>584, chr(178)=>333, chr(179)=>333, chr(180)=>333, chr(181)=>556, chr(182)=>537, chr(183)=>278, chr(184)=>333, chr(185)=>333, chr(186)=>365, chr(187)=>556, chr(188)=>834, chr(189)=>834, chr(190)=>834, chr(191)=>611, chr(192)=>667, chr(193)=>667, chr(194)=>667, chr(195)=>667, chr(196)=>667, chr(197)=>667, |
|
| 16 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>278, chr(205)=>278, chr(206)=>278, chr(207)=>278, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>584, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
| 17 | + chr(220)=>722, chr(221)=>667, chr(222)=>667, chr(223)=>611, chr(224)=>556, chr(225)=>556, chr(226)=>556, chr(227)=>556, chr(228)=>556, chr(229)=>556, chr(230)=>889, chr(231)=>500, chr(232)=>556, chr(233)=>556, chr(234)=>556, chr(235)=>556, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>556, chr(241)=>556, |
|
| 18 | + chr(242)=>556, chr(243)=>556, chr(244)=>556, chr(245)=>556, chr(246)=>556, chr(247)=>584, chr(248)=>611, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>500, chr(254)=>556, chr(255)=>500); |
|
| 19 | 19 | $enc = 'cp1252'; |
| 20 | -$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
|
| 20 | +$uv = array(0=>array(0, 128), 128=>8364, 130=>8218, 131=>402, 132=>8222, 133=>8230, 134=>array(8224, 2), 136=>710, 137=>8240, 138=>352, 139=>8249, 140=>338, 142=>381, 145=>array(8216, 2), 147=>array(8220, 2), 149=>8226, 150=>array(8211, 2), 152=>732, 153=>8482, 154=>353, 155=>8250, 156=>339, 158=>382, 159=>376, 160=>array(160, 96)); |
|
| 21 | 21 | ?> |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
| 8 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
|
|
| 9 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, |
|
| 10 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, |
|
| 11 | - 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, |
|
| 12 | - 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
|
| 13 | - chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
| 14 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, |
|
| 15 | - chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
| 16 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | - chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, |
|
| 18 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
| 7 | + chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
| 8 | + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
|
|
| 9 | + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, |
|
| 10 | + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, |
|
| 11 | + 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, |
|
| 12 | + 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
|
| 13 | + chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
| 14 | + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, |
|
| 15 | + chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
| 16 | + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | + chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, |
|
| 18 | + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
| 19 | 19 | $enc = 'cp1252'; |
| 20 | 20 | $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
| 21 | 21 | ?> |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
| 8 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
|
|
| 9 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, |
|
| 10 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, |
|
| 11 | - 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, |
|
| 12 | - 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
|
| 13 | - chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
| 14 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, |
|
| 15 | - chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
| 16 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | - chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, |
|
| 18 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
| 7 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
| 8 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>555, '#'=>500, '$'=>500, '%'=>1000, '&'=>833, '\''=>278, '('=>333, ')'=>333, '*'=>500, '+'=>570,
|
|
| 9 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>333, ';'=>333, '<'=>570, '='=>570, '>'=>570, '?'=>500, '@'=>930, 'A'=>722, |
|
| 10 | + 'B'=>667, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>778, 'I'=>389, 'J'=>500, 'K'=>778, 'L'=>667, 'M'=>944, 'N'=>722, 'O'=>778, 'P'=>611, 'Q'=>778, 'R'=>722, 'S'=>556, 'T'=>667, 'U'=>722, 'V'=>722, 'W'=>1000, |
|
| 11 | + 'X'=>722, 'Y'=>722, 'Z'=>667, '['=>333, '\\'=>278, ']'=>333, '^'=>581, '_'=>500, '`'=>333, 'a'=>500, 'b'=>556, 'c'=>444, 'd'=>556, 'e'=>444, 'f'=>333, 'g'=>500, 'h'=>556, 'i'=>278, 'j'=>333, 'k'=>556, 'l'=>278, 'm'=>833, |
|
| 12 | + 'n'=>556, 'o'=>500, 'p'=>556, 'q'=>556, 'r'=>444, 's'=>389, 't'=>333, 'u'=>556, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>444, '{'=>394, '|'=>220, '}'=>394, '~'=>520, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500,
|
|
| 13 | + chr(132)=>500, chr(133)=>1000, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>556, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>667, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>500, chr(148)=>500, chr(149)=>350, chr(150)=>500, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
| 14 | + chr(154)=>389, chr(155)=>333, chr(156)=>722, chr(157)=>350, chr(158)=>444, chr(159)=>722, chr(160)=>250, chr(161)=>333, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>220, chr(167)=>500, chr(168)=>333, chr(169)=>747, chr(170)=>300, chr(171)=>500, chr(172)=>570, chr(173)=>333, chr(174)=>747, chr(175)=>333, |
|
| 15 | + chr(176)=>400, chr(177)=>570, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>556, chr(182)=>540, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>330, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>500, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722, |
|
| 16 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>389, chr(205)=>389, chr(206)=>389, chr(207)=>389, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>570, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
| 17 | + chr(220)=>722, chr(221)=>722, chr(222)=>611, chr(223)=>556, chr(224)=>500, chr(225)=>500, chr(226)=>500, chr(227)=>500, chr(228)=>500, chr(229)=>500, chr(230)=>722, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>556, |
|
| 18 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>570, chr(248)=>500, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>500, chr(254)=>556, chr(255)=>500); |
|
| 19 | 19 | $enc = 'cp1252'; |
| 20 | -$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
|
| 20 | +$uv = array(0=>array(0, 128), 128=>8364, 130=>8218, 131=>402, 132=>8222, 133=>8230, 134=>array(8224, 2), 136=>710, 137=>8240, 138=>352, 139=>8249, 140=>338, 142=>381, 145=>array(8216, 2), 147=>array(8220, 2), 149=>8226, 150=>array(8211, 2), 152=>732, 153=>8482, 154=>353, 155=>8250, 156=>339, 158=>382, 159=>376, 160=>array(160, 96)); |
|
| 21 | 21 | ?> |
@@ -4,17 +4,17 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, |
|
| 8 | - chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939,
|
|
| 9 | - ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, |
|
| 10 | - 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, |
|
| 11 | - 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, |
|
| 12 | - 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317,
|
|
| 13 | - chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, |
|
| 14 | - chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, |
|
| 15 | - chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, |
|
| 16 | - chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, |
|
| 17 | - chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, |
|
| 18 | - chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); |
|
| 7 | + chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, |
|
| 8 | + chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939,
|
|
| 9 | + ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, |
|
| 10 | + 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, |
|
| 11 | + 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, |
|
| 12 | + 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317,
|
|
| 13 | + chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, |
|
| 14 | + chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, |
|
| 15 | + chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, |
|
| 16 | + chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, |
|
| 17 | + chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, |
|
| 18 | + chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); |
|
| 19 | 19 | $uv = array(32=>32,33=>array(9985,4),37=>9742,38=>array(9990,4),42=>9755,43=>9758,44=>array(9996,28),72=>9733,73=>array(10025,35),108=>9679,109=>10061,110=>9632,111=>array(10063,4),115=>9650,116=>9660,117=>9670,118=>10070,119=>9687,120=>array(10072,7),128=>array(10088,14),161=>array(10081,7),168=>9827,169=>9830,170=>9829,171=>9824,172=>array(9312,10),182=>array(10102,31),213=>8594,214=>array(8596,2),216=>array(10136,24),241=>array(10161,14)); |
| 20 | 20 | ?> |
@@ -4,17 +4,17 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, |
|
| 8 | - chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939,
|
|
| 9 | - ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, |
|
| 10 | - 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, |
|
| 11 | - 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, |
|
| 12 | - 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317,
|
|
| 13 | - chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, |
|
| 14 | - chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, |
|
| 15 | - chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, |
|
| 16 | - chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, |
|
| 17 | - chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, |
|
| 18 | - chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); |
|
| 19 | -$uv = array(32=>32,33=>array(9985,4),37=>9742,38=>array(9990,4),42=>9755,43=>9758,44=>array(9996,28),72=>9733,73=>array(10025,35),108=>9679,109=>10061,110=>9632,111=>array(10063,4),115=>9650,116=>9660,117=>9670,118=>10070,119=>9687,120=>array(10072,7),128=>array(10088,14),161=>array(10081,7),168=>9827,169=>9830,170=>9829,171=>9824,172=>array(9312,10),182=>array(10102,31),213=>8594,214=>array(8596,2),216=>array(10136,24),241=>array(10161,14)); |
|
| 7 | + chr(0)=>0, chr(1)=>0, chr(2)=>0, chr(3)=>0, chr(4)=>0, chr(5)=>0, chr(6)=>0, chr(7)=>0, chr(8)=>0, chr(9)=>0, chr(10)=>0, chr(11)=>0, chr(12)=>0, chr(13)=>0, chr(14)=>0, chr(15)=>0, chr(16)=>0, chr(17)=>0, chr(18)=>0, chr(19)=>0, chr(20)=>0, chr(21)=>0, |
|
| 8 | + chr(22)=>0, chr(23)=>0, chr(24)=>0, chr(25)=>0, chr(26)=>0, chr(27)=>0, chr(28)=>0, chr(29)=>0, chr(30)=>0, chr(31)=>0, ' '=>278, '!'=>974, '"'=>961, '#'=>974, '$'=>980, '%'=>719, '&'=>789, '\''=>790, '('=>791, ')'=>690, '*'=>960, '+'=>939,
|
|
| 9 | + ','=>549, '-'=>855, '.'=>911, '/'=>933, '0'=>911, '1'=>945, '2'=>974, '3'=>755, '4'=>846, '5'=>762, '6'=>761, '7'=>571, '8'=>677, '9'=>763, ':'=>760, ';'=>759, '<'=>754, '='=>494, '>'=>552, '?'=>537, '@'=>577, 'A'=>692, |
|
| 10 | + 'B'=>786, 'C'=>788, 'D'=>788, 'E'=>790, 'F'=>793, 'G'=>794, 'H'=>816, 'I'=>823, 'J'=>789, 'K'=>841, 'L'=>823, 'M'=>833, 'N'=>816, 'O'=>831, 'P'=>923, 'Q'=>744, 'R'=>723, 'S'=>749, 'T'=>790, 'U'=>792, 'V'=>695, 'W'=>776, |
|
| 11 | + 'X'=>768, 'Y'=>792, 'Z'=>759, '['=>707, '\\'=>708, ']'=>682, '^'=>701, '_'=>826, '`'=>815, 'a'=>789, 'b'=>789, 'c'=>707, 'd'=>687, 'e'=>696, 'f'=>689, 'g'=>786, 'h'=>787, 'i'=>713, 'j'=>791, 'k'=>785, 'l'=>791, 'm'=>873, |
|
| 12 | + 'n'=>761, 'o'=>762, 'p'=>762, 'q'=>759, 'r'=>759, 's'=>892, 't'=>892, 'u'=>788, 'v'=>784, 'w'=>438, 'x'=>138, 'y'=>277, 'z'=>415, '{'=>392, '|'=>392, '}'=>668, '~'=>668, chr(127)=>0, chr(128)=>390, chr(129)=>390, chr(130)=>317, chr(131)=>317,
|
|
| 13 | + chr(132)=>276, chr(133)=>276, chr(134)=>509, chr(135)=>509, chr(136)=>410, chr(137)=>410, chr(138)=>234, chr(139)=>234, chr(140)=>334, chr(141)=>334, chr(142)=>0, chr(143)=>0, chr(144)=>0, chr(145)=>0, chr(146)=>0, chr(147)=>0, chr(148)=>0, chr(149)=>0, chr(150)=>0, chr(151)=>0, chr(152)=>0, chr(153)=>0, |
|
| 14 | + chr(154)=>0, chr(155)=>0, chr(156)=>0, chr(157)=>0, chr(158)=>0, chr(159)=>0, chr(160)=>0, chr(161)=>732, chr(162)=>544, chr(163)=>544, chr(164)=>910, chr(165)=>667, chr(166)=>760, chr(167)=>760, chr(168)=>776, chr(169)=>595, chr(170)=>694, chr(171)=>626, chr(172)=>788, chr(173)=>788, chr(174)=>788, chr(175)=>788, |
|
| 15 | + chr(176)=>788, chr(177)=>788, chr(178)=>788, chr(179)=>788, chr(180)=>788, chr(181)=>788, chr(182)=>788, chr(183)=>788, chr(184)=>788, chr(185)=>788, chr(186)=>788, chr(187)=>788, chr(188)=>788, chr(189)=>788, chr(190)=>788, chr(191)=>788, chr(192)=>788, chr(193)=>788, chr(194)=>788, chr(195)=>788, chr(196)=>788, chr(197)=>788, |
|
| 16 | + chr(198)=>788, chr(199)=>788, chr(200)=>788, chr(201)=>788, chr(202)=>788, chr(203)=>788, chr(204)=>788, chr(205)=>788, chr(206)=>788, chr(207)=>788, chr(208)=>788, chr(209)=>788, chr(210)=>788, chr(211)=>788, chr(212)=>894, chr(213)=>838, chr(214)=>1016, chr(215)=>458, chr(216)=>748, chr(217)=>924, chr(218)=>748, chr(219)=>918, |
|
| 17 | + chr(220)=>927, chr(221)=>928, chr(222)=>928, chr(223)=>834, chr(224)=>873, chr(225)=>828, chr(226)=>924, chr(227)=>924, chr(228)=>917, chr(229)=>930, chr(230)=>931, chr(231)=>463, chr(232)=>883, chr(233)=>836, chr(234)=>836, chr(235)=>867, chr(236)=>867, chr(237)=>696, chr(238)=>696, chr(239)=>874, chr(240)=>0, chr(241)=>874, |
|
| 18 | + chr(242)=>760, chr(243)=>946, chr(244)=>771, chr(245)=>865, chr(246)=>771, chr(247)=>888, chr(248)=>967, chr(249)=>888, chr(250)=>831, chr(251)=>873, chr(252)=>927, chr(253)=>970, chr(254)=>918, chr(255)=>0); |
|
| 19 | +$uv = array(32=>32, 33=>array(9985, 4), 37=>9742, 38=>array(9990, 4), 42=>9755, 43=>9758, 44=>array(9996, 28), 72=>9733, 73=>array(10025, 35), 108=>9679, 109=>10061, 110=>9632, 111=>array(10063, 4), 115=>9650, 116=>9660, 117=>9670, 118=>10070, 119=>9687, 120=>array(10072, 7), 128=>array(10088, 14), 161=>array(10081, 7), 168=>9827, 169=>9830, 170=>9829, 171=>9824, 172=>array(9312, 10), 182=>array(10102, 31), 213=>8594, 214=>array(8596, 2), 216=>array(10136, 24), 241=>array(10161, 14)); |
|
| 20 | 20 | ?> |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
| 8 | - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
|
| 9 | - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, |
|
| 10 | - 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
| 11 | - 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, |
|
| 12 | - 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
|
|
| 13 | - chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
| 14 | - chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
| 15 | - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
| 16 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, |
|
| 18 | - chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); |
|
| 7 | + chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
| 8 | + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
|
| 9 | + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, |
|
| 10 | + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
| 11 | + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, |
|
| 12 | + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
|
|
| 13 | + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
| 14 | + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
| 15 | + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
| 16 | + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, |
|
| 18 | + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); |
|
| 19 | 19 | $enc = 'cp1252'; |
| 20 | 20 | $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
| 21 | 21 | ?> |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | $cw = array( |
| 7 | - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
| 8 | - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
|
| 9 | - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, |
|
| 10 | - 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
| 11 | - 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, |
|
| 12 | - 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
|
|
| 13 | - chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
| 14 | - chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
| 15 | - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
| 16 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
| 17 | - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, |
|
| 18 | - chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); |
|
| 7 | + chr(0)=>278, chr(1)=>278, chr(2)=>278, chr(3)=>278, chr(4)=>278, chr(5)=>278, chr(6)=>278, chr(7)=>278, chr(8)=>278, chr(9)=>278, chr(10)=>278, chr(11)=>278, chr(12)=>278, chr(13)=>278, chr(14)=>278, chr(15)=>278, chr(16)=>278, chr(17)=>278, chr(18)=>278, chr(19)=>278, chr(20)=>278, chr(21)=>278, |
|
| 8 | + chr(22)=>278, chr(23)=>278, chr(24)=>278, chr(25)=>278, chr(26)=>278, chr(27)=>278, chr(28)=>278, chr(29)=>278, chr(30)=>278, chr(31)=>278, ' '=>278, '!'=>333, '"'=>474, '#'=>556, '$'=>556, '%'=>889, '&'=>722, '\''=>238, '('=>333, ')'=>333, '*'=>389, '+'=>584,
|
|
| 9 | + ','=>278, '-'=>333, '.'=>278, '/'=>278, '0'=>556, '1'=>556, '2'=>556, '3'=>556, '4'=>556, '5'=>556, '6'=>556, '7'=>556, '8'=>556, '9'=>556, ':'=>333, ';'=>333, '<'=>584, '='=>584, '>'=>584, '?'=>611, '@'=>975, 'A'=>722, |
|
| 10 | + 'B'=>722, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>722, 'I'=>278, 'J'=>556, 'K'=>722, 'L'=>611, 'M'=>833, 'N'=>722, 'O'=>778, 'P'=>667, 'Q'=>778, 'R'=>722, 'S'=>667, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>944, |
|
| 11 | + 'X'=>667, 'Y'=>667, 'Z'=>611, '['=>333, '\\'=>278, ']'=>333, '^'=>584, '_'=>556, '`'=>333, 'a'=>556, 'b'=>611, 'c'=>556, 'd'=>611, 'e'=>556, 'f'=>333, 'g'=>611, 'h'=>611, 'i'=>278, 'j'=>278, 'k'=>556, 'l'=>278, 'm'=>889, |
|
| 12 | + 'n'=>611, 'o'=>611, 'p'=>611, 'q'=>611, 'r'=>389, 's'=>556, 't'=>333, 'u'=>611, 'v'=>556, 'w'=>778, 'x'=>556, 'y'=>556, 'z'=>500, '{'=>389, '|'=>280, '}'=>389, '~'=>584, chr(127)=>350, chr(128)=>556, chr(129)=>350, chr(130)=>278, chr(131)=>556,
|
|
| 13 | + chr(132)=>500, chr(133)=>1000, chr(134)=>556, chr(135)=>556, chr(136)=>333, chr(137)=>1000, chr(138)=>667, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>278, chr(146)=>278, chr(147)=>500, chr(148)=>500, chr(149)=>350, chr(150)=>556, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
| 14 | + chr(154)=>556, chr(155)=>333, chr(156)=>944, chr(157)=>350, chr(158)=>500, chr(159)=>667, chr(160)=>278, chr(161)=>333, chr(162)=>556, chr(163)=>556, chr(164)=>556, chr(165)=>556, chr(166)=>280, chr(167)=>556, chr(168)=>333, chr(169)=>737, chr(170)=>370, chr(171)=>556, chr(172)=>584, chr(173)=>333, chr(174)=>737, chr(175)=>333, |
|
| 15 | + chr(176)=>400, chr(177)=>584, chr(178)=>333, chr(179)=>333, chr(180)=>333, chr(181)=>611, chr(182)=>556, chr(183)=>278, chr(184)=>333, chr(185)=>333, chr(186)=>365, chr(187)=>556, chr(188)=>834, chr(189)=>834, chr(190)=>834, chr(191)=>611, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722, |
|
| 16 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>278, chr(205)=>278, chr(206)=>278, chr(207)=>278, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>584, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
| 17 | + chr(220)=>722, chr(221)=>667, chr(222)=>667, chr(223)=>611, chr(224)=>556, chr(225)=>556, chr(226)=>556, chr(227)=>556, chr(228)=>556, chr(229)=>556, chr(230)=>889, chr(231)=>556, chr(232)=>556, chr(233)=>556, chr(234)=>556, chr(235)=>556, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>611, chr(241)=>611, |
|
| 18 | + chr(242)=>611, chr(243)=>611, chr(244)=>611, chr(245)=>611, chr(246)=>611, chr(247)=>584, chr(248)=>611, chr(249)=>611, chr(250)=>611, chr(251)=>611, chr(252)=>611, chr(253)=>556, chr(254)=>611, chr(255)=>556); |
|
| 19 | 19 | $enc = 'cp1252'; |
| 20 | -$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
|
| 20 | +$uv = array(0=>array(0, 128), 128=>8364, 130=>8218, 131=>402, 132=>8222, 133=>8230, 134=>array(8224, 2), 136=>710, 137=>8240, 138=>352, 139=>8249, 140=>338, 142=>381, 145=>array(8216, 2), 147=>array(8220, 2), 149=>8226, 150=>array(8211, 2), 152=>732, 153=>8482, 154=>353, 155=>8250, 156=>339, 158=>382, 159=>376, 160=>array(160, 96)); |
|
| 21 | 21 | ?> |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | 6 | for($i=0;$i<=255;$i++) |
| 7 | - $cw[chr($i)] = 600; |
|
| 7 | + $cw[chr($i)] = 600; |
|
| 8 | 8 | $enc = 'cp1252'; |
| 9 | 9 | $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
| 10 | 10 | ?> |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | $name = 'Courier-Oblique'; |
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | -for($i=0;$i<=255;$i++) |
|
| 6 | +for ($i = 0; $i <= 255; $i++) |
|
| 7 | 7 | $cw[chr($i)] = 600; |
| 8 | 8 | $enc = 'cp1252'; |
| 9 | -$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
|
| 9 | +$uv = array(0=>array(0, 128), 128=>8364, 130=>8218, 131=>402, 132=>8222, 133=>8230, 134=>array(8224, 2), 136=>710, 137=>8240, 138=>352, 139=>8249, 140=>338, 142=>381, 145=>array(8216, 2), 147=>array(8220, 2), 149=>8226, 150=>array(8211, 2), 152=>732, 153=>8482, 154=>353, 155=>8250, 156=>339, 158=>382, 159=>376, 160=>array(160, 96)); |
|
| 10 | 10 | ?> |
@@ -3,8 +3,9 @@ |
||
| 3 | 3 | $name = 'Courier-Oblique'; |
| 4 | 4 | $up = -100; |
| 5 | 5 | $ut = 50; |
| 6 | -for($i=0;$i<=255;$i++) |
|
| 6 | +for($i=0;$i<=255;$i++) {
|
|
| 7 | 7 | $cw[chr($i)] = 600; |
| 8 | +} |
|
| 8 | 9 | $enc = 'cp1252'; |
| 9 | 10 | $uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); |
| 10 | 11 | ?> |
@@ -175,100 +175,100 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function __construct(string $orientation='P', string $unit='mm', $size='A4') |
| 177 | 177 | {
|
| 178 | - // Some checks |
|
| 179 | - $this->_dochecks(); |
|
| 180 | - // Initialization of properties |
|
| 181 | - $this->state = 0; |
|
| 182 | - $this->page = 0; |
|
| 183 | - $this->n = 2; |
|
| 184 | - $this->buffer = ''; |
|
| 185 | - $this->pages = array(); |
|
| 186 | - $this->PageInfo = array(); |
|
| 187 | - $this->fonts = array(); |
|
| 188 | - $this->FontFiles = array(); |
|
| 189 | - $this->encodings = array(); |
|
| 190 | - $this->cmaps = array(); |
|
| 191 | - $this->images = array(); |
|
| 192 | - $this->links = array(); |
|
| 193 | - $this->InHeader = false; |
|
| 194 | - $this->InFooter = false; |
|
| 195 | - $this->lasth = 0; |
|
| 196 | - $this->FontFamily = ''; |
|
| 197 | - $this->FontStyle = ''; |
|
| 198 | - $this->FontSizePt = 12; |
|
| 199 | - $this->underline = false; |
|
| 200 | - $this->DrawColor = '0 G'; |
|
| 201 | - $this->FillColor = '0 g'; |
|
| 202 | - $this->TextColor = '0 g'; |
|
| 203 | - $this->ColorFlag = false; |
|
| 204 | - $this->WithAlpha = false; |
|
| 205 | - $this->ws = 0; |
|
| 206 | - // Font path |
|
| 207 | - if(defined('FPDF_FONTPATH'))
|
|
| 208 | - {
|
|
| 209 | - $this->fontpath = FPDF_FONTPATH; |
|
| 210 | - if(substr($this->fontpath,-1)!='/' && substr($this->fontpath,-1)!='\\') |
|
| 211 | - $this->fontpath .= '/'; |
|
| 212 | - } |
|
| 213 | - elseif(is_dir(dirname(__FILE__).'/font')) |
|
| 214 | - $this->fontpath = dirname(__FILE__).'/font/'; |
|
| 215 | - else |
|
| 216 | - $this->fontpath = ''; |
|
| 217 | - // Core fonts |
|
| 218 | - $this->CoreFonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats');
|
|
| 219 | - // Scale factor |
|
| 220 | - if($unit=='pt') |
|
| 221 | - $this->k = 1; |
|
| 222 | - elseif($unit=='mm') |
|
| 223 | - $this->k = 72/25.4; |
|
| 224 | - elseif($unit=='cm') |
|
| 225 | - $this->k = 72/2.54; |
|
| 226 | - elseif($unit=='in') |
|
| 227 | - $this->k = 72; |
|
| 228 | - else |
|
| 229 | - $this->Error('Incorrect unit: '.$unit);
|
|
| 230 | - // Page sizes |
|
| 231 | - $this->StdPageSizes = array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
|
|
| 232 | - 'letter'=>array(612,792), 'legal'=>array(612,1008)); |
|
| 233 | - $size = $this->_getpagesize($size); |
|
| 234 | - $this->DefPageSize = $size; |
|
| 235 | - $this->CurPageSize = $size; |
|
| 236 | - // Page orientation |
|
| 237 | - $orientation = strtolower($orientation); |
|
| 238 | - if($orientation=='p' || $orientation=='portrait') |
|
| 239 | - {
|
|
| 240 | - $this->DefOrientation = 'P'; |
|
| 241 | - $this->w = $size[0]; |
|
| 242 | - $this->h = $size[1]; |
|
| 243 | - } |
|
| 244 | - elseif($orientation=='l' || $orientation=='landscape') |
|
| 245 | - {
|
|
| 246 | - $this->DefOrientation = 'L'; |
|
| 247 | - $this->w = $size[1]; |
|
| 248 | - $this->h = $size[0]; |
|
| 249 | - } |
|
| 250 | - else |
|
| 251 | - $this->Error('Incorrect orientation: '.$orientation);
|
|
| 252 | - $this->CurOrientation = $this->DefOrientation; |
|
| 253 | - $this->wPt = $this->w*$this->k; |
|
| 254 | - $this->hPt = $this->h*$this->k; |
|
| 255 | - // Page rotation |
|
| 256 | - $this->CurRotation = 0; |
|
| 257 | - // Page margins (1 cm) |
|
| 258 | - $margin = 28.35/$this->k; |
|
| 259 | - $this->setMargins($margin,$margin); |
|
| 260 | - // Interior cell margin (1 mm) |
|
| 261 | - $this->cMargin = $margin/10; |
|
| 262 | - // Line width (0.2 mm) |
|
| 263 | - $this->LineWidth = .567/$this->k; |
|
| 264 | - // Automatic page break |
|
| 265 | - $this->setAutoPageBreak(true,2*$margin); |
|
| 266 | - // Default display mode |
|
| 267 | - $this->setDisplayMode('default');
|
|
| 268 | - // Enable compression |
|
| 269 | - $this->setCompression(true); |
|
| 270 | - // Set default PDF version number |
|
| 271 | - $this->PDFVersion = '1.3'; |
|
| 178 | + // Some checks |
|
| 179 | + $this->_dochecks(); |
|
| 180 | + // Initialization of properties |
|
| 181 | + $this->state = 0; |
|
| 182 | + $this->page = 0; |
|
| 183 | + $this->n = 2; |
|
| 184 | + $this->buffer = ''; |
|
| 185 | + $this->pages = array(); |
|
| 186 | + $this->PageInfo = array(); |
|
| 187 | + $this->fonts = array(); |
|
| 188 | + $this->FontFiles = array(); |
|
| 189 | + $this->encodings = array(); |
|
| 190 | + $this->cmaps = array(); |
|
| 191 | + $this->images = array(); |
|
| 192 | + $this->links = array(); |
|
| 193 | + $this->InHeader = false; |
|
| 194 | + $this->InFooter = false; |
|
| 195 | + $this->lasth = 0; |
|
| 196 | + $this->FontFamily = ''; |
|
| 197 | + $this->FontStyle = ''; |
|
| 198 | + $this->FontSizePt = 12; |
|
| 199 | + $this->underline = false; |
|
| 200 | + $this->DrawColor = '0 G'; |
|
| 201 | + $this->FillColor = '0 g'; |
|
| 202 | + $this->TextColor = '0 g'; |
|
| 203 | + $this->ColorFlag = false; |
|
| 204 | + $this->WithAlpha = false; |
|
| 205 | + $this->ws = 0; |
|
| 206 | + // Font path |
|
| 207 | + if(defined('FPDF_FONTPATH'))
|
|
| 208 | + {
|
|
| 209 | + $this->fontpath = FPDF_FONTPATH; |
|
| 210 | + if(substr($this->fontpath,-1)!='/' && substr($this->fontpath,-1)!='\\') |
|
| 211 | + $this->fontpath .= '/'; |
|
| 212 | + } |
|
| 213 | + elseif(is_dir(dirname(__FILE__).'/font')) |
|
| 214 | + $this->fontpath = dirname(__FILE__).'/font/'; |
|
| 215 | + else |
|
| 216 | + $this->fontpath = ''; |
|
| 217 | + // Core fonts |
|
| 218 | + $this->CoreFonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats');
|
|
| 219 | + // Scale factor |
|
| 220 | + if($unit=='pt') |
|
| 221 | + $this->k = 1; |
|
| 222 | + elseif($unit=='mm') |
|
| 223 | + $this->k = 72/25.4; |
|
| 224 | + elseif($unit=='cm') |
|
| 225 | + $this->k = 72/2.54; |
|
| 226 | + elseif($unit=='in') |
|
| 227 | + $this->k = 72; |
|
| 228 | + else |
|
| 229 | + $this->Error('Incorrect unit: '.$unit);
|
|
| 230 | + // Page sizes |
|
| 231 | + $this->StdPageSizes = array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
|
|
| 232 | + 'letter'=>array(612,792), 'legal'=>array(612,1008)); |
|
| 233 | + $size = $this->_getpagesize($size); |
|
| 234 | + $this->DefPageSize = $size; |
|
| 235 | + $this->CurPageSize = $size; |
|
| 236 | + // Page orientation |
|
| 237 | + $orientation = strtolower($orientation); |
|
| 238 | + if($orientation=='p' || $orientation=='portrait') |
|
| 239 | + {
|
|
| 240 | + $this->DefOrientation = 'P'; |
|
| 241 | + $this->w = $size[0]; |
|
| 242 | + $this->h = $size[1]; |
|
| 243 | + } |
|
| 244 | + elseif($orientation=='l' || $orientation=='landscape') |
|
| 245 | + {
|
|
| 246 | + $this->DefOrientation = 'L'; |
|
| 247 | + $this->w = $size[1]; |
|
| 248 | + $this->h = $size[0]; |
|
| 249 | + } |
|
| 250 | + else |
|
| 251 | + $this->Error('Incorrect orientation: '.$orientation);
|
|
| 252 | + $this->CurOrientation = $this->DefOrientation; |
|
| 253 | + $this->wPt = $this->w*$this->k; |
|
| 254 | + $this->hPt = $this->h*$this->k; |
|
| 255 | + // Page rotation |
|
| 256 | + $this->CurRotation = 0; |
|
| 257 | + // Page margins (1 cm) |
|
| 258 | + $margin = 28.35/$this->k; |
|
| 259 | + $this->setMargins($margin,$margin); |
|
| 260 | + // Interior cell margin (1 mm) |
|
| 261 | + $this->cMargin = $margin/10; |
|
| 262 | + // Line width (0.2 mm) |
|
| 263 | + $this->LineWidth = .567/$this->k; |
|
| 264 | + // Automatic page break |
|
| 265 | + $this->setAutoPageBreak(true,2*$margin); |
|
| 266 | + // Default display mode |
|
| 267 | + $this->setDisplayMode('default');
|
|
| 268 | + // Enable compression |
|
| 269 | + $this->setCompression(true); |
|
| 270 | + // Set default PDF version number |
|
| 271 | + $this->PDFVersion = '1.3'; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
@@ -280,12 +280,12 @@ discard block |
||
| 280 | 280 | */ |
| 281 | 281 | public function SetMargins(float $left, float $top, ?float $right=null) : void |
| 282 | 282 | {
|
| 283 | - // Set left, top and right margins |
|
| 284 | - $this->lMargin = $left; |
|
| 285 | - $this->tMargin = $top; |
|
| 286 | - if($right===null) |
|
| 287 | - $right = $left; |
|
| 288 | - $this->rMargin = $right; |
|
| 283 | + // Set left, top and right margins |
|
| 284 | + $this->lMargin = $left; |
|
| 285 | + $this->tMargin = $top; |
|
| 286 | + if($right===null) |
|
| 287 | + $right = $left; |
|
| 288 | + $this->rMargin = $right; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -296,10 +296,10 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | public function SetLeftMargin(float $margin) : void |
| 298 | 298 | {
|
| 299 | - // Set left margin |
|
| 300 | - $this->lMargin = $margin; |
|
| 301 | - if($this->page>0 && $this->x<$margin) |
|
| 302 | - $this->x = $margin; |
|
| 299 | + // Set left margin |
|
| 300 | + $this->lMargin = $margin; |
|
| 301 | + if($this->page>0 && $this->x<$margin) |
|
| 302 | + $this->x = $margin; |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
@@ -309,8 +309,8 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | public function SetTopMargin(float $margin) : void |
| 311 | 311 | {
|
| 312 | - // Set top margin |
|
| 313 | - $this->tMargin = $margin; |
|
| 312 | + // Set top margin |
|
| 313 | + $this->tMargin = $margin; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /** |
@@ -320,8 +320,8 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | public function SetRightMargin(float $margin) : void |
| 322 | 322 | {
|
| 323 | - // Set right margin |
|
| 324 | - $this->rMargin = $margin; |
|
| 323 | + // Set right margin |
|
| 324 | + $this->rMargin = $margin; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
@@ -334,10 +334,10 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function SetAutoPageBreak(bool $auto, float $margin=0) : void |
| 336 | 336 | {
|
| 337 | - // Set auto page break mode and triggering margin |
|
| 338 | - $this->AutoPageBreak = $auto; |
|
| 339 | - $this->bMargin = $margin; |
|
| 340 | - $this->PageBreakTrigger = $this->h-$margin; |
|
| 337 | + // Set auto page break mode and triggering margin |
|
| 338 | + $this->AutoPageBreak = $auto; |
|
| 339 | + $this->bMargin = $margin; |
|
| 340 | + $this->PageBreakTrigger = $this->h-$margin; |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /** |
@@ -370,15 +370,15 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | public function SetDisplayMode($zoom, string $layout='default') : void |
| 372 | 372 | {
|
| 373 | - // Set display mode in viewer |
|
| 374 | - if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) |
|
| 375 | - $this->ZoomMode = $zoom; |
|
| 376 | - else |
|
| 377 | - $this->Error('Incorrect zoom display mode: '.$zoom);
|
|
| 378 | - if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') |
|
| 379 | - $this->LayoutMode = $layout; |
|
| 380 | - else |
|
| 381 | - $this->Error('Incorrect layout display mode: '.$layout);
|
|
| 373 | + // Set display mode in viewer |
|
| 374 | + if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) |
|
| 375 | + $this->ZoomMode = $zoom; |
|
| 376 | + else |
|
| 377 | + $this->Error('Incorrect zoom display mode: '.$zoom);
|
|
| 378 | + if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') |
|
| 379 | + $this->LayoutMode = $layout; |
|
| 380 | + else |
|
| 381 | + $this->Error('Incorrect layout display mode: '.$layout);
|
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | /** |
@@ -392,11 +392,11 @@ discard block |
||
| 392 | 392 | */ |
| 393 | 393 | public function SetCompression(bool $compress) : void |
| 394 | 394 | {
|
| 395 | - // Set page compression |
|
| 396 | - if(function_exists('gzcompress'))
|
|
| 397 | - $this->compress = $compress; |
|
| 398 | - else |
|
| 399 | - $this->compress = false; |
|
| 395 | + // Set page compression |
|
| 396 | + if(function_exists('gzcompress'))
|
|
| 397 | + $this->compress = $compress; |
|
| 398 | + else |
|
| 399 | + $this->compress = false; |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | /** |
@@ -406,8 +406,8 @@ discard block |
||
| 406 | 406 | */ |
| 407 | 407 | public function SetTitle(string $title, bool $isUTF8=false) : void |
| 408 | 408 | {
|
| 409 | - // Title of document |
|
| 410 | - $this->metadata['Title'] = $isUTF8 ? $title : utf8_encode($title); |
|
| 409 | + // Title of document |
|
| 410 | + $this->metadata['Title'] = $isUTF8 ? $title : utf8_encode($title); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | */ |
| 418 | 418 | public function SetAuthor(string $author, bool $isUTF8=false) : void |
| 419 | 419 | {
|
| 420 | - // Author of document |
|
| 421 | - $this->metadata['Author'] = $isUTF8 ? $author : utf8_encode($author); |
|
| 420 | + // Author of document |
|
| 421 | + $this->metadata['Author'] = $isUTF8 ? $author : utf8_encode($author); |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | /** |
@@ -428,8 +428,8 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | public function SetSubject(string $subject, bool $isUTF8=false) : void |
| 430 | 430 | {
|
| 431 | - // Subject of document |
|
| 432 | - $this->metadata['Subject'] = $isUTF8 ? $subject : utf8_encode($subject); |
|
| 431 | + // Subject of document |
|
| 432 | + $this->metadata['Subject'] = $isUTF8 ? $subject : utf8_encode($subject); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | */ |
| 440 | 440 | public function SetKeywords(string $keywords, bool $isUTF8=false) : void |
| 441 | 441 | {
|
| 442 | - // Keywords of document |
|
| 443 | - $this->metadata['Keywords'] = $isUTF8 ? $keywords : utf8_encode($keywords); |
|
| 442 | + // Keywords of document |
|
| 443 | + $this->metadata['Keywords'] = $isUTF8 ? $keywords : utf8_encode($keywords); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | /** |
@@ -450,8 +450,8 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | public function SetCreator(string $creator, bool $isUTF8=false) : void |
| 452 | 452 | {
|
| 453 | - // Creator of document |
|
| 454 | - $this->metadata['Creator'] = $isUTF8 ? $creator : utf8_encode($creator); |
|
| 453 | + // Creator of document |
|
| 454 | + $this->metadata['Creator'] = $isUTF8 ? $creator : utf8_encode($creator); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /** |
@@ -460,8 +460,8 @@ discard block |
||
| 460 | 460 | */ |
| 461 | 461 | public function AliasNbPages(string $alias='{nb}') : void
|
| 462 | 462 | {
|
| 463 | - // Define an alias for total number of pages |
|
| 464 | - $this->AliasNbPages = $alias; |
|
| 463 | + // Define an alias for total number of pages |
|
| 464 | + $this->AliasNbPages = $alias; |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | /** |
@@ -474,8 +474,8 @@ discard block |
||
| 474 | 474 | */ |
| 475 | 475 | public function Error(string $msg) : void |
| 476 | 476 | {
|
| 477 | - // Fatal error |
|
| 478 | - throw new \Exception('FPDF error: '.$msg);
|
|
| 477 | + // Fatal error |
|
| 478 | + throw new \Exception('FPDF error: '.$msg);
|
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | /** |
@@ -486,19 +486,19 @@ discard block |
||
| 486 | 486 | */ |
| 487 | 487 | public function Close() : void |
| 488 | 488 | {
|
| 489 | - // Terminate document |
|
| 490 | - if($this->state==3) |
|
| 491 | - return; |
|
| 492 | - if($this->page==0) |
|
| 493 | - $this->addPage(); |
|
| 494 | - // Page footer |
|
| 495 | - $this->InFooter = true; |
|
| 496 | - $this->Footer(); |
|
| 497 | - $this->InFooter = false; |
|
| 498 | - // Close page |
|
| 499 | - $this->_endpage(); |
|
| 500 | - // Close document |
|
| 501 | - $this->_enddoc(); |
|
| 489 | + // Terminate document |
|
| 490 | + if($this->state==3) |
|
| 491 | + return; |
|
| 492 | + if($this->page==0) |
|
| 493 | + $this->addPage(); |
|
| 494 | + // Page footer |
|
| 495 | + $this->InFooter = true; |
|
| 496 | + $this->Footer(); |
|
| 497 | + $this->InFooter = false; |
|
| 498 | + // Close page |
|
| 499 | + $this->_endpage(); |
|
| 500 | + // Close document |
|
| 501 | + $this->_enddoc(); |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | /** |
@@ -531,71 +531,71 @@ discard block |
||
| 531 | 531 | */ |
| 532 | 532 | public function AddPage(string $orientation='', $size='', int $rotation=0) : void |
| 533 | 533 | {
|
| 534 | - // Start a new page |
|
| 535 | - if($this->state==3) |
|
| 536 | - $this->Error('The document is closed');
|
|
| 537 | - $family = $this->FontFamily; |
|
| 538 | - $style = $this->FontStyle.($this->underline ? 'U' : ''); |
|
| 539 | - $fontsize = $this->FontSizePt; |
|
| 540 | - $lw = $this->LineWidth; |
|
| 541 | - $dc = $this->DrawColor; |
|
| 542 | - $fc = $this->FillColor; |
|
| 543 | - $tc = $this->TextColor; |
|
| 544 | - $cf = $this->ColorFlag; |
|
| 545 | - if($this->page>0) |
|
| 546 | - {
|
|
| 547 | - // Page footer |
|
| 548 | - $this->InFooter = true; |
|
| 549 | - $this->Footer(); |
|
| 550 | - $this->InFooter = false; |
|
| 551 | - // Close page |
|
| 552 | - $this->_endpage(); |
|
| 553 | - } |
|
| 554 | - // Start new page |
|
| 555 | - $this->_beginpage($orientation,$size,$rotation); |
|
| 556 | - // Set line cap style to square |
|
| 557 | - $this->_out('2 J');
|
|
| 558 | - // Set line width |
|
| 559 | - $this->LineWidth = $lw; |
|
| 560 | - $this->_out(sprintf('%.2F w',$lw*$this->k));
|
|
| 561 | - // Set font |
|
| 562 | - if($family) |
|
| 563 | - $this->setFont($family,$style,$fontsize); |
|
| 564 | - // Set colors |
|
| 565 | - $this->DrawColor = $dc; |
|
| 566 | - if($dc!='0 G') |
|
| 567 | - $this->_out($dc); |
|
| 568 | - $this->FillColor = $fc; |
|
| 569 | - if($fc!='0 g') |
|
| 570 | - $this->_out($fc); |
|
| 571 | - $this->TextColor = $tc; |
|
| 572 | - $this->ColorFlag = $cf; |
|
| 573 | - // Page header |
|
| 574 | - $this->InHeader = true; |
|
| 575 | - $this->Header(); |
|
| 576 | - $this->InHeader = false; |
|
| 577 | - // Restore line width |
|
| 578 | - if($this->LineWidth!=$lw) |
|
| 579 | - {
|
|
| 580 | - $this->LineWidth = $lw; |
|
| 581 | - $this->_out(sprintf('%.2F w',$lw*$this->k));
|
|
| 582 | - } |
|
| 583 | - // Restore font |
|
| 584 | - if($family) |
|
| 585 | - $this->setFont($family,$style,$fontsize); |
|
| 586 | - // Restore colors |
|
| 587 | - if($this->DrawColor!=$dc) |
|
| 588 | - {
|
|
| 589 | - $this->DrawColor = $dc; |
|
| 590 | - $this->_out($dc); |
|
| 591 | - } |
|
| 592 | - if($this->FillColor!=$fc) |
|
| 593 | - {
|
|
| 594 | - $this->FillColor = $fc; |
|
| 595 | - $this->_out($fc); |
|
| 596 | - } |
|
| 597 | - $this->TextColor = $tc; |
|
| 598 | - $this->ColorFlag = $cf; |
|
| 534 | + // Start a new page |
|
| 535 | + if($this->state==3) |
|
| 536 | + $this->Error('The document is closed');
|
|
| 537 | + $family = $this->FontFamily; |
|
| 538 | + $style = $this->FontStyle.($this->underline ? 'U' : ''); |
|
| 539 | + $fontsize = $this->FontSizePt; |
|
| 540 | + $lw = $this->LineWidth; |
|
| 541 | + $dc = $this->DrawColor; |
|
| 542 | + $fc = $this->FillColor; |
|
| 543 | + $tc = $this->TextColor; |
|
| 544 | + $cf = $this->ColorFlag; |
|
| 545 | + if($this->page>0) |
|
| 546 | + {
|
|
| 547 | + // Page footer |
|
| 548 | + $this->InFooter = true; |
|
| 549 | + $this->Footer(); |
|
| 550 | + $this->InFooter = false; |
|
| 551 | + // Close page |
|
| 552 | + $this->_endpage(); |
|
| 553 | + } |
|
| 554 | + // Start new page |
|
| 555 | + $this->_beginpage($orientation,$size,$rotation); |
|
| 556 | + // Set line cap style to square |
|
| 557 | + $this->_out('2 J');
|
|
| 558 | + // Set line width |
|
| 559 | + $this->LineWidth = $lw; |
|
| 560 | + $this->_out(sprintf('%.2F w',$lw*$this->k));
|
|
| 561 | + // Set font |
|
| 562 | + if($family) |
|
| 563 | + $this->setFont($family,$style,$fontsize); |
|
| 564 | + // Set colors |
|
| 565 | + $this->DrawColor = $dc; |
|
| 566 | + if($dc!='0 G') |
|
| 567 | + $this->_out($dc); |
|
| 568 | + $this->FillColor = $fc; |
|
| 569 | + if($fc!='0 g') |
|
| 570 | + $this->_out($fc); |
|
| 571 | + $this->TextColor = $tc; |
|
| 572 | + $this->ColorFlag = $cf; |
|
| 573 | + // Page header |
|
| 574 | + $this->InHeader = true; |
|
| 575 | + $this->Header(); |
|
| 576 | + $this->InHeader = false; |
|
| 577 | + // Restore line width |
|
| 578 | + if($this->LineWidth!=$lw) |
|
| 579 | + {
|
|
| 580 | + $this->LineWidth = $lw; |
|
| 581 | + $this->_out(sprintf('%.2F w',$lw*$this->k));
|
|
| 582 | + } |
|
| 583 | + // Restore font |
|
| 584 | + if($family) |
|
| 585 | + $this->setFont($family,$style,$fontsize); |
|
| 586 | + // Restore colors |
|
| 587 | + if($this->DrawColor!=$dc) |
|
| 588 | + {
|
|
| 589 | + $this->DrawColor = $dc; |
|
| 590 | + $this->_out($dc); |
|
| 591 | + } |
|
| 592 | + if($this->FillColor!=$fc) |
|
| 593 | + {
|
|
| 594 | + $this->FillColor = $fc; |
|
| 595 | + $this->_out($fc); |
|
| 596 | + } |
|
| 597 | + $this->TextColor = $tc; |
|
| 598 | + $this->ColorFlag = $cf; |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | /** |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | */ |
| 607 | 607 | public function Header() : void |
| 608 | 608 | {
|
| 609 | - // To be implemented in your own inherited class |
|
| 609 | + // To be implemented in your own inherited class |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | /** |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | */ |
| 618 | 618 | public function Footer() : void |
| 619 | 619 | {
|
| 620 | - // To be implemented in your own inherited class |
|
| 620 | + // To be implemented in your own inherited class |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /** |
@@ -626,8 +626,8 @@ discard block |
||
| 626 | 626 | */ |
| 627 | 627 | public function PageNo() : int |
| 628 | 628 | {
|
| 629 | - // Get current page number |
|
| 630 | - return $this->page; |
|
| 629 | + // Get current page number |
|
| 630 | + return $this->page; |
|
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | /** |
@@ -640,13 +640,13 @@ discard block |
||
| 640 | 640 | */ |
| 641 | 641 | public function SetDrawColor(int $r, ?int $g=null, ?int $b=null) : void |
| 642 | 642 | {
|
| 643 | - // Set color for all stroking operations |
|
| 644 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 645 | - $this->DrawColor = sprintf('%.3F G',$r/255);
|
|
| 646 | - else |
|
| 647 | - $this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
|
|
| 648 | - if($this->page>0) |
|
| 649 | - $this->_out($this->DrawColor); |
|
| 643 | + // Set color for all stroking operations |
|
| 644 | + if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 645 | + $this->DrawColor = sprintf('%.3F G',$r/255);
|
|
| 646 | + else |
|
| 647 | + $this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
|
|
| 648 | + if($this->page>0) |
|
| 649 | + $this->_out($this->DrawColor); |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | /** |
@@ -659,14 +659,14 @@ discard block |
||
| 659 | 659 | */ |
| 660 | 660 | public function SetFillColor(int $r, ?int $g=null, ?int $b=null) : void |
| 661 | 661 | {
|
| 662 | - // Set color for all filling operations |
|
| 663 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 664 | - $this->FillColor = sprintf('%.3F g',$r/255);
|
|
| 665 | - else |
|
| 666 | - $this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
|
| 667 | - $this->ColorFlag = ($this->FillColor!=$this->TextColor); |
|
| 668 | - if($this->page>0) |
|
| 669 | - $this->_out($this->FillColor); |
|
| 662 | + // Set color for all filling operations |
|
| 663 | + if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 664 | + $this->FillColor = sprintf('%.3F g',$r/255);
|
|
| 665 | + else |
|
| 666 | + $this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
|
| 667 | + $this->ColorFlag = ($this->FillColor!=$this->TextColor); |
|
| 668 | + if($this->page>0) |
|
| 669 | + $this->_out($this->FillColor); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | /** |
@@ -679,12 +679,12 @@ discard block |
||
| 679 | 679 | */ |
| 680 | 680 | public function SetTextColor(int $r, ?int $g=null, ?int $b=null) : void |
| 681 | 681 | {
|
| 682 | - // Set color for text |
|
| 683 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 684 | - $this->TextColor = sprintf('%.3F g',$r/255);
|
|
| 685 | - else |
|
| 686 | - $this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
|
| 687 | - $this->ColorFlag = ($this->FillColor!=$this->TextColor); |
|
| 682 | + // Set color for text |
|
| 683 | + if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 684 | + $this->TextColor = sprintf('%.3F g',$r/255);
|
|
| 685 | + else |
|
| 686 | + $this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
|
| 687 | + $this->ColorFlag = ($this->FillColor!=$this->TextColor); |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | /** |
@@ -695,14 +695,14 @@ discard block |
||
| 695 | 695 | */ |
| 696 | 696 | public function GetStringWidth(string $s) : float |
| 697 | 697 | {
|
| 698 | - // Get width of a string in the current font |
|
| 699 | - $s = (string)$s; |
|
| 700 | - $cw = &$this->CurrentFont['cw']; |
|
| 701 | - $w = 0; |
|
| 702 | - $l = strlen($s); |
|
| 703 | - for($i=0;$i<$l;$i++) |
|
| 704 | - $w += $cw[$s[$i]]; |
|
| 705 | - return $w*$this->FontSize/1000; |
|
| 698 | + // Get width of a string in the current font |
|
| 699 | + $s = (string)$s; |
|
| 700 | + $cw = &$this->CurrentFont['cw']; |
|
| 701 | + $w = 0; |
|
| 702 | + $l = strlen($s); |
|
| 703 | + for($i=0;$i<$l;$i++) |
|
| 704 | + $w += $cw[$s[$i]]; |
|
| 705 | + return $w*$this->FontSize/1000; |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | /** |
@@ -713,10 +713,10 @@ discard block |
||
| 713 | 713 | */ |
| 714 | 714 | public function SetLineWidth(float $width) : void |
| 715 | 715 | {
|
| 716 | - // Set line width |
|
| 717 | - $this->LineWidth = $width; |
|
| 718 | - if($this->page>0) |
|
| 719 | - $this->_out(sprintf('%.2F w',$width*$this->k));
|
|
| 716 | + // Set line width |
|
| 717 | + $this->LineWidth = $width; |
|
| 718 | + if($this->page>0) |
|
| 719 | + $this->_out(sprintf('%.2F w',$width*$this->k));
|
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | /** |
@@ -730,8 +730,8 @@ discard block |
||
| 730 | 730 | */ |
| 731 | 731 | public function Line(float $x1, float $y1, float $x2, float $y2) : void |
| 732 | 732 | {
|
| 733 | - // Draw a line |
|
| 734 | - $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));
|
|
| 733 | + // Draw a line |
|
| 734 | + $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));
|
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | /** |
@@ -751,14 +751,14 @@ discard block |
||
| 751 | 751 | */ |
| 752 | 752 | public function Rect(float $x, float $y, float $w, float $h, string $style='') : void |
| 753 | 753 | {
|
| 754 | - // Draw a rectangle |
|
| 755 | - if($style=='F') |
|
| 756 | - $op = 'f'; |
|
| 757 | - elseif($style=='FD' || $style=='DF') |
|
| 758 | - $op = 'B'; |
|
| 759 | - else |
|
| 760 | - $op = 'S'; |
|
| 761 | - $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
|
|
| 754 | + // Draw a rectangle |
|
| 755 | + if($style=='F') |
|
| 756 | + $op = 'f'; |
|
| 757 | + elseif($style=='FD' || $style=='DF') |
|
| 758 | + $op = 'B'; |
|
| 759 | + else |
|
| 760 | + $op = 'S'; |
|
| 761 | + $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
|
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | /** |
@@ -780,27 +780,27 @@ discard block |
||
| 780 | 780 | */ |
| 781 | 781 | public function AddFont(string $family, string $style='', string $file='') : void |
| 782 | 782 | {
|
| 783 | - // Add a TrueType, OpenType or Type1 font |
|
| 784 | - $family = strtolower($family); |
|
| 785 | - if($file=='') |
|
| 786 | - $file = str_replace(' ','',$family).strtolower($style).'.php';
|
|
| 787 | - $style = strtoupper($style); |
|
| 788 | - if($style=='IB') |
|
| 789 | - $style = 'BI'; |
|
| 790 | - $fontkey = $family.$style; |
|
| 791 | - if(isset($this->fonts[$fontkey])) |
|
| 792 | - return; |
|
| 793 | - $info = $this->_loadfont($file); |
|
| 794 | - $info['i'] = count($this->fonts)+1; |
|
| 795 | - if(!empty($info['file'])) |
|
| 796 | - {
|
|
| 797 | - // Embedded font |
|
| 798 | - if($info['type']=='TrueType') |
|
| 799 | - $this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']);
|
|
| 800 | - else |
|
| 801 | - $this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']);
|
|
| 802 | - } |
|
| 803 | - $this->fonts[$fontkey] = $info; |
|
| 783 | + // Add a TrueType, OpenType or Type1 font |
|
| 784 | + $family = strtolower($family); |
|
| 785 | + if($file=='') |
|
| 786 | + $file = str_replace(' ','',$family).strtolower($style).'.php';
|
|
| 787 | + $style = strtoupper($style); |
|
| 788 | + if($style=='IB') |
|
| 789 | + $style = 'BI'; |
|
| 790 | + $fontkey = $family.$style; |
|
| 791 | + if(isset($this->fonts[$fontkey])) |
|
| 792 | + return; |
|
| 793 | + $info = $this->_loadfont($file); |
|
| 794 | + $info['i'] = count($this->fonts)+1; |
|
| 795 | + if(!empty($info['file'])) |
|
| 796 | + {
|
|
| 797 | + // Embedded font |
|
| 798 | + if($info['type']=='TrueType') |
|
| 799 | + $this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']);
|
|
| 800 | + else |
|
| 801 | + $this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']);
|
|
| 802 | + } |
|
| 803 | + $this->fonts[$fontkey] = $info; |
|
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | /** |
@@ -840,52 +840,52 @@ discard block |
||
| 840 | 840 | */ |
| 841 | 841 | public function SetFont(string $family, string $style='', float $size=0) : void |
| 842 | 842 | {
|
| 843 | - // Select a font; size given in points |
|
| 844 | - if($family=='') |
|
| 845 | - $family = $this->FontFamily; |
|
| 846 | - else |
|
| 847 | - $family = strtolower($family); |
|
| 848 | - $style = strtoupper($style); |
|
| 849 | - if(strpos($style,'U')!==false) |
|
| 850 | - {
|
|
| 851 | - $this->underline = true; |
|
| 852 | - $style = str_replace('U','',$style);
|
|
| 853 | - } |
|
| 854 | - else |
|
| 855 | - $this->underline = false; |
|
| 856 | - if($style=='IB') |
|
| 857 | - $style = 'BI'; |
|
| 858 | - if($size==0) |
|
| 859 | - $size = $this->FontSizePt; |
|
| 860 | - // Test if font is already selected |
|
| 861 | - if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) |
|
| 862 | - return; |
|
| 863 | - // Test if font is already loaded |
|
| 864 | - $fontkey = $family.$style; |
|
| 865 | - if(!isset($this->fonts[$fontkey])) |
|
| 866 | - {
|
|
| 867 | - // Test if one of the core fonts |
|
| 868 | - if($family=='arial') |
|
| 869 | - $family = 'helvetica'; |
|
| 870 | - if(in_array($family,$this->CoreFonts)) |
|
| 871 | - {
|
|
| 872 | - if($family=='symbol' || $family=='zapfdingbats') |
|
| 873 | - $style = ''; |
|
| 874 | - $fontkey = $family.$style; |
|
| 875 | - if(!isset($this->fonts[$fontkey])) |
|
| 876 | - $this->addFont($family,$style); |
|
| 877 | - } |
|
| 878 | - else |
|
| 879 | - $this->Error('Undefined font: '.$family.' '.$style);
|
|
| 880 | - } |
|
| 881 | - // Select it |
|
| 882 | - $this->FontFamily = $family; |
|
| 883 | - $this->FontStyle = $style; |
|
| 884 | - $this->FontSizePt = $size; |
|
| 885 | - $this->FontSize = $size/$this->k; |
|
| 886 | - $this->CurrentFont = &$this->fonts[$fontkey]; |
|
| 887 | - if($this->page>0) |
|
| 888 | - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
|
| 843 | + // Select a font; size given in points |
|
| 844 | + if($family=='') |
|
| 845 | + $family = $this->FontFamily; |
|
| 846 | + else |
|
| 847 | + $family = strtolower($family); |
|
| 848 | + $style = strtoupper($style); |
|
| 849 | + if(strpos($style,'U')!==false) |
|
| 850 | + {
|
|
| 851 | + $this->underline = true; |
|
| 852 | + $style = str_replace('U','',$style);
|
|
| 853 | + } |
|
| 854 | + else |
|
| 855 | + $this->underline = false; |
|
| 856 | + if($style=='IB') |
|
| 857 | + $style = 'BI'; |
|
| 858 | + if($size==0) |
|
| 859 | + $size = $this->FontSizePt; |
|
| 860 | + // Test if font is already selected |
|
| 861 | + if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) |
|
| 862 | + return; |
|
| 863 | + // Test if font is already loaded |
|
| 864 | + $fontkey = $family.$style; |
|
| 865 | + if(!isset($this->fonts[$fontkey])) |
|
| 866 | + {
|
|
| 867 | + // Test if one of the core fonts |
|
| 868 | + if($family=='arial') |
|
| 869 | + $family = 'helvetica'; |
|
| 870 | + if(in_array($family,$this->CoreFonts)) |
|
| 871 | + {
|
|
| 872 | + if($family=='symbol' || $family=='zapfdingbats') |
|
| 873 | + $style = ''; |
|
| 874 | + $fontkey = $family.$style; |
|
| 875 | + if(!isset($this->fonts[$fontkey])) |
|
| 876 | + $this->addFont($family,$style); |
|
| 877 | + } |
|
| 878 | + else |
|
| 879 | + $this->Error('Undefined font: '.$family.' '.$style);
|
|
| 880 | + } |
|
| 881 | + // Select it |
|
| 882 | + $this->FontFamily = $family; |
|
| 883 | + $this->FontStyle = $style; |
|
| 884 | + $this->FontSizePt = $size; |
|
| 885 | + $this->FontSize = $size/$this->k; |
|
| 886 | + $this->CurrentFont = &$this->fonts[$fontkey]; |
|
| 887 | + if($this->page>0) |
|
| 888 | + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | /** |
@@ -894,13 +894,13 @@ discard block |
||
| 894 | 894 | */ |
| 895 | 895 | public function SetFontSize(float $size) : void |
| 896 | 896 | {
|
| 897 | - // Set font size in points |
|
| 898 | - if($this->FontSizePt==$size) |
|
| 899 | - return; |
|
| 900 | - $this->FontSizePt = $size; |
|
| 901 | - $this->FontSize = $size/$this->k; |
|
| 902 | - if($this->page>0) |
|
| 903 | - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
|
| 897 | + // Set font size in points |
|
| 898 | + if($this->FontSizePt==$size) |
|
| 899 | + return; |
|
| 900 | + $this->FontSizePt = $size; |
|
| 901 | + $this->FontSize = $size/$this->k; |
|
| 902 | + if($this->page>0) |
|
| 903 | + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
|
| 904 | 904 | } |
| 905 | 905 | |
| 906 | 906 | /** |
@@ -912,10 +912,10 @@ discard block |
||
| 912 | 912 | */ |
| 913 | 913 | public function AddLink() : int |
| 914 | 914 | {
|
| 915 | - // Create a new internal link |
|
| 916 | - $n = count($this->links)+1; |
|
| 917 | - $this->links[$n] = array(0, 0); |
|
| 918 | - return $n; |
|
| 915 | + // Create a new internal link |
|
| 916 | + $n = count($this->links)+1; |
|
| 917 | + $this->links[$n] = array(0, 0); |
|
| 918 | + return $n; |
|
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | /** |
@@ -926,12 +926,12 @@ discard block |
||
| 926 | 926 | */ |
| 927 | 927 | public function SetLink(int $link, float $y=0, int $page=-1) : void |
| 928 | 928 | {
|
| 929 | - // Set destination of internal link |
|
| 930 | - if($y==-1) |
|
| 931 | - $y = $this->y; |
|
| 932 | - if($page==-1) |
|
| 933 | - $page = $this->page; |
|
| 934 | - $this->links[$link] = array($page, $y); |
|
| 929 | + // Set destination of internal link |
|
| 930 | + if($y==-1) |
|
| 931 | + $y = $this->y; |
|
| 932 | + if($page==-1) |
|
| 933 | + $page = $this->page; |
|
| 934 | + $this->links[$link] = array($page, $y); |
|
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | /** |
@@ -947,8 +947,8 @@ discard block |
||
| 947 | 947 | */ |
| 948 | 948 | public function Link(float $x, float $y, float $w, float $h, $link) : void |
| 949 | 949 | {
|
| 950 | - // Put a link on the page |
|
| 951 | - $this->PageLinks[$this->page][] = array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link); |
|
| 950 | + // Put a link on the page |
|
| 951 | + $this->PageLinks[$this->page][] = array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link); |
|
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | /** |
@@ -963,15 +963,15 @@ discard block |
||
| 963 | 963 | */ |
| 964 | 964 | public function Text(float $x, float $y, string $txt) : void |
| 965 | 965 | {
|
| 966 | - // Output a string |
|
| 967 | - if(!isset($this->CurrentFont)) |
|
| 968 | - $this->Error('No font has been set');
|
|
| 969 | - $s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
|
|
| 970 | - if($this->underline && $txt!='') |
|
| 971 | - $s .= ' '.$this->_dounderline($x,$y,$txt); |
|
| 972 | - if($this->ColorFlag) |
|
| 973 | - $s = 'q '.$this->TextColor.' '.$s.' Q'; |
|
| 974 | - $this->_out($s); |
|
| 966 | + // Output a string |
|
| 967 | + if(!isset($this->CurrentFont)) |
|
| 968 | + $this->Error('No font has been set');
|
|
| 969 | + $s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
|
|
| 970 | + if($this->underline && $txt!='') |
|
| 971 | + $s .= ' '.$this->_dounderline($x,$y,$txt); |
|
| 972 | + if($this->ColorFlag) |
|
| 973 | + $s = 'q '.$this->TextColor.' '.$s.' Q'; |
|
| 974 | + $this->_out($s); |
|
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | /** |
@@ -987,8 +987,8 @@ discard block |
||
| 987 | 987 | */ |
| 988 | 988 | public function AcceptPageBreak() : bool |
| 989 | 989 | {
|
| 990 | - // Accept automatic page break or not |
|
| 991 | - return $this->AutoPageBreak; |
|
| 990 | + // Accept automatic page break or not |
|
| 991 | + return $this->AutoPageBreak; |
|
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | /** |
@@ -1030,82 +1030,82 @@ discard block |
||
| 1030 | 1030 | */ |
| 1031 | 1031 | public function Cell(float $w, float $h=0, string $txt='', $border=0, float $ln=0, $align='', $fill=false, $link='') : void |
| 1032 | 1032 | {
|
| 1033 | - // Output a cell |
|
| 1034 | - $k = $this->k; |
|
| 1035 | - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
| 1036 | - {
|
|
| 1037 | - // Automatic page break |
|
| 1038 | - $x = $this->x; |
|
| 1039 | - $ws = $this->ws; |
|
| 1040 | - if($ws>0) |
|
| 1041 | - {
|
|
| 1042 | - $this->ws = 0; |
|
| 1043 | - $this->_out('0 Tw');
|
|
| 1044 | - } |
|
| 1045 | - $this->addPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation); |
|
| 1046 | - $this->x = $x; |
|
| 1047 | - if($ws>0) |
|
| 1048 | - {
|
|
| 1049 | - $this->ws = $ws; |
|
| 1050 | - $this->_out(sprintf('%.3F Tw',$ws*$k));
|
|
| 1051 | - } |
|
| 1052 | - } |
|
| 1053 | - if($w==0) |
|
| 1054 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1055 | - $s = ''; |
|
| 1056 | - if($fill || $border==1) |
|
| 1057 | - {
|
|
| 1058 | - if($fill) |
|
| 1059 | - $op = ($border==1) ? 'B' : 'f'; |
|
| 1060 | - else |
|
| 1061 | - $op = 'S'; |
|
| 1062 | - $s = sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
|
|
| 1063 | - } |
|
| 1064 | - if(is_string($border)) |
|
| 1065 | - {
|
|
| 1066 | - $x = $this->x; |
|
| 1067 | - $y = $this->y; |
|
| 1068 | - if(strpos($border,'L')!==false) |
|
| 1069 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
|
|
| 1070 | - if(strpos($border,'T')!==false) |
|
| 1071 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
|
|
| 1072 | - if(strpos($border,'R')!==false) |
|
| 1073 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
|
| 1074 | - if(strpos($border,'B')!==false) |
|
| 1075 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
|
| 1076 | - } |
|
| 1077 | - if($txt!=='') |
|
| 1078 | - {
|
|
| 1079 | - if(!isset($this->CurrentFont)) |
|
| 1080 | - $this->Error('No font has been set');
|
|
| 1081 | - if($align=='R') |
|
| 1082 | - $dx = $w-$this->cMargin-$this->getStringWidth($txt); |
|
| 1083 | - elseif($align=='C') |
|
| 1084 | - $dx = ($w-$this->getStringWidth($txt))/2; |
|
| 1085 | - else |
|
| 1086 | - $dx = $this->cMargin; |
|
| 1087 | - if($this->ColorFlag) |
|
| 1088 | - $s .= 'q '.$this->TextColor.' '; |
|
| 1089 | - $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$this->_escape($txt));
|
|
| 1090 | - if($this->underline) |
|
| 1091 | - $s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); |
|
| 1092 | - if($this->ColorFlag) |
|
| 1093 | - $s .= ' Q'; |
|
| 1094 | - if($link) |
|
| 1095 | - $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->getStringWidth($txt),$this->FontSize,$link); |
|
| 1096 | - } |
|
| 1097 | - if($s) |
|
| 1098 | - $this->_out($s); |
|
| 1099 | - $this->lasth = $h; |
|
| 1100 | - if($ln>0) |
|
| 1101 | - {
|
|
| 1102 | - // Go to next line |
|
| 1103 | - $this->y += $h; |
|
| 1104 | - if($ln==1) |
|
| 1105 | - $this->x = $this->lMargin; |
|
| 1106 | - } |
|
| 1107 | - else |
|
| 1108 | - $this->x += $w; |
|
| 1033 | + // Output a cell |
|
| 1034 | + $k = $this->k; |
|
| 1035 | + if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
| 1036 | + {
|
|
| 1037 | + // Automatic page break |
|
| 1038 | + $x = $this->x; |
|
| 1039 | + $ws = $this->ws; |
|
| 1040 | + if($ws>0) |
|
| 1041 | + {
|
|
| 1042 | + $this->ws = 0; |
|
| 1043 | + $this->_out('0 Tw');
|
|
| 1044 | + } |
|
| 1045 | + $this->addPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation); |
|
| 1046 | + $this->x = $x; |
|
| 1047 | + if($ws>0) |
|
| 1048 | + {
|
|
| 1049 | + $this->ws = $ws; |
|
| 1050 | + $this->_out(sprintf('%.3F Tw',$ws*$k));
|
|
| 1051 | + } |
|
| 1052 | + } |
|
| 1053 | + if($w==0) |
|
| 1054 | + $w = $this->w-$this->rMargin-$this->x; |
|
| 1055 | + $s = ''; |
|
| 1056 | + if($fill || $border==1) |
|
| 1057 | + {
|
|
| 1058 | + if($fill) |
|
| 1059 | + $op = ($border==1) ? 'B' : 'f'; |
|
| 1060 | + else |
|
| 1061 | + $op = 'S'; |
|
| 1062 | + $s = sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
|
|
| 1063 | + } |
|
| 1064 | + if(is_string($border)) |
|
| 1065 | + {
|
|
| 1066 | + $x = $this->x; |
|
| 1067 | + $y = $this->y; |
|
| 1068 | + if(strpos($border,'L')!==false) |
|
| 1069 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
|
|
| 1070 | + if(strpos($border,'T')!==false) |
|
| 1071 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
|
|
| 1072 | + if(strpos($border,'R')!==false) |
|
| 1073 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
|
| 1074 | + if(strpos($border,'B')!==false) |
|
| 1075 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
|
| 1076 | + } |
|
| 1077 | + if($txt!=='') |
|
| 1078 | + {
|
|
| 1079 | + if(!isset($this->CurrentFont)) |
|
| 1080 | + $this->Error('No font has been set');
|
|
| 1081 | + if($align=='R') |
|
| 1082 | + $dx = $w-$this->cMargin-$this->getStringWidth($txt); |
|
| 1083 | + elseif($align=='C') |
|
| 1084 | + $dx = ($w-$this->getStringWidth($txt))/2; |
|
| 1085 | + else |
|
| 1086 | + $dx = $this->cMargin; |
|
| 1087 | + if($this->ColorFlag) |
|
| 1088 | + $s .= 'q '.$this->TextColor.' '; |
|
| 1089 | + $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$this->_escape($txt));
|
|
| 1090 | + if($this->underline) |
|
| 1091 | + $s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); |
|
| 1092 | + if($this->ColorFlag) |
|
| 1093 | + $s .= ' Q'; |
|
| 1094 | + if($link) |
|
| 1095 | + $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->getStringWidth($txt),$this->FontSize,$link); |
|
| 1096 | + } |
|
| 1097 | + if($s) |
|
| 1098 | + $this->_out($s); |
|
| 1099 | + $this->lasth = $h; |
|
| 1100 | + if($ln>0) |
|
| 1101 | + {
|
|
| 1102 | + // Go to next line |
|
| 1103 | + $this->y += $h; |
|
| 1104 | + if($ln==1) |
|
| 1105 | + $this->x = $this->lMargin; |
|
| 1106 | + } |
|
| 1107 | + else |
|
| 1108 | + $this->x += $w; |
|
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | 1111 | /** |
@@ -1138,119 +1138,119 @@ discard block |
||
| 1138 | 1138 | */ |
| 1139 | 1139 | public function MultiCell(float $w, float $h, string $txt, $border=0, string $align='J', bool $fill=false) : void |
| 1140 | 1140 | {
|
| 1141 | - // Output text with automatic or explicit line breaks |
|
| 1142 | - if(!isset($this->CurrentFont)) |
|
| 1143 | - $this->Error('No font has been set');
|
|
| 1144 | - $cw = &$this->CurrentFont['cw']; |
|
| 1145 | - if($w==0) |
|
| 1146 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1147 | - $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1148 | - $s = str_replace("\r",'',$txt);
|
|
| 1149 | - $nb = strlen($s); |
|
| 1150 | - if($nb>0 && $s[$nb-1]=="\n") |
|
| 1151 | - $nb--; |
|
| 1152 | - $b = 0; |
|
| 1153 | - $b2 = ''; |
|
| 1154 | - if($border) |
|
| 1155 | - {
|
|
| 1156 | - if($border==1) |
|
| 1157 | - {
|
|
| 1158 | - $border = 'LTRB'; |
|
| 1159 | - $b = 'LRT'; |
|
| 1160 | - $b2 = 'LR'; |
|
| 1161 | - } |
|
| 1162 | - else |
|
| 1163 | - {
|
|
| 1164 | - $b2 = ''; |
|
| 1165 | - if(strpos($border,'L')!==false) |
|
| 1166 | - $b2 .= 'L'; |
|
| 1167 | - if(strpos($border,'R')!==false) |
|
| 1168 | - $b2 .= 'R'; |
|
| 1169 | - $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2; |
|
| 1170 | - } |
|
| 1171 | - } |
|
| 1172 | - $sep = -1; |
|
| 1173 | - $i = 0; |
|
| 1174 | - $j = 0; |
|
| 1175 | - $l = 0; |
|
| 1176 | - $ns = 0; |
|
| 1177 | - $nl = 1; |
|
| 1178 | - $ls = 0; |
|
| 1179 | - while($i<$nb) |
|
| 1180 | - {
|
|
| 1181 | - // Get next character |
|
| 1182 | - $c = $s[$i]; |
|
| 1183 | - if($c=="\n") |
|
| 1184 | - {
|
|
| 1185 | - // Explicit line break |
|
| 1186 | - if($this->ws>0) |
|
| 1187 | - {
|
|
| 1188 | - $this->ws = 0; |
|
| 1189 | - $this->_out('0 Tw');
|
|
| 1190 | - } |
|
| 1191 | - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
| 1192 | - $i++; |
|
| 1193 | - $sep = -1; |
|
| 1194 | - $j = $i; |
|
| 1195 | - $l = 0; |
|
| 1196 | - $ns = 0; |
|
| 1197 | - $nl++; |
|
| 1198 | - if($border && $nl==2) |
|
| 1199 | - $b = $b2; |
|
| 1200 | - continue; |
|
| 1201 | - } |
|
| 1202 | - if($c==' ') |
|
| 1203 | - {
|
|
| 1204 | - $sep = $i; |
|
| 1205 | - $ls = $l; |
|
| 1206 | - $ns++; |
|
| 1207 | - } |
|
| 1208 | - $l += $cw[$c]; |
|
| 1209 | - if($l>$wmax) |
|
| 1210 | - {
|
|
| 1211 | - // Automatic line break |
|
| 1212 | - if($sep==-1) |
|
| 1213 | - {
|
|
| 1214 | - if($i==$j) |
|
| 1215 | - $i++; |
|
| 1216 | - if($this->ws>0) |
|
| 1217 | - {
|
|
| 1218 | - $this->ws = 0; |
|
| 1219 | - $this->_out('0 Tw');
|
|
| 1220 | - } |
|
| 1221 | - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
| 1222 | - } |
|
| 1223 | - else |
|
| 1224 | - {
|
|
| 1225 | - if($align=='J') |
|
| 1226 | - {
|
|
| 1227 | - $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; |
|
| 1228 | - $this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
|
|
| 1229 | - } |
|
| 1230 | - $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); |
|
| 1231 | - $i = $sep+1; |
|
| 1232 | - } |
|
| 1233 | - $sep = -1; |
|
| 1234 | - $j = $i; |
|
| 1235 | - $l = 0; |
|
| 1236 | - $ns = 0; |
|
| 1237 | - $nl++; |
|
| 1238 | - if($border && $nl==2) |
|
| 1239 | - $b = $b2; |
|
| 1240 | - } |
|
| 1241 | - else |
|
| 1242 | - $i++; |
|
| 1243 | - } |
|
| 1244 | - // Last chunk |
|
| 1245 | - if($this->ws>0) |
|
| 1246 | - {
|
|
| 1247 | - $this->ws = 0; |
|
| 1248 | - $this->_out('0 Tw');
|
|
| 1249 | - } |
|
| 1250 | - if($border && strpos($border,'B')!==false) |
|
| 1251 | - $b .= 'B'; |
|
| 1252 | - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
| 1253 | - $this->x = $this->lMargin; |
|
| 1141 | + // Output text with automatic or explicit line breaks |
|
| 1142 | + if(!isset($this->CurrentFont)) |
|
| 1143 | + $this->Error('No font has been set');
|
|
| 1144 | + $cw = &$this->CurrentFont['cw']; |
|
| 1145 | + if($w==0) |
|
| 1146 | + $w = $this->w-$this->rMargin-$this->x; |
|
| 1147 | + $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1148 | + $s = str_replace("\r",'',$txt);
|
|
| 1149 | + $nb = strlen($s); |
|
| 1150 | + if($nb>0 && $s[$nb-1]=="\n") |
|
| 1151 | + $nb--; |
|
| 1152 | + $b = 0; |
|
| 1153 | + $b2 = ''; |
|
| 1154 | + if($border) |
|
| 1155 | + {
|
|
| 1156 | + if($border==1) |
|
| 1157 | + {
|
|
| 1158 | + $border = 'LTRB'; |
|
| 1159 | + $b = 'LRT'; |
|
| 1160 | + $b2 = 'LR'; |
|
| 1161 | + } |
|
| 1162 | + else |
|
| 1163 | + {
|
|
| 1164 | + $b2 = ''; |
|
| 1165 | + if(strpos($border,'L')!==false) |
|
| 1166 | + $b2 .= 'L'; |
|
| 1167 | + if(strpos($border,'R')!==false) |
|
| 1168 | + $b2 .= 'R'; |
|
| 1169 | + $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2; |
|
| 1170 | + } |
|
| 1171 | + } |
|
| 1172 | + $sep = -1; |
|
| 1173 | + $i = 0; |
|
| 1174 | + $j = 0; |
|
| 1175 | + $l = 0; |
|
| 1176 | + $ns = 0; |
|
| 1177 | + $nl = 1; |
|
| 1178 | + $ls = 0; |
|
| 1179 | + while($i<$nb) |
|
| 1180 | + {
|
|
| 1181 | + // Get next character |
|
| 1182 | + $c = $s[$i]; |
|
| 1183 | + if($c=="\n") |
|
| 1184 | + {
|
|
| 1185 | + // Explicit line break |
|
| 1186 | + if($this->ws>0) |
|
| 1187 | + {
|
|
| 1188 | + $this->ws = 0; |
|
| 1189 | + $this->_out('0 Tw');
|
|
| 1190 | + } |
|
| 1191 | + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
| 1192 | + $i++; |
|
| 1193 | + $sep = -1; |
|
| 1194 | + $j = $i; |
|
| 1195 | + $l = 0; |
|
| 1196 | + $ns = 0; |
|
| 1197 | + $nl++; |
|
| 1198 | + if($border && $nl==2) |
|
| 1199 | + $b = $b2; |
|
| 1200 | + continue; |
|
| 1201 | + } |
|
| 1202 | + if($c==' ') |
|
| 1203 | + {
|
|
| 1204 | + $sep = $i; |
|
| 1205 | + $ls = $l; |
|
| 1206 | + $ns++; |
|
| 1207 | + } |
|
| 1208 | + $l += $cw[$c]; |
|
| 1209 | + if($l>$wmax) |
|
| 1210 | + {
|
|
| 1211 | + // Automatic line break |
|
| 1212 | + if($sep==-1) |
|
| 1213 | + {
|
|
| 1214 | + if($i==$j) |
|
| 1215 | + $i++; |
|
| 1216 | + if($this->ws>0) |
|
| 1217 | + {
|
|
| 1218 | + $this->ws = 0; |
|
| 1219 | + $this->_out('0 Tw');
|
|
| 1220 | + } |
|
| 1221 | + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
| 1222 | + } |
|
| 1223 | + else |
|
| 1224 | + {
|
|
| 1225 | + if($align=='J') |
|
| 1226 | + {
|
|
| 1227 | + $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; |
|
| 1228 | + $this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
|
|
| 1229 | + } |
|
| 1230 | + $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); |
|
| 1231 | + $i = $sep+1; |
|
| 1232 | + } |
|
| 1233 | + $sep = -1; |
|
| 1234 | + $j = $i; |
|
| 1235 | + $l = 0; |
|
| 1236 | + $ns = 0; |
|
| 1237 | + $nl++; |
|
| 1238 | + if($border && $nl==2) |
|
| 1239 | + $b = $b2; |
|
| 1240 | + } |
|
| 1241 | + else |
|
| 1242 | + $i++; |
|
| 1243 | + } |
|
| 1244 | + // Last chunk |
|
| 1245 | + if($this->ws>0) |
|
| 1246 | + {
|
|
| 1247 | + $this->ws = 0; |
|
| 1248 | + $this->_out('0 Tw');
|
|
| 1249 | + } |
|
| 1250 | + if($border && strpos($border,'B')!==false) |
|
| 1251 | + $b .= 'B'; |
|
| 1252 | + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
| 1253 | + $this->x = $this->lMargin; |
|
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | /** |
@@ -1265,85 +1265,85 @@ discard block |
||
| 1265 | 1265 | */ |
| 1266 | 1266 | public function Write(float $h, string $txt, $link='') : void |
| 1267 | 1267 | {
|
| 1268 | - // Output text in flowing mode |
|
| 1269 | - if(!isset($this->CurrentFont)) |
|
| 1270 | - $this->Error('No font has been set');
|
|
| 1271 | - $cw = &$this->CurrentFont['cw']; |
|
| 1272 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1273 | - $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1274 | - $s = str_replace("\r",'',$txt);
|
|
| 1275 | - $nb = strlen($s); |
|
| 1276 | - $sep = -1; |
|
| 1277 | - $i = 0; |
|
| 1278 | - $j = 0; |
|
| 1279 | - $l = 0; |
|
| 1280 | - $nl = 1; |
|
| 1281 | - while($i<$nb) |
|
| 1282 | - {
|
|
| 1283 | - // Get next character |
|
| 1284 | - $c = $s[$i]; |
|
| 1285 | - if($c=="\n") |
|
| 1286 | - {
|
|
| 1287 | - // Explicit line break |
|
| 1288 | - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link); |
|
| 1289 | - $i++; |
|
| 1290 | - $sep = -1; |
|
| 1291 | - $j = $i; |
|
| 1292 | - $l = 0; |
|
| 1293 | - if($nl==1) |
|
| 1294 | - {
|
|
| 1295 | - $this->x = $this->lMargin; |
|
| 1296 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1297 | - $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1298 | - } |
|
| 1299 | - $nl++; |
|
| 1300 | - continue; |
|
| 1301 | - } |
|
| 1302 | - if($c==' ') |
|
| 1303 | - $sep = $i; |
|
| 1304 | - $l += $cw[$c]; |
|
| 1305 | - if($l>$wmax) |
|
| 1306 | - {
|
|
| 1307 | - // Automatic line break |
|
| 1308 | - if($sep==-1) |
|
| 1309 | - {
|
|
| 1310 | - if($this->x>$this->lMargin) |
|
| 1311 | - {
|
|
| 1312 | - // Move to next line |
|
| 1313 | - $this->x = $this->lMargin; |
|
| 1314 | - $this->y += $h; |
|
| 1315 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1316 | - $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1317 | - $i++; |
|
| 1318 | - $nl++; |
|
| 1319 | - continue; |
|
| 1320 | - } |
|
| 1321 | - if($i==$j) |
|
| 1322 | - $i++; |
|
| 1323 | - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link); |
|
| 1324 | - } |
|
| 1325 | - else |
|
| 1326 | - {
|
|
| 1327 | - $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',false,$link); |
|
| 1328 | - $i = $sep+1; |
|
| 1329 | - } |
|
| 1330 | - $sep = -1; |
|
| 1331 | - $j = $i; |
|
| 1332 | - $l = 0; |
|
| 1333 | - if($nl==1) |
|
| 1334 | - {
|
|
| 1335 | - $this->x = $this->lMargin; |
|
| 1336 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1337 | - $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1338 | - } |
|
| 1339 | - $nl++; |
|
| 1340 | - } |
|
| 1341 | - else |
|
| 1342 | - $i++; |
|
| 1343 | - } |
|
| 1344 | - // Last chunk |
|
| 1345 | - if($i!=$j) |
|
| 1346 | - $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link); |
|
| 1268 | + // Output text in flowing mode |
|
| 1269 | + if(!isset($this->CurrentFont)) |
|
| 1270 | + $this->Error('No font has been set');
|
|
| 1271 | + $cw = &$this->CurrentFont['cw']; |
|
| 1272 | + $w = $this->w-$this->rMargin-$this->x; |
|
| 1273 | + $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1274 | + $s = str_replace("\r",'',$txt);
|
|
| 1275 | + $nb = strlen($s); |
|
| 1276 | + $sep = -1; |
|
| 1277 | + $i = 0; |
|
| 1278 | + $j = 0; |
|
| 1279 | + $l = 0; |
|
| 1280 | + $nl = 1; |
|
| 1281 | + while($i<$nb) |
|
| 1282 | + {
|
|
| 1283 | + // Get next character |
|
| 1284 | + $c = $s[$i]; |
|
| 1285 | + if($c=="\n") |
|
| 1286 | + {
|
|
| 1287 | + // Explicit line break |
|
| 1288 | + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link); |
|
| 1289 | + $i++; |
|
| 1290 | + $sep = -1; |
|
| 1291 | + $j = $i; |
|
| 1292 | + $l = 0; |
|
| 1293 | + if($nl==1) |
|
| 1294 | + {
|
|
| 1295 | + $this->x = $this->lMargin; |
|
| 1296 | + $w = $this->w-$this->rMargin-$this->x; |
|
| 1297 | + $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1298 | + } |
|
| 1299 | + $nl++; |
|
| 1300 | + continue; |
|
| 1301 | + } |
|
| 1302 | + if($c==' ') |
|
| 1303 | + $sep = $i; |
|
| 1304 | + $l += $cw[$c]; |
|
| 1305 | + if($l>$wmax) |
|
| 1306 | + {
|
|
| 1307 | + // Automatic line break |
|
| 1308 | + if($sep==-1) |
|
| 1309 | + {
|
|
| 1310 | + if($this->x>$this->lMargin) |
|
| 1311 | + {
|
|
| 1312 | + // Move to next line |
|
| 1313 | + $this->x = $this->lMargin; |
|
| 1314 | + $this->y += $h; |
|
| 1315 | + $w = $this->w-$this->rMargin-$this->x; |
|
| 1316 | + $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1317 | + $i++; |
|
| 1318 | + $nl++; |
|
| 1319 | + continue; |
|
| 1320 | + } |
|
| 1321 | + if($i==$j) |
|
| 1322 | + $i++; |
|
| 1323 | + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link); |
|
| 1324 | + } |
|
| 1325 | + else |
|
| 1326 | + {
|
|
| 1327 | + $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',false,$link); |
|
| 1328 | + $i = $sep+1; |
|
| 1329 | + } |
|
| 1330 | + $sep = -1; |
|
| 1331 | + $j = $i; |
|
| 1332 | + $l = 0; |
|
| 1333 | + if($nl==1) |
|
| 1334 | + {
|
|
| 1335 | + $this->x = $this->lMargin; |
|
| 1336 | + $w = $this->w-$this->rMargin-$this->x; |
|
| 1337 | + $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1338 | + } |
|
| 1339 | + $nl++; |
|
| 1340 | + } |
|
| 1341 | + else |
|
| 1342 | + $i++; |
|
| 1343 | + } |
|
| 1344 | + // Last chunk |
|
| 1345 | + if($i!=$j) |
|
| 1346 | + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link); |
|
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | 1349 | /** |
@@ -1355,12 +1355,12 @@ discard block |
||
| 1355 | 1355 | */ |
| 1356 | 1356 | public function Ln(float $h=null) : void |
| 1357 | 1357 | {
|
| 1358 | - // Line feed; default value is the last cell height |
|
| 1359 | - $this->x = $this->lMargin; |
|
| 1360 | - if($h===null) |
|
| 1361 | - $this->y += $this->lasth; |
|
| 1362 | - else |
|
| 1363 | - $this->y += $h; |
|
| 1358 | + // Line feed; default value is the last cell height |
|
| 1359 | + $this->x = $this->lMargin; |
|
| 1360 | + if($h===null) |
|
| 1361 | + $this->y += $this->lasth; |
|
| 1362 | + else |
|
| 1363 | + $this->y += $h; |
|
| 1364 | 1364 | } |
| 1365 | 1365 | |
| 1366 | 1366 | /** |
@@ -1411,67 +1411,67 @@ discard block |
||
| 1411 | 1411 | */ |
| 1412 | 1412 | public function Image(string $file, ?float $x=null, ?float $y=null, float $w=0, float $h=0, string $type='', $link='') : void |
| 1413 | 1413 | {
|
| 1414 | - // Put an image on the page |
|
| 1415 | - if($file=='') |
|
| 1416 | - $this->Error('Image file name is empty');
|
|
| 1417 | - if(!isset($this->images[$file])) |
|
| 1418 | - {
|
|
| 1419 | - // First use of this image, get info |
|
| 1420 | - if($type=='') |
|
| 1421 | - {
|
|
| 1422 | - $pos = strrpos($file,'.'); |
|
| 1423 | - if(!$pos) |
|
| 1424 | - $this->Error('Image file has no extension and no type was specified: '.$file);
|
|
| 1425 | - $type = substr($file,$pos+1); |
|
| 1426 | - } |
|
| 1427 | - $type = strtolower($type); |
|
| 1428 | - if($type=='jpeg') |
|
| 1429 | - $type = 'jpg'; |
|
| 1430 | - $mtd = '_parse'.$type; |
|
| 1431 | - if(!method_exists($this,$mtd)) |
|
| 1432 | - $this->Error('Unsupported image type: '.$type);
|
|
| 1433 | - $info = $this->$mtd($file); |
|
| 1434 | - $info['i'] = count($this->images)+1; |
|
| 1435 | - $this->images[$file] = $info; |
|
| 1436 | - } |
|
| 1437 | - else |
|
| 1438 | - $info = $this->images[$file]; |
|
| 1439 | - |
|
| 1440 | - // Automatic width and height calculation if needed |
|
| 1441 | - if($w==0 && $h==0) |
|
| 1442 | - {
|
|
| 1443 | - // Put image at 96 dpi |
|
| 1444 | - $w = -96; |
|
| 1445 | - $h = -96; |
|
| 1446 | - } |
|
| 1447 | - if($w<0) |
|
| 1448 | - $w = -$info['w']*72/$w/$this->k; |
|
| 1449 | - if($h<0) |
|
| 1450 | - $h = -$info['h']*72/$h/$this->k; |
|
| 1451 | - if($w==0) |
|
| 1452 | - $w = $h*$info['w']/$info['h']; |
|
| 1453 | - if($h==0) |
|
| 1454 | - $h = $w*$info['h']/$info['w']; |
|
| 1455 | - |
|
| 1456 | - // Flowing mode |
|
| 1457 | - if($y===null) |
|
| 1458 | - {
|
|
| 1459 | - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
| 1460 | - {
|
|
| 1461 | - // Automatic page break |
|
| 1462 | - $x2 = $this->x; |
|
| 1463 | - $this->addPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation); |
|
| 1464 | - $this->x = $x2; |
|
| 1465 | - } |
|
| 1466 | - $y = $this->y; |
|
| 1467 | - $this->y += $h; |
|
| 1468 | - } |
|
| 1469 | - |
|
| 1470 | - if($x===null) |
|
| 1471 | - $x = $this->x; |
|
| 1472 | - $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
|
|
| 1473 | - if($link) |
|
| 1474 | - $this->Link($x,$y,$w,$h,$link); |
|
| 1414 | + // Put an image on the page |
|
| 1415 | + if($file=='') |
|
| 1416 | + $this->Error('Image file name is empty');
|
|
| 1417 | + if(!isset($this->images[$file])) |
|
| 1418 | + {
|
|
| 1419 | + // First use of this image, get info |
|
| 1420 | + if($type=='') |
|
| 1421 | + {
|
|
| 1422 | + $pos = strrpos($file,'.'); |
|
| 1423 | + if(!$pos) |
|
| 1424 | + $this->Error('Image file has no extension and no type was specified: '.$file);
|
|
| 1425 | + $type = substr($file,$pos+1); |
|
| 1426 | + } |
|
| 1427 | + $type = strtolower($type); |
|
| 1428 | + if($type=='jpeg') |
|
| 1429 | + $type = 'jpg'; |
|
| 1430 | + $mtd = '_parse'.$type; |
|
| 1431 | + if(!method_exists($this,$mtd)) |
|
| 1432 | + $this->Error('Unsupported image type: '.$type);
|
|
| 1433 | + $info = $this->$mtd($file); |
|
| 1434 | + $info['i'] = count($this->images)+1; |
|
| 1435 | + $this->images[$file] = $info; |
|
| 1436 | + } |
|
| 1437 | + else |
|
| 1438 | + $info = $this->images[$file]; |
|
| 1439 | + |
|
| 1440 | + // Automatic width and height calculation if needed |
|
| 1441 | + if($w==0 && $h==0) |
|
| 1442 | + {
|
|
| 1443 | + // Put image at 96 dpi |
|
| 1444 | + $w = -96; |
|
| 1445 | + $h = -96; |
|
| 1446 | + } |
|
| 1447 | + if($w<0) |
|
| 1448 | + $w = -$info['w']*72/$w/$this->k; |
|
| 1449 | + if($h<0) |
|
| 1450 | + $h = -$info['h']*72/$h/$this->k; |
|
| 1451 | + if($w==0) |
|
| 1452 | + $w = $h*$info['w']/$info['h']; |
|
| 1453 | + if($h==0) |
|
| 1454 | + $h = $w*$info['h']/$info['w']; |
|
| 1455 | + |
|
| 1456 | + // Flowing mode |
|
| 1457 | + if($y===null) |
|
| 1458 | + {
|
|
| 1459 | + if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
| 1460 | + {
|
|
| 1461 | + // Automatic page break |
|
| 1462 | + $x2 = $this->x; |
|
| 1463 | + $this->addPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation); |
|
| 1464 | + $this->x = $x2; |
|
| 1465 | + } |
|
| 1466 | + $y = $this->y; |
|
| 1467 | + $this->y += $h; |
|
| 1468 | + } |
|
| 1469 | + |
|
| 1470 | + if($x===null) |
|
| 1471 | + $x = $this->x; |
|
| 1472 | + $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
|
|
| 1473 | + if($link) |
|
| 1474 | + $this->Link($x,$y,$w,$h,$link); |
|
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | 1477 | /** |
@@ -1480,8 +1480,8 @@ discard block |
||
| 1480 | 1480 | */ |
| 1481 | 1481 | public function GetPageWidth() : float |
| 1482 | 1482 | {
|
| 1483 | - // Get current page width |
|
| 1484 | - return $this->w; |
|
| 1483 | + // Get current page width |
|
| 1484 | + return $this->w; |
|
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | 1487 | /** |
@@ -1490,8 +1490,8 @@ discard block |
||
| 1490 | 1490 | */ |
| 1491 | 1491 | public function GetPageHeight() : float |
| 1492 | 1492 | {
|
| 1493 | - // Get current page height |
|
| 1494 | - return $this->h; |
|
| 1493 | + // Get current page height |
|
| 1494 | + return $this->h; |
|
| 1495 | 1495 | } |
| 1496 | 1496 | |
| 1497 | 1497 | /** |
@@ -1500,8 +1500,8 @@ discard block |
||
| 1500 | 1500 | */ |
| 1501 | 1501 | public function GetX() : float |
| 1502 | 1502 | {
|
| 1503 | - // GetX position |
|
| 1504 | - return $this->x; |
|
| 1503 | + // GetX position |
|
| 1504 | + return $this->x; |
|
| 1505 | 1505 | } |
| 1506 | 1506 | |
| 1507 | 1507 | /** |
@@ -1511,11 +1511,11 @@ discard block |
||
| 1511 | 1511 | */ |
| 1512 | 1512 | public function SetX(float $x) : void |
| 1513 | 1513 | {
|
| 1514 | - // Set x position |
|
| 1515 | - if($x>=0) |
|
| 1516 | - $this->x = $x; |
|
| 1517 | - else |
|
| 1518 | - $this->x = $this->w+$x; |
|
| 1514 | + // Set x position |
|
| 1515 | + if($x>=0) |
|
| 1516 | + $this->x = $x; |
|
| 1517 | + else |
|
| 1518 | + $this->x = $this->w+$x; |
|
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | 1521 | /** |
@@ -1524,8 +1524,8 @@ discard block |
||
| 1524 | 1524 | */ |
| 1525 | 1525 | public function GetY() : float |
| 1526 | 1526 | {
|
| 1527 | - // Get y position |
|
| 1528 | - return $this->y; |
|
| 1527 | + // Get y position |
|
| 1528 | + return $this->y; |
|
| 1529 | 1529 | } |
| 1530 | 1530 | |
| 1531 | 1531 | /** |
@@ -1536,13 +1536,13 @@ discard block |
||
| 1536 | 1536 | */ |
| 1537 | 1537 | public function SetY(float $y, bool $resetX=true) : void |
| 1538 | 1538 | {
|
| 1539 | - // Set y position and optionally reset x |
|
| 1540 | - if($y>=0) |
|
| 1541 | - $this->y = $y; |
|
| 1542 | - else |
|
| 1543 | - $this->y = $this->h+$y; |
|
| 1544 | - if($resetX) |
|
| 1545 | - $this->x = $this->lMargin; |
|
| 1539 | + // Set y position and optionally reset x |
|
| 1540 | + if($y>=0) |
|
| 1541 | + $this->y = $y; |
|
| 1542 | + else |
|
| 1543 | + $this->y = $this->h+$y; |
|
| 1544 | + if($resetX) |
|
| 1545 | + $this->x = $this->lMargin; |
|
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | 1548 | /** |
@@ -1553,9 +1553,9 @@ discard block |
||
| 1553 | 1553 | */ |
| 1554 | 1554 | public function SetXY(float $x, float $y) : void |
| 1555 | 1555 | {
|
| 1556 | - // Set x and y positions |
|
| 1557 | - $this->setX($x); |
|
| 1558 | - $this->setY($y,false); |
|
| 1556 | + // Set x and y positions |
|
| 1557 | + $this->setX($x); |
|
| 1558 | + $this->setY($y,false); |
|
| 1559 | 1559 | } |
| 1560 | 1560 | |
| 1561 | 1561 | /** |
@@ -1578,55 +1578,55 @@ discard block |
||
| 1578 | 1578 | */ |
| 1579 | 1579 | public function Output(string $dest='', string $name='', bool $isUTF8=false) : string |
| 1580 | 1580 | {
|
| 1581 | - // Output PDF to some destination |
|
| 1582 | - $this->Close(); |
|
| 1583 | - if(strlen($name)==1 && strlen($dest)!=1) |
|
| 1584 | - {
|
|
| 1585 | - // Fix parameter order |
|
| 1586 | - $tmp = $dest; |
|
| 1587 | - $dest = $name; |
|
| 1588 | - $name = $tmp; |
|
| 1589 | - } |
|
| 1590 | - if($dest=='') |
|
| 1591 | - $dest = 'I'; |
|
| 1592 | - if($name=='') |
|
| 1593 | - $name = 'doc.pdf'; |
|
| 1594 | - switch(strtoupper($dest)) |
|
| 1595 | - {
|
|
| 1596 | - case 'I': |
|
| 1597 | - // Send to standard output |
|
| 1598 | - $this->_checkoutput(); |
|
| 1599 | - if(PHP_SAPI!='cli') |
|
| 1600 | - {
|
|
| 1601 | - // We send to a browser |
|
| 1602 | - header('Content-Type: application/pdf; charset=UTF-8');
|
|
| 1603 | - header('Content-Disposition: inline; '.$this->_httpencode('filename',$name,$isUTF8));
|
|
| 1604 | - header('Cache-Control: private, max-age=0, must-revalidate');
|
|
| 1605 | - header('Pragma: public');
|
|
| 1606 | - } |
|
| 1607 | - echo $this->buffer; |
|
| 1608 | - break; |
|
| 1609 | - case 'D': |
|
| 1610 | - // Download file |
|
| 1611 | - $this->_checkoutput(); |
|
| 1612 | - header('Content-Type: application/x-download');
|
|
| 1613 | - header('Content-Disposition: attachment; '.$this->_httpencode('filename',$name,$isUTF8));
|
|
| 1614 | - header('Cache-Control: private, max-age=0, must-revalidate');
|
|
| 1615 | - header('Pragma: public');
|
|
| 1616 | - echo $this->buffer; |
|
| 1617 | - break; |
|
| 1618 | - case 'F': |
|
| 1619 | - // Save to local file |
|
| 1620 | - if(!file_put_contents($name,$this->buffer)) |
|
| 1621 | - $this->Error('Unable to create output file: '.$name);
|
|
| 1622 | - break; |
|
| 1623 | - case 'S': |
|
| 1624 | - // Return as a string |
|
| 1625 | - return $this->buffer; |
|
| 1626 | - default: |
|
| 1627 | - $this->Error('Incorrect output destination: '.$dest);
|
|
| 1628 | - } |
|
| 1629 | - return ''; |
|
| 1581 | + // Output PDF to some destination |
|
| 1582 | + $this->Close(); |
|
| 1583 | + if(strlen($name)==1 && strlen($dest)!=1) |
|
| 1584 | + {
|
|
| 1585 | + // Fix parameter order |
|
| 1586 | + $tmp = $dest; |
|
| 1587 | + $dest = $name; |
|
| 1588 | + $name = $tmp; |
|
| 1589 | + } |
|
| 1590 | + if($dest=='') |
|
| 1591 | + $dest = 'I'; |
|
| 1592 | + if($name=='') |
|
| 1593 | + $name = 'doc.pdf'; |
|
| 1594 | + switch(strtoupper($dest)) |
|
| 1595 | + {
|
|
| 1596 | + case 'I': |
|
| 1597 | + // Send to standard output |
|
| 1598 | + $this->_checkoutput(); |
|
| 1599 | + if(PHP_SAPI!='cli') |
|
| 1600 | + {
|
|
| 1601 | + // We send to a browser |
|
| 1602 | + header('Content-Type: application/pdf; charset=UTF-8');
|
|
| 1603 | + header('Content-Disposition: inline; '.$this->_httpencode('filename',$name,$isUTF8));
|
|
| 1604 | + header('Cache-Control: private, max-age=0, must-revalidate');
|
|
| 1605 | + header('Pragma: public');
|
|
| 1606 | + } |
|
| 1607 | + echo $this->buffer; |
|
| 1608 | + break; |
|
| 1609 | + case 'D': |
|
| 1610 | + // Download file |
|
| 1611 | + $this->_checkoutput(); |
|
| 1612 | + header('Content-Type: application/x-download');
|
|
| 1613 | + header('Content-Disposition: attachment; '.$this->_httpencode('filename',$name,$isUTF8));
|
|
| 1614 | + header('Cache-Control: private, max-age=0, must-revalidate');
|
|
| 1615 | + header('Pragma: public');
|
|
| 1616 | + echo $this->buffer; |
|
| 1617 | + break; |
|
| 1618 | + case 'F': |
|
| 1619 | + // Save to local file |
|
| 1620 | + if(!file_put_contents($name,$this->buffer)) |
|
| 1621 | + $this->Error('Unable to create output file: '.$name);
|
|
| 1622 | + break; |
|
| 1623 | + case 'S': |
|
| 1624 | + // Return as a string |
|
| 1625 | + return $this->buffer; |
|
| 1626 | + default: |
|
| 1627 | + $this->Error('Incorrect output destination: '.$dest);
|
|
| 1628 | + } |
|
| 1629 | + return ''; |
|
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | 1632 | /** |
@@ -1634,9 +1634,9 @@ discard block |
||
| 1634 | 1634 | */ |
| 1635 | 1635 | protected function _dochecks() : void |
| 1636 | 1636 | {
|
| 1637 | - // Check mbstring overloading |
|
| 1638 | - if(ini_get('mbstring.func_overload') & 2)
|
|
| 1639 | - $this->Error('mbstring overloading must be disabled');
|
|
| 1637 | + // Check mbstring overloading |
|
| 1638 | + if(ini_get('mbstring.func_overload') & 2)
|
|
| 1639 | + $this->Error('mbstring overloading must be disabled');
|
|
| 1640 | 1640 | } |
| 1641 | 1641 | |
| 1642 | 1642 | /** |
@@ -1644,24 +1644,24 @@ discard block |
||
| 1644 | 1644 | */ |
| 1645 | 1645 | protected function _checkoutput() : void |
| 1646 | 1646 | {
|
| 1647 | - if(PHP_SAPI!='cli') |
|
| 1648 | - {
|
|
| 1649 | - $file = ''; |
|
| 1650 | - $line = 0; |
|
| 1651 | - if(headers_sent($file,$line)) |
|
| 1652 | - $this->Error("Some data has already been output, can't send PDF file (output started at $file:$line)");
|
|
| 1653 | - } |
|
| 1654 | - if(ob_get_length()) |
|
| 1655 | - {
|
|
| 1656 | - // The output buffer is not empty |
|
| 1657 | - if(preg_match('/^(\xEF\xBB\xBF)?\s*$/',ob_get_contents()))
|
|
| 1658 | - {
|
|
| 1659 | - // It contains only a UTF-8 BOM and/or whitespace, let's clean it |
|
| 1660 | - ob_clean(); |
|
| 1661 | - } |
|
| 1662 | - else |
|
| 1663 | - $this->Error("Some data has already been output, can't send PDF file");
|
|
| 1664 | - } |
|
| 1647 | + if(PHP_SAPI!='cli') |
|
| 1648 | + {
|
|
| 1649 | + $file = ''; |
|
| 1650 | + $line = 0; |
|
| 1651 | + if(headers_sent($file,$line)) |
|
| 1652 | + $this->Error("Some data has already been output, can't send PDF file (output started at $file:$line)");
|
|
| 1653 | + } |
|
| 1654 | + if(ob_get_length()) |
|
| 1655 | + {
|
|
| 1656 | + // The output buffer is not empty |
|
| 1657 | + if(preg_match('/^(\xEF\xBB\xBF)?\s*$/',ob_get_contents()))
|
|
| 1658 | + {
|
|
| 1659 | + // It contains only a UTF-8 BOM and/or whitespace, let's clean it |
|
| 1660 | + ob_clean(); |
|
| 1661 | + } |
|
| 1662 | + else |
|
| 1663 | + $this->Error("Some data has already been output, can't send PDF file");
|
|
| 1664 | + } |
|
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | /** |
@@ -1671,21 +1671,21 @@ discard block |
||
| 1671 | 1671 | */ |
| 1672 | 1672 | protected function _getpagesize($size) : array |
| 1673 | 1673 | {
|
| 1674 | - if(is_string($size)) |
|
| 1675 | - {
|
|
| 1676 | - $size = strtolower($size); |
|
| 1677 | - if(!isset($this->StdPageSizes[$size])) |
|
| 1678 | - $this->Error('Unknown page size: '.$size);
|
|
| 1679 | - $a = $this->StdPageSizes[$size]; |
|
| 1680 | - return array($a[0]/$this->k, $a[1]/$this->k); |
|
| 1681 | - } |
|
| 1682 | - else |
|
| 1683 | - {
|
|
| 1684 | - if($size[0]>$size[1]) |
|
| 1685 | - return array($size[1], $size[0]); |
|
| 1686 | - else |
|
| 1687 | - return $size; |
|
| 1688 | - } |
|
| 1674 | + if(is_string($size)) |
|
| 1675 | + {
|
|
| 1676 | + $size = strtolower($size); |
|
| 1677 | + if(!isset($this->StdPageSizes[$size])) |
|
| 1678 | + $this->Error('Unknown page size: '.$size);
|
|
| 1679 | + $a = $this->StdPageSizes[$size]; |
|
| 1680 | + return array($a[0]/$this->k, $a[1]/$this->k); |
|
| 1681 | + } |
|
| 1682 | + else |
|
| 1683 | + {
|
|
| 1684 | + if($size[0]>$size[1]) |
|
| 1685 | + return array($size[1], $size[0]); |
|
| 1686 | + else |
|
| 1687 | + return $size; |
|
| 1688 | + } |
|
| 1689 | 1689 | } |
| 1690 | 1690 | |
| 1691 | 1691 | /** |
@@ -1696,49 +1696,49 @@ discard block |
||
| 1696 | 1696 | */ |
| 1697 | 1697 | protected function _beginpage(string $orientation, $size, int $rotation) : void |
| 1698 | 1698 | {
|
| 1699 | - $this->page++; |
|
| 1700 | - $this->pages[$this->page] = ''; |
|
| 1701 | - $this->state = 2; |
|
| 1702 | - $this->x = $this->lMargin; |
|
| 1703 | - $this->y = $this->tMargin; |
|
| 1704 | - $this->FontFamily = ''; |
|
| 1705 | - // Check page size and orientation |
|
| 1706 | - if($orientation=='') |
|
| 1707 | - $orientation = $this->DefOrientation; |
|
| 1708 | - else |
|
| 1709 | - $orientation = strtoupper($orientation[0]); |
|
| 1710 | - if($size=='') |
|
| 1711 | - $size = $this->DefPageSize; |
|
| 1712 | - else |
|
| 1713 | - $size = $this->_getpagesize($size); |
|
| 1714 | - if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) |
|
| 1715 | - {
|
|
| 1716 | - // New size or orientation |
|
| 1717 | - if($orientation=='P') |
|
| 1718 | - {
|
|
| 1719 | - $this->w = $size[0]; |
|
| 1720 | - $this->h = $size[1]; |
|
| 1721 | - } |
|
| 1722 | - else |
|
| 1723 | - {
|
|
| 1724 | - $this->w = $size[1]; |
|
| 1725 | - $this->h = $size[0]; |
|
| 1726 | - } |
|
| 1727 | - $this->wPt = $this->w*$this->k; |
|
| 1728 | - $this->hPt = $this->h*$this->k; |
|
| 1729 | - $this->PageBreakTrigger = $this->h-$this->bMargin; |
|
| 1730 | - $this->CurOrientation = $orientation; |
|
| 1731 | - $this->CurPageSize = $size; |
|
| 1732 | - } |
|
| 1733 | - if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) |
|
| 1734 | - $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt); |
|
| 1735 | - if($rotation!=0) |
|
| 1736 | - {
|
|
| 1737 | - if($rotation%90!=0) |
|
| 1738 | - $this->Error('Incorrect rotation value: '.$rotation);
|
|
| 1739 | - $this->CurRotation = $rotation; |
|
| 1740 | - $this->PageInfo[$this->page]['rotation'] = $rotation; |
|
| 1741 | - } |
|
| 1699 | + $this->page++; |
|
| 1700 | + $this->pages[$this->page] = ''; |
|
| 1701 | + $this->state = 2; |
|
| 1702 | + $this->x = $this->lMargin; |
|
| 1703 | + $this->y = $this->tMargin; |
|
| 1704 | + $this->FontFamily = ''; |
|
| 1705 | + // Check page size and orientation |
|
| 1706 | + if($orientation=='') |
|
| 1707 | + $orientation = $this->DefOrientation; |
|
| 1708 | + else |
|
| 1709 | + $orientation = strtoupper($orientation[0]); |
|
| 1710 | + if($size=='') |
|
| 1711 | + $size = $this->DefPageSize; |
|
| 1712 | + else |
|
| 1713 | + $size = $this->_getpagesize($size); |
|
| 1714 | + if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) |
|
| 1715 | + {
|
|
| 1716 | + // New size or orientation |
|
| 1717 | + if($orientation=='P') |
|
| 1718 | + {
|
|
| 1719 | + $this->w = $size[0]; |
|
| 1720 | + $this->h = $size[1]; |
|
| 1721 | + } |
|
| 1722 | + else |
|
| 1723 | + {
|
|
| 1724 | + $this->w = $size[1]; |
|
| 1725 | + $this->h = $size[0]; |
|
| 1726 | + } |
|
| 1727 | + $this->wPt = $this->w*$this->k; |
|
| 1728 | + $this->hPt = $this->h*$this->k; |
|
| 1729 | + $this->PageBreakTrigger = $this->h-$this->bMargin; |
|
| 1730 | + $this->CurOrientation = $orientation; |
|
| 1731 | + $this->CurPageSize = $size; |
|
| 1732 | + } |
|
| 1733 | + if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) |
|
| 1734 | + $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt); |
|
| 1735 | + if($rotation!=0) |
|
| 1736 | + {
|
|
| 1737 | + if($rotation%90!=0) |
|
| 1738 | + $this->Error('Incorrect rotation value: '.$rotation);
|
|
| 1739 | + $this->CurRotation = $rotation; |
|
| 1740 | + $this->PageInfo[$this->page]['rotation'] = $rotation; |
|
| 1741 | + } |
|
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | 1744 | /** |
@@ -1746,7 +1746,7 @@ discard block |
||
| 1746 | 1746 | */ |
| 1747 | 1747 | protected function _endpage() : void |
| 1748 | 1748 | {
|
| 1749 | - $this->state = 1; |
|
| 1749 | + $this->state = 1; |
|
| 1750 | 1750 | } |
| 1751 | 1751 | |
| 1752 | 1752 | /** |
@@ -1756,27 +1756,27 @@ discard block |
||
| 1756 | 1756 | */ |
| 1757 | 1757 | protected function _loadfont(string $font) : array |
| 1758 | 1758 | {
|
| 1759 | - // Load a font definition file from the font directory |
|
| 1759 | + // Load a font definition file from the font directory |
|
| 1760 | 1760 | if(strpos($font,'/')!==false || strpos($font,"\\")!==false) {
|
| 1761 | - $this->Error('Incorrect font definition file name: '.$font);
|
|
| 1761 | + $this->Error('Incorrect font definition file name: '.$font);
|
|
| 1762 | 1762 | } |
| 1763 | 1763 | // following vars must be initialized in the font definition file beeing included |
| 1764 | - $name = null; |
|
| 1765 | - $enc = null; |
|
| 1766 | - $subsetted = null; |
|
| 1767 | - include($this->fontpath.$font); |
|
| 1764 | + $name = null; |
|
| 1765 | + $enc = null; |
|
| 1766 | + $subsetted = null; |
|
| 1767 | + include($this->fontpath.$font); |
|
| 1768 | 1768 | |
| 1769 | - // phpstan can't see the code dynamicly included before so assuming $name, $enc, $subsetted always set to null! |
|
| 1770 | - if(!isset($name)) { /* @phpstan-ignore-line */
|
|
| 1771 | - $this->Error('Could not include font definition file');
|
|
| 1772 | - } |
|
| 1773 | - if(isset($enc)) { /* @phpstan-ignore-line */
|
|
| 1774 | - $enc = strtolower($enc); |
|
| 1775 | - } |
|
| 1776 | - if(!isset($subsetted)) { /* @phpstan-ignore-line */
|
|
| 1777 | - $subsetted = false; |
|
| 1778 | - } |
|
| 1779 | - return get_defined_vars(); |
|
| 1769 | + // phpstan can't see the code dynamicly included before so assuming $name, $enc, $subsetted always set to null! |
|
| 1770 | + if(!isset($name)) { /* @phpstan-ignore-line */
|
|
| 1771 | + $this->Error('Could not include font definition file');
|
|
| 1772 | + } |
|
| 1773 | + if(isset($enc)) { /* @phpstan-ignore-line */
|
|
| 1774 | + $enc = strtolower($enc); |
|
| 1775 | + } |
|
| 1776 | + if(!isset($subsetted)) { /* @phpstan-ignore-line */
|
|
| 1777 | + $subsetted = false; |
|
| 1778 | + } |
|
| 1779 | + return get_defined_vars(); |
|
| 1780 | 1780 | } |
| 1781 | 1781 | |
| 1782 | 1782 | /** |
@@ -1786,14 +1786,14 @@ discard block |
||
| 1786 | 1786 | */ |
| 1787 | 1787 | protected function _isascii(string $s) : bool |
| 1788 | 1788 | {
|
| 1789 | - // Test if string is ASCII |
|
| 1790 | - $nb = strlen($s); |
|
| 1791 | - for($i=0;$i<$nb;$i++) |
|
| 1792 | - {
|
|
| 1793 | - if(ord($s[$i])>127) |
|
| 1794 | - return false; |
|
| 1795 | - } |
|
| 1796 | - return true; |
|
| 1789 | + // Test if string is ASCII |
|
| 1790 | + $nb = strlen($s); |
|
| 1791 | + for($i=0;$i<$nb;$i++) |
|
| 1792 | + {
|
|
| 1793 | + if(ord($s[$i])>127) |
|
| 1794 | + return false; |
|
| 1795 | + } |
|
| 1796 | + return true; |
|
| 1797 | 1797 | } |
| 1798 | 1798 | |
| 1799 | 1799 | /** |
@@ -1804,15 +1804,15 @@ discard block |
||
| 1804 | 1804 | */ |
| 1805 | 1805 | protected function _httpencode(string $param, string $value, bool $isUTF8) : string |
| 1806 | 1806 | {
|
| 1807 | - // Encode HTTP header field parameter |
|
| 1808 | - if($this->_isascii($value)) |
|
| 1809 | - return $param.'="'.$value.'"'; |
|
| 1810 | - if(!$isUTF8) |
|
| 1811 | - $value = utf8_encode($value); |
|
| 1812 | - if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')!==false) |
|
| 1813 | - return $param.'="'.rawurlencode($value).'"'; |
|
| 1814 | - else |
|
| 1815 | - return $param."*=UTF-8''".rawurlencode($value); |
|
| 1807 | + // Encode HTTP header field parameter |
|
| 1808 | + if($this->_isascii($value)) |
|
| 1809 | + return $param.'="'.$value.'"'; |
|
| 1810 | + if(!$isUTF8) |
|
| 1811 | + $value = utf8_encode($value); |
|
| 1812 | + if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')!==false) |
|
| 1813 | + return $param.'="'.rawurlencode($value).'"'; |
|
| 1814 | + else |
|
| 1815 | + return $param."*=UTF-8''".rawurlencode($value); |
|
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | 1818 | /** |
@@ -1822,35 +1822,35 @@ discard block |
||
| 1822 | 1822 | */ |
| 1823 | 1823 | protected function _UTF8toUTF16(string $s) : string |
| 1824 | 1824 | {
|
| 1825 | - // Convert UTF-8 to UTF-16BE with BOM |
|
| 1826 | - $res = "\xFE\xFF"; |
|
| 1827 | - $nb = strlen($s); |
|
| 1828 | - $i = 0; |
|
| 1829 | - while($i<$nb) |
|
| 1830 | - {
|
|
| 1831 | - $c1 = ord($s[$i++]); |
|
| 1832 | - if($c1>=224) |
|
| 1833 | - {
|
|
| 1834 | - // 3-byte character |
|
| 1835 | - $c2 = ord($s[$i++]); |
|
| 1836 | - $c3 = ord($s[$i++]); |
|
| 1837 | - $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); |
|
| 1838 | - $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); |
|
| 1839 | - } |
|
| 1840 | - elseif($c1>=192) |
|
| 1841 | - {
|
|
| 1842 | - // 2-byte character |
|
| 1843 | - $c2 = ord($s[$i++]); |
|
| 1844 | - $res .= chr(($c1 & 0x1C)>>2); |
|
| 1845 | - $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); |
|
| 1846 | - } |
|
| 1847 | - else |
|
| 1848 | - {
|
|
| 1849 | - // Single-byte character |
|
| 1850 | - $res .= "\0".chr($c1); |
|
| 1851 | - } |
|
| 1852 | - } |
|
| 1853 | - return $res; |
|
| 1825 | + // Convert UTF-8 to UTF-16BE with BOM |
|
| 1826 | + $res = "\xFE\xFF"; |
|
| 1827 | + $nb = strlen($s); |
|
| 1828 | + $i = 0; |
|
| 1829 | + while($i<$nb) |
|
| 1830 | + {
|
|
| 1831 | + $c1 = ord($s[$i++]); |
|
| 1832 | + if($c1>=224) |
|
| 1833 | + {
|
|
| 1834 | + // 3-byte character |
|
| 1835 | + $c2 = ord($s[$i++]); |
|
| 1836 | + $c3 = ord($s[$i++]); |
|
| 1837 | + $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); |
|
| 1838 | + $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); |
|
| 1839 | + } |
|
| 1840 | + elseif($c1>=192) |
|
| 1841 | + {
|
|
| 1842 | + // 2-byte character |
|
| 1843 | + $c2 = ord($s[$i++]); |
|
| 1844 | + $res .= chr(($c1 & 0x1C)>>2); |
|
| 1845 | + $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); |
|
| 1846 | + } |
|
| 1847 | + else |
|
| 1848 | + {
|
|
| 1849 | + // Single-byte character |
|
| 1850 | + $res .= "\0".chr($c1); |
|
| 1851 | + } |
|
| 1852 | + } |
|
| 1853 | + return $res; |
|
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | /** |
@@ -1860,11 +1860,11 @@ discard block |
||
| 1860 | 1860 | */ |
| 1861 | 1861 | protected function _escape(string $s) : string |
| 1862 | 1862 | {
|
| 1863 | - // Escape special characters |
|
| 1864 | - if(strpos($s,'(')!==false || strpos($s,')')!==false || strpos($s,'\\')!==false || strpos($s,"\r")!==false)
|
|
| 1865 | - return str_replace(array('\\','(',')',"\r"), array('\\\\','\\(','\\)','\\r'), $s);
|
|
| 1866 | - else |
|
| 1867 | - return $s; |
|
| 1863 | + // Escape special characters |
|
| 1864 | + if(strpos($s,'(')!==false || strpos($s,')')!==false || strpos($s,'\\')!==false || strpos($s,"\r")!==false)
|
|
| 1865 | + return str_replace(array('\\','(',')',"\r"), array('\\\\','\\(','\\)','\\r'), $s);
|
|
| 1866 | + else |
|
| 1867 | + return $s; |
|
| 1868 | 1868 | } |
| 1869 | 1869 | |
| 1870 | 1870 | /** |
@@ -1874,10 +1874,10 @@ discard block |
||
| 1874 | 1874 | */ |
| 1875 | 1875 | protected function _textstring(string $s) : string |
| 1876 | 1876 | {
|
| 1877 | - // Format a text string |
|
| 1878 | - if(!$this->_isascii($s)) |
|
| 1879 | - $s = $this->_UTF8toUTF16($s); |
|
| 1880 | - return '('.$this->_escape($s).')';
|
|
| 1877 | + // Format a text string |
|
| 1878 | + if(!$this->_isascii($s)) |
|
| 1879 | + $s = $this->_UTF8toUTF16($s); |
|
| 1880 | + return '('.$this->_escape($s).')';
|
|
| 1881 | 1881 | } |
| 1882 | 1882 | |
| 1883 | 1883 | /** |
@@ -1889,11 +1889,11 @@ discard block |
||
| 1889 | 1889 | */ |
| 1890 | 1890 | protected function _dounderline(float $x, float $y, string $txt) : string |
| 1891 | 1891 | {
|
| 1892 | - // Underline text |
|
| 1893 | - $up = $this->CurrentFont['up']; |
|
| 1894 | - $ut = $this->CurrentFont['ut']; |
|
| 1895 | - $w = $this->getStringWidth($txt)+$this->ws*substr_count($txt,' '); |
|
| 1896 | - return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
|
|
| 1892 | + // Underline text |
|
| 1893 | + $up = $this->CurrentFont['up']; |
|
| 1894 | + $ut = $this->CurrentFont['ut']; |
|
| 1895 | + $w = $this->getStringWidth($txt)+$this->ws*substr_count($txt,' '); |
|
| 1896 | + return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
|
|
| 1897 | 1897 | } |
| 1898 | 1898 | |
| 1899 | 1899 | /** |
@@ -1903,21 +1903,21 @@ discard block |
||
| 1903 | 1903 | */ |
| 1904 | 1904 | protected function _parsejpg(string $file) : array |
| 1905 | 1905 | {
|
| 1906 | - // Extract info from a JPEG file |
|
| 1907 | - $a = getimagesize($file); |
|
| 1908 | - if(!$a) |
|
| 1909 | - $this->Error('Missing or incorrect image file: '.$file);
|
|
| 1910 | - if($a[2]!=2) |
|
| 1911 | - $this->Error('Not a JPEG file: '.$file);
|
|
| 1912 | - if(!isset($a['channels']) || $a['channels']==3) |
|
| 1913 | - $colspace = 'DeviceRGB'; |
|
| 1914 | - elseif($a['channels']==4) |
|
| 1915 | - $colspace = 'DeviceCMYK'; |
|
| 1916 | - else |
|
| 1917 | - $colspace = 'DeviceGray'; |
|
| 1918 | - $bpc = isset($a['bits']) ? $a['bits'] : 8; |
|
| 1919 | - $data = file_get_contents($file); |
|
| 1920 | - return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data);
|
|
| 1906 | + // Extract info from a JPEG file |
|
| 1907 | + $a = getimagesize($file); |
|
| 1908 | + if(!$a) |
|
| 1909 | + $this->Error('Missing or incorrect image file: '.$file);
|
|
| 1910 | + if($a[2]!=2) |
|
| 1911 | + $this->Error('Not a JPEG file: '.$file);
|
|
| 1912 | + if(!isset($a['channels']) || $a['channels']==3) |
|
| 1913 | + $colspace = 'DeviceRGB'; |
|
| 1914 | + elseif($a['channels']==4) |
|
| 1915 | + $colspace = 'DeviceCMYK'; |
|
| 1916 | + else |
|
| 1917 | + $colspace = 'DeviceGray'; |
|
| 1918 | + $bpc = isset($a['bits']) ? $a['bits'] : 8; |
|
| 1919 | + $data = file_get_contents($file); |
|
| 1920 | + return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data);
|
|
| 1921 | 1921 | } |
| 1922 | 1922 | |
| 1923 | 1923 | /** |
@@ -1927,13 +1927,13 @@ discard block |
||
| 1927 | 1927 | */ |
| 1928 | 1928 | protected function _parsepng(string $file) : array |
| 1929 | 1929 | {
|
| 1930 | - // Extract info from a PNG file |
|
| 1931 | - $f = fopen($file,'rb'); |
|
| 1932 | - if(!$f) |
|
| 1933 | - $this->Error('Can\'t open image file: '.$file);
|
|
| 1934 | - $info = $this->_parsepngstream($f,$file); |
|
| 1935 | - fclose($f); |
|
| 1936 | - return $info; |
|
| 1930 | + // Extract info from a PNG file |
|
| 1931 | + $f = fopen($file,'rb'); |
|
| 1932 | + if(!$f) |
|
| 1933 | + $this->Error('Can\'t open image file: '.$file);
|
|
| 1934 | + $info = $this->_parsepngstream($f,$file); |
|
| 1935 | + fclose($f); |
|
| 1936 | + return $info; |
|
| 1937 | 1937 | } |
| 1938 | 1938 | |
| 1939 | 1939 | /** |
@@ -1944,129 +1944,129 @@ discard block |
||
| 1944 | 1944 | */ |
| 1945 | 1945 | protected function _parsepngstream($f, string $file) : array |
| 1946 | 1946 | {
|
| 1947 | - // Check signature |
|
| 1948 | - if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) |
|
| 1949 | - $this->Error('Not a PNG file: '.$file);
|
|
| 1950 | - |
|
| 1951 | - // Read header chunk |
|
| 1952 | - $this->_readstream($f,4); |
|
| 1953 | - if($this->_readstream($f,4)!='IHDR') |
|
| 1954 | - $this->Error('Incorrect PNG file: '.$file);
|
|
| 1955 | - $w = $this->_readint($f); |
|
| 1956 | - $h = $this->_readint($f); |
|
| 1957 | - $bpc = ord($this->_readstream($f,1)); |
|
| 1958 | - if($bpc>8) |
|
| 1959 | - $this->Error('16-bit depth not supported: '.$file);
|
|
| 1960 | - $ct = ord($this->_readstream($f,1)); |
|
| 1961 | - $colspace = ''; |
|
| 1962 | - if($ct==0 || $ct==4) |
|
| 1963 | - $colspace = 'DeviceGray'; |
|
| 1964 | - elseif($ct==2 || $ct==6) |
|
| 1965 | - $colspace = 'DeviceRGB'; |
|
| 1966 | - elseif($ct==3) |
|
| 1967 | - $colspace = 'Indexed'; |
|
| 1968 | - else |
|
| 1969 | - $this->Error('Unknown color type: '.$file);
|
|
| 1970 | - if(ord($this->_readstream($f,1))!=0) |
|
| 1971 | - $this->Error('Unknown compression method: '.$file);
|
|
| 1972 | - if(ord($this->_readstream($f,1))!=0) |
|
| 1973 | - $this->Error('Unknown filter method: '.$file);
|
|
| 1974 | - if(ord($this->_readstream($f,1))!=0) |
|
| 1975 | - $this->Error('Interlacing not supported: '.$file);
|
|
| 1976 | - $this->_readstream($f,4); |
|
| 1977 | - $dp = '/Predictor 15 /Colors '.($colspace=='DeviceRGB' ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w; |
|
| 1978 | - |
|
| 1979 | - // Scan chunks looking for palette, transparency and image data |
|
| 1980 | - $pal = ''; |
|
| 1981 | - $trns = ''; |
|
| 1982 | - $data = ''; |
|
| 1983 | - do |
|
| 1984 | - {
|
|
| 1985 | - $n = $this->_readint($f); |
|
| 1986 | - $type = $this->_readstream($f,4); |
|
| 1987 | - if($type=='PLTE') |
|
| 1988 | - {
|
|
| 1989 | - // Read palette |
|
| 1990 | - $pal = $this->_readstream($f,$n); |
|
| 1991 | - $this->_readstream($f,4); |
|
| 1992 | - } |
|
| 1993 | - elseif($type=='tRNS') |
|
| 1994 | - {
|
|
| 1995 | - // Read transparency info |
|
| 1996 | - $t = $this->_readstream($f,$n); |
|
| 1997 | - if($ct==0) |
|
| 1998 | - $trns = array(ord(substr($t,1,1))); |
|
| 1999 | - elseif($ct==2) |
|
| 2000 | - $trns = array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); |
|
| 2001 | - else |
|
| 2002 | - {
|
|
| 2003 | - $pos = strpos($t,chr(0)); |
|
| 2004 | - if($pos!==false) |
|
| 2005 | - $trns = array($pos); |
|
| 2006 | - } |
|
| 2007 | - $this->_readstream($f,4); |
|
| 2008 | - } |
|
| 2009 | - elseif($type=='IDAT') |
|
| 2010 | - {
|
|
| 2011 | - // Read image data block |
|
| 2012 | - $data .= $this->_readstream($f,$n); |
|
| 2013 | - $this->_readstream($f,4); |
|
| 2014 | - } |
|
| 2015 | - elseif($type=='IEND') |
|
| 2016 | - break; |
|
| 2017 | - else |
|
| 2018 | - $this->_readstream($f,$n+4); |
|
| 2019 | - } |
|
| 2020 | - while($n); |
|
| 2021 | - |
|
| 2022 | - if($colspace=='Indexed' && empty($pal)) |
|
| 2023 | - $this->Error('Missing palette in '.$file);
|
|
| 2024 | - $info = array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'dp'=>$dp, 'pal'=>$pal, 'trns'=>$trns);
|
|
| 2025 | - if($ct>=4) |
|
| 2026 | - {
|
|
| 2027 | - // Extract alpha channel |
|
| 2028 | - if(!function_exists('gzuncompress'))
|
|
| 2029 | - $this->Error('Zlib not available, can\'t handle alpha channel: '.$file);
|
|
| 2030 | - $data = gzuncompress($data); |
|
| 2031 | - $color = ''; |
|
| 2032 | - $alpha = ''; |
|
| 2033 | - if($ct==4) |
|
| 2034 | - {
|
|
| 2035 | - // Gray image |
|
| 2036 | - $len = 2*$w; |
|
| 2037 | - for($i=0;$i<$h;$i++) |
|
| 2038 | - {
|
|
| 2039 | - $pos = (1+$len)*$i; |
|
| 2040 | - $color .= $data[$pos]; |
|
| 2041 | - $alpha .= $data[$pos]; |
|
| 2042 | - $line = substr($data,$pos+1,$len); |
|
| 2043 | - $color .= preg_replace('/(.)./s','$1',$line);
|
|
| 2044 | - $alpha .= preg_replace('/.(.)/s','$1',$line);
|
|
| 2045 | - } |
|
| 2046 | - } |
|
| 2047 | - else |
|
| 2048 | - {
|
|
| 2049 | - // RGB image |
|
| 2050 | - $len = 4*$w; |
|
| 2051 | - for($i=0;$i<$h;$i++) |
|
| 2052 | - {
|
|
| 2053 | - $pos = (1+$len)*$i; |
|
| 2054 | - $color .= $data[$pos]; |
|
| 2055 | - $alpha .= $data[$pos]; |
|
| 2056 | - $line = substr($data,$pos+1,$len); |
|
| 2057 | - $color .= preg_replace('/(.{3})./s','$1',$line);
|
|
| 2058 | - $alpha .= preg_replace('/.{3}(.)/s','$1',$line);
|
|
| 2059 | - } |
|
| 2060 | - } |
|
| 2061 | - unset($data); |
|
| 2062 | - $data = gzcompress($color); |
|
| 2063 | - $info['smask'] = gzcompress($alpha); |
|
| 2064 | - $this->WithAlpha = true; |
|
| 2065 | - if($this->PDFVersion<'1.4') |
|
| 2066 | - $this->PDFVersion = '1.4'; |
|
| 2067 | - } |
|
| 2068 | - $info['data'] = $data; |
|
| 2069 | - return $info; |
|
| 1947 | + // Check signature |
|
| 1948 | + if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) |
|
| 1949 | + $this->Error('Not a PNG file: '.$file);
|
|
| 1950 | + |
|
| 1951 | + // Read header chunk |
|
| 1952 | + $this->_readstream($f,4); |
|
| 1953 | + if($this->_readstream($f,4)!='IHDR') |
|
| 1954 | + $this->Error('Incorrect PNG file: '.$file);
|
|
| 1955 | + $w = $this->_readint($f); |
|
| 1956 | + $h = $this->_readint($f); |
|
| 1957 | + $bpc = ord($this->_readstream($f,1)); |
|
| 1958 | + if($bpc>8) |
|
| 1959 | + $this->Error('16-bit depth not supported: '.$file);
|
|
| 1960 | + $ct = ord($this->_readstream($f,1)); |
|
| 1961 | + $colspace = ''; |
|
| 1962 | + if($ct==0 || $ct==4) |
|
| 1963 | + $colspace = 'DeviceGray'; |
|
| 1964 | + elseif($ct==2 || $ct==6) |
|
| 1965 | + $colspace = 'DeviceRGB'; |
|
| 1966 | + elseif($ct==3) |
|
| 1967 | + $colspace = 'Indexed'; |
|
| 1968 | + else |
|
| 1969 | + $this->Error('Unknown color type: '.$file);
|
|
| 1970 | + if(ord($this->_readstream($f,1))!=0) |
|
| 1971 | + $this->Error('Unknown compression method: '.$file);
|
|
| 1972 | + if(ord($this->_readstream($f,1))!=0) |
|
| 1973 | + $this->Error('Unknown filter method: '.$file);
|
|
| 1974 | + if(ord($this->_readstream($f,1))!=0) |
|
| 1975 | + $this->Error('Interlacing not supported: '.$file);
|
|
| 1976 | + $this->_readstream($f,4); |
|
| 1977 | + $dp = '/Predictor 15 /Colors '.($colspace=='DeviceRGB' ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w; |
|
| 1978 | + |
|
| 1979 | + // Scan chunks looking for palette, transparency and image data |
|
| 1980 | + $pal = ''; |
|
| 1981 | + $trns = ''; |
|
| 1982 | + $data = ''; |
|
| 1983 | + do |
|
| 1984 | + {
|
|
| 1985 | + $n = $this->_readint($f); |
|
| 1986 | + $type = $this->_readstream($f,4); |
|
| 1987 | + if($type=='PLTE') |
|
| 1988 | + {
|
|
| 1989 | + // Read palette |
|
| 1990 | + $pal = $this->_readstream($f,$n); |
|
| 1991 | + $this->_readstream($f,4); |
|
| 1992 | + } |
|
| 1993 | + elseif($type=='tRNS') |
|
| 1994 | + {
|
|
| 1995 | + // Read transparency info |
|
| 1996 | + $t = $this->_readstream($f,$n); |
|
| 1997 | + if($ct==0) |
|
| 1998 | + $trns = array(ord(substr($t,1,1))); |
|
| 1999 | + elseif($ct==2) |
|
| 2000 | + $trns = array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); |
|
| 2001 | + else |
|
| 2002 | + {
|
|
| 2003 | + $pos = strpos($t,chr(0)); |
|
| 2004 | + if($pos!==false) |
|
| 2005 | + $trns = array($pos); |
|
| 2006 | + } |
|
| 2007 | + $this->_readstream($f,4); |
|
| 2008 | + } |
|
| 2009 | + elseif($type=='IDAT') |
|
| 2010 | + {
|
|
| 2011 | + // Read image data block |
|
| 2012 | + $data .= $this->_readstream($f,$n); |
|
| 2013 | + $this->_readstream($f,4); |
|
| 2014 | + } |
|
| 2015 | + elseif($type=='IEND') |
|
| 2016 | + break; |
|
| 2017 | + else |
|
| 2018 | + $this->_readstream($f,$n+4); |
|
| 2019 | + } |
|
| 2020 | + while($n); |
|
| 2021 | + |
|
| 2022 | + if($colspace=='Indexed' && empty($pal)) |
|
| 2023 | + $this->Error('Missing palette in '.$file);
|
|
| 2024 | + $info = array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'dp'=>$dp, 'pal'=>$pal, 'trns'=>$trns);
|
|
| 2025 | + if($ct>=4) |
|
| 2026 | + {
|
|
| 2027 | + // Extract alpha channel |
|
| 2028 | + if(!function_exists('gzuncompress'))
|
|
| 2029 | + $this->Error('Zlib not available, can\'t handle alpha channel: '.$file);
|
|
| 2030 | + $data = gzuncompress($data); |
|
| 2031 | + $color = ''; |
|
| 2032 | + $alpha = ''; |
|
| 2033 | + if($ct==4) |
|
| 2034 | + {
|
|
| 2035 | + // Gray image |
|
| 2036 | + $len = 2*$w; |
|
| 2037 | + for($i=0;$i<$h;$i++) |
|
| 2038 | + {
|
|
| 2039 | + $pos = (1+$len)*$i; |
|
| 2040 | + $color .= $data[$pos]; |
|
| 2041 | + $alpha .= $data[$pos]; |
|
| 2042 | + $line = substr($data,$pos+1,$len); |
|
| 2043 | + $color .= preg_replace('/(.)./s','$1',$line);
|
|
| 2044 | + $alpha .= preg_replace('/.(.)/s','$1',$line);
|
|
| 2045 | + } |
|
| 2046 | + } |
|
| 2047 | + else |
|
| 2048 | + {
|
|
| 2049 | + // RGB image |
|
| 2050 | + $len = 4*$w; |
|
| 2051 | + for($i=0;$i<$h;$i++) |
|
| 2052 | + {
|
|
| 2053 | + $pos = (1+$len)*$i; |
|
| 2054 | + $color .= $data[$pos]; |
|
| 2055 | + $alpha .= $data[$pos]; |
|
| 2056 | + $line = substr($data,$pos+1,$len); |
|
| 2057 | + $color .= preg_replace('/(.{3})./s','$1',$line);
|
|
| 2058 | + $alpha .= preg_replace('/.{3}(.)/s','$1',$line);
|
|
| 2059 | + } |
|
| 2060 | + } |
|
| 2061 | + unset($data); |
|
| 2062 | + $data = gzcompress($color); |
|
| 2063 | + $info['smask'] = gzcompress($alpha); |
|
| 2064 | + $this->WithAlpha = true; |
|
| 2065 | + if($this->PDFVersion<'1.4') |
|
| 2066 | + $this->PDFVersion = '1.4'; |
|
| 2067 | + } |
|
| 2068 | + $info['data'] = $data; |
|
| 2069 | + return $info; |
|
| 2070 | 2070 | } |
| 2071 | 2071 | |
| 2072 | 2072 | /** |
@@ -2077,19 +2077,19 @@ discard block |
||
| 2077 | 2077 | */ |
| 2078 | 2078 | protected function _readstream($f, int $n) : string |
| 2079 | 2079 | {
|
| 2080 | - // Read n bytes from stream |
|
| 2081 | - $res = ''; |
|
| 2082 | - while($n>0 && !feof($f)) |
|
| 2083 | - {
|
|
| 2084 | - $s = fread($f,$n); |
|
| 2085 | - if($s===false) |
|
| 2086 | - $this->Error('Error while reading stream');
|
|
| 2087 | - $n -= strlen($s); |
|
| 2088 | - $res .= $s; |
|
| 2089 | - } |
|
| 2090 | - if($n>0) |
|
| 2091 | - $this->Error('Unexpected end of stream');
|
|
| 2092 | - return $res; |
|
| 2080 | + // Read n bytes from stream |
|
| 2081 | + $res = ''; |
|
| 2082 | + while($n>0 && !feof($f)) |
|
| 2083 | + {
|
|
| 2084 | + $s = fread($f,$n); |
|
| 2085 | + if($s===false) |
|
| 2086 | + $this->Error('Error while reading stream');
|
|
| 2087 | + $n -= strlen($s); |
|
| 2088 | + $res .= $s; |
|
| 2089 | + } |
|
| 2090 | + if($n>0) |
|
| 2091 | + $this->Error('Unexpected end of stream');
|
|
| 2092 | + return $res; |
|
| 2093 | 2093 | } |
| 2094 | 2094 | |
| 2095 | 2095 | /** |
@@ -2099,9 +2099,9 @@ discard block |
||
| 2099 | 2099 | */ |
| 2100 | 2100 | protected function _readint($f) : int |
| 2101 | 2101 | {
|
| 2102 | - // Read a 4-byte integer from stream |
|
| 2103 | - $a = unpack('Ni',$this->_readstream($f,4));
|
|
| 2104 | - return $a['i']; |
|
| 2102 | + // Read a 4-byte integer from stream |
|
| 2103 | + $a = unpack('Ni',$this->_readstream($f,4));
|
|
| 2104 | + return $a['i']; |
|
| 2105 | 2105 | } |
| 2106 | 2106 | |
| 2107 | 2107 | /** |
@@ -2111,27 +2111,27 @@ discard block |
||
| 2111 | 2111 | */ |
| 2112 | 2112 | protected function _parsegif(string $file) : array |
| 2113 | 2113 | {
|
| 2114 | - // Extract info from a GIF file (via PNG conversion) |
|
| 2115 | - if(!function_exists('imagepng'))
|
|
| 2116 | - $this->Error('GD extension is required for GIF support');
|
|
| 2117 | - if(!function_exists('imagecreatefromgif'))
|
|
| 2118 | - $this->Error('GD has no GIF read support');
|
|
| 2119 | - $im = imagecreatefromgif($file); |
|
| 2120 | - if(!$im) |
|
| 2121 | - $this->Error('Missing or incorrect image file: '.$file);
|
|
| 2122 | - imageinterlace($im,0); |
|
| 2123 | - ob_start(); |
|
| 2124 | - imagepng($im); |
|
| 2125 | - $data = ob_get_clean(); |
|
| 2126 | - imagedestroy($im); |
|
| 2127 | - $f = fopen('php://temp','rb+');
|
|
| 2128 | - if(!$f) |
|
| 2129 | - $this->Error('Unable to create memory stream');
|
|
| 2130 | - fwrite($f,$data); |
|
| 2131 | - rewind($f); |
|
| 2132 | - $info = $this->_parsepngstream($f,$file); |
|
| 2133 | - fclose($f); |
|
| 2134 | - return $info; |
|
| 2114 | + // Extract info from a GIF file (via PNG conversion) |
|
| 2115 | + if(!function_exists('imagepng'))
|
|
| 2116 | + $this->Error('GD extension is required for GIF support');
|
|
| 2117 | + if(!function_exists('imagecreatefromgif'))
|
|
| 2118 | + $this->Error('GD has no GIF read support');
|
|
| 2119 | + $im = imagecreatefromgif($file); |
|
| 2120 | + if(!$im) |
|
| 2121 | + $this->Error('Missing or incorrect image file: '.$file);
|
|
| 2122 | + imageinterlace($im,0); |
|
| 2123 | + ob_start(); |
|
| 2124 | + imagepng($im); |
|
| 2125 | + $data = ob_get_clean(); |
|
| 2126 | + imagedestroy($im); |
|
| 2127 | + $f = fopen('php://temp','rb+');
|
|
| 2128 | + if(!$f) |
|
| 2129 | + $this->Error('Unable to create memory stream');
|
|
| 2130 | + fwrite($f,$data); |
|
| 2131 | + rewind($f); |
|
| 2132 | + $info = $this->_parsepngstream($f,$file); |
|
| 2133 | + fclose($f); |
|
| 2134 | + return $info; |
|
| 2135 | 2135 | } |
| 2136 | 2136 | |
| 2137 | 2137 | /** |
@@ -2140,15 +2140,15 @@ discard block |
||
| 2140 | 2140 | */ |
| 2141 | 2141 | protected function _out(string $s) : void |
| 2142 | 2142 | {
|
| 2143 | - // Add a line to the document |
|
| 2144 | - if($this->state==2) |
|
| 2145 | - $this->pages[$this->page] .= $s."\n"; |
|
| 2146 | - elseif($this->state==1) |
|
| 2147 | - $this->_put($s); |
|
| 2148 | - elseif($this->state==0) |
|
| 2149 | - $this->Error('No page has been added yet');
|
|
| 2150 | - elseif($this->state==3) |
|
| 2151 | - $this->Error('The document is closed');
|
|
| 2143 | + // Add a line to the document |
|
| 2144 | + if($this->state==2) |
|
| 2145 | + $this->pages[$this->page] .= $s."\n"; |
|
| 2146 | + elseif($this->state==1) |
|
| 2147 | + $this->_put($s); |
|
| 2148 | + elseif($this->state==0) |
|
| 2149 | + $this->Error('No page has been added yet');
|
|
| 2150 | + elseif($this->state==3) |
|
| 2151 | + $this->Error('The document is closed');
|
|
| 2152 | 2152 | } |
| 2153 | 2153 | |
| 2154 | 2154 | /** |
@@ -2157,7 +2157,7 @@ discard block |
||
| 2157 | 2157 | */ |
| 2158 | 2158 | protected function _put(string $s) : void |
| 2159 | 2159 | {
|
| 2160 | - $this->buffer .= $s."\n"; |
|
| 2160 | + $this->buffer .= $s."\n"; |
|
| 2161 | 2161 | } |
| 2162 | 2162 | |
| 2163 | 2163 | /** |
@@ -2166,7 +2166,7 @@ discard block |
||
| 2166 | 2166 | */ |
| 2167 | 2167 | protected function _getoffset() : int |
| 2168 | 2168 | {
|
| 2169 | - return strlen($this->buffer); |
|
| 2169 | + return strlen($this->buffer); |
|
| 2170 | 2170 | } |
| 2171 | 2171 | |
| 2172 | 2172 | /** |
@@ -2175,11 +2175,11 @@ discard block |
||
| 2175 | 2175 | */ |
| 2176 | 2176 | protected function _newobj(?int $n=null) : void |
| 2177 | 2177 | {
|
| 2178 | - // Begin a new object |
|
| 2179 | - if($n===null) |
|
| 2180 | - $n = ++$this->n; |
|
| 2181 | - $this->offsets[$n] = $this->_getoffset(); |
|
| 2182 | - $this->_put($n.' 0 obj'); |
|
| 2178 | + // Begin a new object |
|
| 2179 | + if($n===null) |
|
| 2180 | + $n = ++$this->n; |
|
| 2181 | + $this->offsets[$n] = $this->_getoffset(); |
|
| 2182 | + $this->_put($n.' 0 obj'); |
|
| 2183 | 2183 | } |
| 2184 | 2184 | |
| 2185 | 2185 | /** |
@@ -2188,9 +2188,9 @@ discard block |
||
| 2188 | 2188 | */ |
| 2189 | 2189 | protected function _putstream(string $data) : void |
| 2190 | 2190 | {
|
| 2191 | - $this->_put('stream');
|
|
| 2192 | - $this->_put($data); |
|
| 2193 | - $this->_put('endstream');
|
|
| 2191 | + $this->_put('stream');
|
|
| 2192 | + $this->_put($data); |
|
| 2193 | + $this->_put('endstream');
|
|
| 2194 | 2194 | } |
| 2195 | 2195 | |
| 2196 | 2196 | /** |
@@ -2199,18 +2199,18 @@ discard block |
||
| 2199 | 2199 | */ |
| 2200 | 2200 | protected function _putstreamobject(string $data) : void |
| 2201 | 2201 | {
|
| 2202 | - if($this->compress) |
|
| 2203 | - {
|
|
| 2204 | - $entries = '/Filter /FlateDecode '; |
|
| 2205 | - $data = gzcompress($data); |
|
| 2206 | - } |
|
| 2207 | - else |
|
| 2208 | - $entries = ''; |
|
| 2209 | - $entries .= '/Length '.strlen($data); |
|
| 2210 | - $this->_newobj(); |
|
| 2211 | - $this->_put('<<'.$entries.'>>');
|
|
| 2212 | - $this->_putstream($data); |
|
| 2213 | - $this->_put('endobj');
|
|
| 2202 | + if($this->compress) |
|
| 2203 | + {
|
|
| 2204 | + $entries = '/Filter /FlateDecode '; |
|
| 2205 | + $data = gzcompress($data); |
|
| 2206 | + } |
|
| 2207 | + else |
|
| 2208 | + $entries = ''; |
|
| 2209 | + $entries .= '/Length '.strlen($data); |
|
| 2210 | + $this->_newobj(); |
|
| 2211 | + $this->_put('<<'.$entries.'>>');
|
|
| 2212 | + $this->_putstream($data); |
|
| 2213 | + $this->_put('endobj');
|
|
| 2214 | 2214 | } |
| 2215 | 2215 | |
| 2216 | 2216 | /** |
@@ -2219,44 +2219,44 @@ discard block |
||
| 2219 | 2219 | */ |
| 2220 | 2220 | protected function _putpage(int $n) : void |
| 2221 | 2221 | {
|
| 2222 | - $this->_newobj(); |
|
| 2223 | - $this->_put('<</Type /Page');
|
|
| 2224 | - $this->_put('/Parent 1 0 R');
|
|
| 2225 | - if(isset($this->PageInfo[$n]['size'])) |
|
| 2226 | - $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageInfo[$n]['size'][0],$this->PageInfo[$n]['size'][1]));
|
|
| 2227 | - if(isset($this->PageInfo[$n]['rotation'])) |
|
| 2228 | - $this->_put('/Rotate '.$this->PageInfo[$n]['rotation']);
|
|
| 2229 | - $this->_put('/Resources 2 0 R');
|
|
| 2230 | - if(isset($this->PageLinks[$n])) |
|
| 2231 | - {
|
|
| 2232 | - // Links |
|
| 2233 | - $annots = '/Annots ['; |
|
| 2234 | - foreach($this->PageLinks[$n] as $pl) |
|
| 2235 | - {
|
|
| 2236 | - $rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
|
|
| 2237 | - $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; |
|
| 2238 | - if(is_string($pl[4])) |
|
| 2239 | - $annots .= '/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; |
|
| 2240 | - else |
|
| 2241 | - {
|
|
| 2242 | - $l = $this->links[$pl[4]]; |
|
| 2243 | - if(isset($this->PageInfo[$l[0]]['size'])) |
|
| 2244 | - $h = $this->PageInfo[$l[0]]['size'][1]; |
|
| 2245 | - else |
|
| 2246 | - $h = ($this->DefOrientation=='P') ? $this->DefPageSize[1]*$this->k : $this->DefPageSize[0]*$this->k; |
|
| 2247 | - $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',$this->PageInfo[$l[0]]['n'],$h-$l[1]*$this->k);
|
|
| 2248 | - } |
|
| 2249 | - } |
|
| 2250 | - $this->_put($annots.']'); |
|
| 2251 | - } |
|
| 2252 | - if($this->WithAlpha) |
|
| 2253 | - $this->_put('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
|
|
| 2254 | - $this->_put('/Contents '.($this->n+1).' 0 R>>');
|
|
| 2255 | - $this->_put('endobj');
|
|
| 2256 | - // Page content |
|
| 2257 | - if(!empty($this->AliasNbPages)) |
|
| 2258 | - $this->pages[$n] = str_replace($this->AliasNbPages, strval($this->page), $this->pages[$n]); |
|
| 2259 | - $this->_putstreamobject($this->pages[$n]); |
|
| 2222 | + $this->_newobj(); |
|
| 2223 | + $this->_put('<</Type /Page');
|
|
| 2224 | + $this->_put('/Parent 1 0 R');
|
|
| 2225 | + if(isset($this->PageInfo[$n]['size'])) |
|
| 2226 | + $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageInfo[$n]['size'][0],$this->PageInfo[$n]['size'][1]));
|
|
| 2227 | + if(isset($this->PageInfo[$n]['rotation'])) |
|
| 2228 | + $this->_put('/Rotate '.$this->PageInfo[$n]['rotation']);
|
|
| 2229 | + $this->_put('/Resources 2 0 R');
|
|
| 2230 | + if(isset($this->PageLinks[$n])) |
|
| 2231 | + {
|
|
| 2232 | + // Links |
|
| 2233 | + $annots = '/Annots ['; |
|
| 2234 | + foreach($this->PageLinks[$n] as $pl) |
|
| 2235 | + {
|
|
| 2236 | + $rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
|
|
| 2237 | + $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; |
|
| 2238 | + if(is_string($pl[4])) |
|
| 2239 | + $annots .= '/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; |
|
| 2240 | + else |
|
| 2241 | + {
|
|
| 2242 | + $l = $this->links[$pl[4]]; |
|
| 2243 | + if(isset($this->PageInfo[$l[0]]['size'])) |
|
| 2244 | + $h = $this->PageInfo[$l[0]]['size'][1]; |
|
| 2245 | + else |
|
| 2246 | + $h = ($this->DefOrientation=='P') ? $this->DefPageSize[1]*$this->k : $this->DefPageSize[0]*$this->k; |
|
| 2247 | + $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',$this->PageInfo[$l[0]]['n'],$h-$l[1]*$this->k);
|
|
| 2248 | + } |
|
| 2249 | + } |
|
| 2250 | + $this->_put($annots.']'); |
|
| 2251 | + } |
|
| 2252 | + if($this->WithAlpha) |
|
| 2253 | + $this->_put('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
|
|
| 2254 | + $this->_put('/Contents '.($this->n+1).' 0 R>>');
|
|
| 2255 | + $this->_put('endobj');
|
|
| 2256 | + // Page content |
|
| 2257 | + if(!empty($this->AliasNbPages)) |
|
| 2258 | + $this->pages[$n] = str_replace($this->AliasNbPages, strval($this->page), $this->pages[$n]); |
|
| 2259 | + $this->_putstreamobject($this->pages[$n]); |
|
| 2260 | 2260 | } |
| 2261 | 2261 | |
| 2262 | 2262 | /** |
@@ -2264,32 +2264,32 @@ discard block |
||
| 2264 | 2264 | */ |
| 2265 | 2265 | protected function _putpages() : void |
| 2266 | 2266 | {
|
| 2267 | - $nb = $this->page; |
|
| 2268 | - for($n=1;$n<=$nb;$n++) |
|
| 2269 | - $this->PageInfo[$n]['n'] = $this->n+1+2*($n-1); |
|
| 2270 | - for($n=1;$n<=$nb;$n++) |
|
| 2271 | - $this->_putpage($n); |
|
| 2272 | - // Pages root |
|
| 2273 | - $this->_newobj(1); |
|
| 2274 | - $this->_put('<</Type /Pages');
|
|
| 2275 | - $kids = '/Kids ['; |
|
| 2276 | - for($n=1;$n<=$nb;$n++) |
|
| 2277 | - $kids .= $this->PageInfo[$n]['n'].' 0 R '; |
|
| 2278 | - $this->_put($kids.']'); |
|
| 2279 | - $this->_put('/Count '.$nb);
|
|
| 2280 | - if($this->DefOrientation=='P') |
|
| 2281 | - {
|
|
| 2282 | - $w = $this->DefPageSize[0]; |
|
| 2283 | - $h = $this->DefPageSize[1]; |
|
| 2284 | - } |
|
| 2285 | - else |
|
| 2286 | - {
|
|
| 2287 | - $w = $this->DefPageSize[1]; |
|
| 2288 | - $h = $this->DefPageSize[0]; |
|
| 2289 | - } |
|
| 2290 | - $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$w*$this->k,$h*$this->k));
|
|
| 2291 | - $this->_put('>>');
|
|
| 2292 | - $this->_put('endobj');
|
|
| 2267 | + $nb = $this->page; |
|
| 2268 | + for($n=1;$n<=$nb;$n++) |
|
| 2269 | + $this->PageInfo[$n]['n'] = $this->n+1+2*($n-1); |
|
| 2270 | + for($n=1;$n<=$nb;$n++) |
|
| 2271 | + $this->_putpage($n); |
|
| 2272 | + // Pages root |
|
| 2273 | + $this->_newobj(1); |
|
| 2274 | + $this->_put('<</Type /Pages');
|
|
| 2275 | + $kids = '/Kids ['; |
|
| 2276 | + for($n=1;$n<=$nb;$n++) |
|
| 2277 | + $kids .= $this->PageInfo[$n]['n'].' 0 R '; |
|
| 2278 | + $this->_put($kids.']'); |
|
| 2279 | + $this->_put('/Count '.$nb);
|
|
| 2280 | + if($this->DefOrientation=='P') |
|
| 2281 | + {
|
|
| 2282 | + $w = $this->DefPageSize[0]; |
|
| 2283 | + $h = $this->DefPageSize[1]; |
|
| 2284 | + } |
|
| 2285 | + else |
|
| 2286 | + {
|
|
| 2287 | + $w = $this->DefPageSize[1]; |
|
| 2288 | + $h = $this->DefPageSize[0]; |
|
| 2289 | + } |
|
| 2290 | + $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$w*$this->k,$h*$this->k));
|
|
| 2291 | + $this->_put('>>');
|
|
| 2292 | + $this->_put('endobj');
|
|
| 2293 | 2293 | } |
| 2294 | 2294 | |
| 2295 | 2295 | /** |
@@ -2297,120 +2297,120 @@ discard block |
||
| 2297 | 2297 | */ |
| 2298 | 2298 | protected function _putfonts() : void |
| 2299 | 2299 | {
|
| 2300 | - foreach($this->FontFiles as $file=>$info) |
|
| 2301 | - {
|
|
| 2302 | - // Font file embedding |
|
| 2303 | - $this->_newobj(); |
|
| 2304 | - $this->FontFiles[$file]['n'] = $this->n; |
|
| 2305 | - $font = file_get_contents($this->fontpath.$file,true); |
|
| 2306 | - if(!$font) |
|
| 2307 | - $this->Error('Font file not found: '.$file);
|
|
| 2308 | - $compressed = (substr($file,-2)=='.z'); |
|
| 2309 | - if(!$compressed && isset($info['length2'])) |
|
| 2310 | - $font = substr($font,6,$info['length1']).substr($font,6+$info['length1']+6,$info['length2']); |
|
| 2311 | - $this->_put('<</Length '.strlen($font));
|
|
| 2312 | - if($compressed) |
|
| 2313 | - $this->_put('/Filter /FlateDecode');
|
|
| 2314 | - $this->_put('/Length1 '.$info['length1']);
|
|
| 2315 | - if(isset($info['length2'])) |
|
| 2316 | - $this->_put('/Length2 '.$info['length2'].' /Length3 0');
|
|
| 2317 | - $this->_put('>>');
|
|
| 2318 | - $this->_putstream($font); |
|
| 2319 | - $this->_put('endobj');
|
|
| 2320 | - } |
|
| 2321 | - foreach($this->fonts as $k=>$font) |
|
| 2322 | - {
|
|
| 2323 | - // Encoding |
|
| 2324 | - if(isset($font['diff'])) |
|
| 2325 | - {
|
|
| 2326 | - if(!isset($this->encodings[$font['enc']])) |
|
| 2327 | - {
|
|
| 2328 | - $this->_newobj(); |
|
| 2329 | - $this->_put('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$font['diff'].']>>');
|
|
| 2330 | - $this->_put('endobj');
|
|
| 2331 | - $this->encodings[$font['enc']] = $this->n; |
|
| 2332 | - } |
|
| 2333 | - } |
|
| 2334 | - // ToUnicode CMap |
|
| 2335 | - $cmapkey = ''; |
|
| 2336 | - if(isset($font['uv'])) |
|
| 2337 | - {
|
|
| 2338 | - if(isset($font['enc'])) |
|
| 2339 | - $cmapkey = $font['enc']; |
|
| 2340 | - else |
|
| 2341 | - $cmapkey = $font['name']; |
|
| 2342 | - if(!isset($this->cmaps[$cmapkey])) |
|
| 2343 | - {
|
|
| 2344 | - $cmap = $this->_tounicodecmap($font['uv']); |
|
| 2345 | - $this->_putstreamobject($cmap); |
|
| 2346 | - $this->cmaps[$cmapkey] = $this->n; |
|
| 2347 | - } |
|
| 2348 | - } |
|
| 2349 | - // Font object |
|
| 2350 | - $this->fonts[$k]['n'] = $this->n+1; |
|
| 2351 | - $type = $font['type']; |
|
| 2352 | - $name = $font['name']; |
|
| 2353 | - if($font['subsetted']) |
|
| 2354 | - $name = 'AAAAAA+'.$name; |
|
| 2355 | - if($type=='Core') |
|
| 2356 | - {
|
|
| 2357 | - // Core font |
|
| 2358 | - $this->_newobj(); |
|
| 2359 | - $this->_put('<</Type /Font');
|
|
| 2360 | - $this->_put('/BaseFont /'.$name);
|
|
| 2361 | - $this->_put('/Subtype /Type1');
|
|
| 2362 | - if($name!='Symbol' && $name!='ZapfDingbats') |
|
| 2363 | - $this->_put('/Encoding /WinAnsiEncoding');
|
|
| 2364 | - if(isset($font['uv'])) |
|
| 2365 | - $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
|
|
| 2366 | - $this->_put('>>');
|
|
| 2367 | - $this->_put('endobj');
|
|
| 2368 | - } |
|
| 2369 | - elseif($type=='Type1' || $type=='TrueType') |
|
| 2370 | - {
|
|
| 2371 | - // Additional Type1 or TrueType/OpenType font |
|
| 2372 | - $this->_newobj(); |
|
| 2373 | - $this->_put('<</Type /Font');
|
|
| 2374 | - $this->_put('/BaseFont /'.$name);
|
|
| 2375 | - $this->_put('/Subtype /'.$type);
|
|
| 2376 | - $this->_put('/FirstChar 32 /LastChar 255');
|
|
| 2377 | - $this->_put('/Widths '.($this->n+1).' 0 R');
|
|
| 2378 | - $this->_put('/FontDescriptor '.($this->n+2).' 0 R');
|
|
| 2379 | - if(isset($font['diff'])) |
|
| 2380 | - $this->_put('/Encoding '.$this->encodings[$font['enc']].' 0 R');
|
|
| 2381 | - else |
|
| 2382 | - $this->_put('/Encoding /WinAnsiEncoding');
|
|
| 2383 | - if(isset($font['uv'])) |
|
| 2384 | - $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
|
|
| 2385 | - $this->_put('>>');
|
|
| 2386 | - $this->_put('endobj');
|
|
| 2387 | - // Widths |
|
| 2388 | - $this->_newobj(); |
|
| 2389 | - $cw = &$font['cw']; |
|
| 2390 | - $s = '['; |
|
| 2391 | - for($i=32;$i<=255;$i++) |
|
| 2392 | - $s .= $cw[chr($i)].' '; |
|
| 2393 | - $this->_put($s.']'); |
|
| 2394 | - $this->_put('endobj');
|
|
| 2395 | - // Descriptor |
|
| 2396 | - $this->_newobj(); |
|
| 2397 | - $s = '<</Type /FontDescriptor /FontName /'.$name; |
|
| 2398 | - foreach($font['desc'] as $k=>$v) |
|
| 2399 | - $s .= ' /'.$k.' '.$v; |
|
| 2400 | - if(!empty($font['file'])) |
|
| 2401 | - $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R'; |
|
| 2402 | - $this->_put($s.'>>'); |
|
| 2403 | - $this->_put('endobj');
|
|
| 2404 | - } |
|
| 2405 | - else |
|
| 2406 | - {
|
|
| 2407 | - // Allow for additional types |
|
| 2408 | - $mtd = '_put'.strtolower($type); |
|
| 2409 | - if(!method_exists($this,$mtd)) |
|
| 2410 | - $this->Error('Unsupported font type: '.$type);
|
|
| 2411 | - $this->$mtd($font); |
|
| 2412 | - } |
|
| 2413 | - } |
|
| 2300 | + foreach($this->FontFiles as $file=>$info) |
|
| 2301 | + {
|
|
| 2302 | + // Font file embedding |
|
| 2303 | + $this->_newobj(); |
|
| 2304 | + $this->FontFiles[$file]['n'] = $this->n; |
|
| 2305 | + $font = file_get_contents($this->fontpath.$file,true); |
|
| 2306 | + if(!$font) |
|
| 2307 | + $this->Error('Font file not found: '.$file);
|
|
| 2308 | + $compressed = (substr($file,-2)=='.z'); |
|
| 2309 | + if(!$compressed && isset($info['length2'])) |
|
| 2310 | + $font = substr($font,6,$info['length1']).substr($font,6+$info['length1']+6,$info['length2']); |
|
| 2311 | + $this->_put('<</Length '.strlen($font));
|
|
| 2312 | + if($compressed) |
|
| 2313 | + $this->_put('/Filter /FlateDecode');
|
|
| 2314 | + $this->_put('/Length1 '.$info['length1']);
|
|
| 2315 | + if(isset($info['length2'])) |
|
| 2316 | + $this->_put('/Length2 '.$info['length2'].' /Length3 0');
|
|
| 2317 | + $this->_put('>>');
|
|
| 2318 | + $this->_putstream($font); |
|
| 2319 | + $this->_put('endobj');
|
|
| 2320 | + } |
|
| 2321 | + foreach($this->fonts as $k=>$font) |
|
| 2322 | + {
|
|
| 2323 | + // Encoding |
|
| 2324 | + if(isset($font['diff'])) |
|
| 2325 | + {
|
|
| 2326 | + if(!isset($this->encodings[$font['enc']])) |
|
| 2327 | + {
|
|
| 2328 | + $this->_newobj(); |
|
| 2329 | + $this->_put('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$font['diff'].']>>');
|
|
| 2330 | + $this->_put('endobj');
|
|
| 2331 | + $this->encodings[$font['enc']] = $this->n; |
|
| 2332 | + } |
|
| 2333 | + } |
|
| 2334 | + // ToUnicode CMap |
|
| 2335 | + $cmapkey = ''; |
|
| 2336 | + if(isset($font['uv'])) |
|
| 2337 | + {
|
|
| 2338 | + if(isset($font['enc'])) |
|
| 2339 | + $cmapkey = $font['enc']; |
|
| 2340 | + else |
|
| 2341 | + $cmapkey = $font['name']; |
|
| 2342 | + if(!isset($this->cmaps[$cmapkey])) |
|
| 2343 | + {
|
|
| 2344 | + $cmap = $this->_tounicodecmap($font['uv']); |
|
| 2345 | + $this->_putstreamobject($cmap); |
|
| 2346 | + $this->cmaps[$cmapkey] = $this->n; |
|
| 2347 | + } |
|
| 2348 | + } |
|
| 2349 | + // Font object |
|
| 2350 | + $this->fonts[$k]['n'] = $this->n+1; |
|
| 2351 | + $type = $font['type']; |
|
| 2352 | + $name = $font['name']; |
|
| 2353 | + if($font['subsetted']) |
|
| 2354 | + $name = 'AAAAAA+'.$name; |
|
| 2355 | + if($type=='Core') |
|
| 2356 | + {
|
|
| 2357 | + // Core font |
|
| 2358 | + $this->_newobj(); |
|
| 2359 | + $this->_put('<</Type /Font');
|
|
| 2360 | + $this->_put('/BaseFont /'.$name);
|
|
| 2361 | + $this->_put('/Subtype /Type1');
|
|
| 2362 | + if($name!='Symbol' && $name!='ZapfDingbats') |
|
| 2363 | + $this->_put('/Encoding /WinAnsiEncoding');
|
|
| 2364 | + if(isset($font['uv'])) |
|
| 2365 | + $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
|
|
| 2366 | + $this->_put('>>');
|
|
| 2367 | + $this->_put('endobj');
|
|
| 2368 | + } |
|
| 2369 | + elseif($type=='Type1' || $type=='TrueType') |
|
| 2370 | + {
|
|
| 2371 | + // Additional Type1 or TrueType/OpenType font |
|
| 2372 | + $this->_newobj(); |
|
| 2373 | + $this->_put('<</Type /Font');
|
|
| 2374 | + $this->_put('/BaseFont /'.$name);
|
|
| 2375 | + $this->_put('/Subtype /'.$type);
|
|
| 2376 | + $this->_put('/FirstChar 32 /LastChar 255');
|
|
| 2377 | + $this->_put('/Widths '.($this->n+1).' 0 R');
|
|
| 2378 | + $this->_put('/FontDescriptor '.($this->n+2).' 0 R');
|
|
| 2379 | + if(isset($font['diff'])) |
|
| 2380 | + $this->_put('/Encoding '.$this->encodings[$font['enc']].' 0 R');
|
|
| 2381 | + else |
|
| 2382 | + $this->_put('/Encoding /WinAnsiEncoding');
|
|
| 2383 | + if(isset($font['uv'])) |
|
| 2384 | + $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
|
|
| 2385 | + $this->_put('>>');
|
|
| 2386 | + $this->_put('endobj');
|
|
| 2387 | + // Widths |
|
| 2388 | + $this->_newobj(); |
|
| 2389 | + $cw = &$font['cw']; |
|
| 2390 | + $s = '['; |
|
| 2391 | + for($i=32;$i<=255;$i++) |
|
| 2392 | + $s .= $cw[chr($i)].' '; |
|
| 2393 | + $this->_put($s.']'); |
|
| 2394 | + $this->_put('endobj');
|
|
| 2395 | + // Descriptor |
|
| 2396 | + $this->_newobj(); |
|
| 2397 | + $s = '<</Type /FontDescriptor /FontName /'.$name; |
|
| 2398 | + foreach($font['desc'] as $k=>$v) |
|
| 2399 | + $s .= ' /'.$k.' '.$v; |
|
| 2400 | + if(!empty($font['file'])) |
|
| 2401 | + $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R'; |
|
| 2402 | + $this->_put($s.'>>'); |
|
| 2403 | + $this->_put('endobj');
|
|
| 2404 | + } |
|
| 2405 | + else |
|
| 2406 | + {
|
|
| 2407 | + // Allow for additional types |
|
| 2408 | + $mtd = '_put'.strtolower($type); |
|
| 2409 | + if(!method_exists($this,$mtd)) |
|
| 2410 | + $this->Error('Unsupported font type: '.$type);
|
|
| 2411 | + $this->$mtd($font); |
|
| 2412 | + } |
|
| 2413 | + } |
|
| 2414 | 2414 | } |
| 2415 | 2415 | |
| 2416 | 2416 | /** |
@@ -2419,53 +2419,53 @@ discard block |
||
| 2419 | 2419 | */ |
| 2420 | 2420 | protected function _tounicodecmap(array $uv) : string |
| 2421 | 2421 | {
|
| 2422 | - $ranges = ''; |
|
| 2423 | - $nbr = 0; |
|
| 2424 | - $chars = ''; |
|
| 2425 | - $nbc = 0; |
|
| 2426 | - foreach($uv as $c=>$v) |
|
| 2427 | - {
|
|
| 2428 | - if(is_array($v)) |
|
| 2429 | - {
|
|
| 2430 | - $ranges .= sprintf("<%02X> <%02X> <%04X>\n",$c,$c+$v[1]-1,$v[0]);
|
|
| 2431 | - $nbr++; |
|
| 2432 | - } |
|
| 2433 | - else |
|
| 2434 | - {
|
|
| 2435 | - $chars .= sprintf("<%02X> <%04X>\n",$c,$v);
|
|
| 2436 | - $nbc++; |
|
| 2437 | - } |
|
| 2438 | - } |
|
| 2439 | - $s = "/CIDInit /ProcSet findresource begin\n"; |
|
| 2440 | - $s .= "12 dict begin\n"; |
|
| 2441 | - $s .= "begincmap\n"; |
|
| 2442 | - $s .= "/CIDSystemInfo\n"; |
|
| 2443 | - $s .= "<</Registry (Adobe)\n"; |
|
| 2444 | - $s .= "/Ordering (UCS)\n"; |
|
| 2445 | - $s .= "/Supplement 0\n"; |
|
| 2446 | - $s .= ">> def\n"; |
|
| 2447 | - $s .= "/CMapName /Adobe-Identity-UCS def\n"; |
|
| 2448 | - $s .= "/CMapType 2 def\n"; |
|
| 2449 | - $s .= "1 begincodespacerange\n"; |
|
| 2450 | - $s .= "<00> <FF>\n"; |
|
| 2451 | - $s .= "endcodespacerange\n"; |
|
| 2452 | - if($nbr>0) |
|
| 2453 | - {
|
|
| 2454 | - $s .= "$nbr beginbfrange\n"; |
|
| 2455 | - $s .= $ranges; |
|
| 2456 | - $s .= "endbfrange\n"; |
|
| 2457 | - } |
|
| 2458 | - if($nbc>0) |
|
| 2459 | - {
|
|
| 2460 | - $s .= "$nbc beginbfchar\n"; |
|
| 2461 | - $s .= $chars; |
|
| 2462 | - $s .= "endbfchar\n"; |
|
| 2463 | - } |
|
| 2464 | - $s .= "endcmap\n"; |
|
| 2465 | - $s .= "CMapName currentdict /CMap defineresource pop\n"; |
|
| 2466 | - $s .= "end\n"; |
|
| 2467 | - $s .= "end"; |
|
| 2468 | - return $s; |
|
| 2422 | + $ranges = ''; |
|
| 2423 | + $nbr = 0; |
|
| 2424 | + $chars = ''; |
|
| 2425 | + $nbc = 0; |
|
| 2426 | + foreach($uv as $c=>$v) |
|
| 2427 | + {
|
|
| 2428 | + if(is_array($v)) |
|
| 2429 | + {
|
|
| 2430 | + $ranges .= sprintf("<%02X> <%02X> <%04X>\n",$c,$c+$v[1]-1,$v[0]);
|
|
| 2431 | + $nbr++; |
|
| 2432 | + } |
|
| 2433 | + else |
|
| 2434 | + {
|
|
| 2435 | + $chars .= sprintf("<%02X> <%04X>\n",$c,$v);
|
|
| 2436 | + $nbc++; |
|
| 2437 | + } |
|
| 2438 | + } |
|
| 2439 | + $s = "/CIDInit /ProcSet findresource begin\n"; |
|
| 2440 | + $s .= "12 dict begin\n"; |
|
| 2441 | + $s .= "begincmap\n"; |
|
| 2442 | + $s .= "/CIDSystemInfo\n"; |
|
| 2443 | + $s .= "<</Registry (Adobe)\n"; |
|
| 2444 | + $s .= "/Ordering (UCS)\n"; |
|
| 2445 | + $s .= "/Supplement 0\n"; |
|
| 2446 | + $s .= ">> def\n"; |
|
| 2447 | + $s .= "/CMapName /Adobe-Identity-UCS def\n"; |
|
| 2448 | + $s .= "/CMapType 2 def\n"; |
|
| 2449 | + $s .= "1 begincodespacerange\n"; |
|
| 2450 | + $s .= "<00> <FF>\n"; |
|
| 2451 | + $s .= "endcodespacerange\n"; |
|
| 2452 | + if($nbr>0) |
|
| 2453 | + {
|
|
| 2454 | + $s .= "$nbr beginbfrange\n"; |
|
| 2455 | + $s .= $ranges; |
|
| 2456 | + $s .= "endbfrange\n"; |
|
| 2457 | + } |
|
| 2458 | + if($nbc>0) |
|
| 2459 | + {
|
|
| 2460 | + $s .= "$nbc beginbfchar\n"; |
|
| 2461 | + $s .= $chars; |
|
| 2462 | + $s .= "endbfchar\n"; |
|
| 2463 | + } |
|
| 2464 | + $s .= "endcmap\n"; |
|
| 2465 | + $s .= "CMapName currentdict /CMap defineresource pop\n"; |
|
| 2466 | + $s .= "end\n"; |
|
| 2467 | + $s .= "end"; |
|
| 2468 | + return $s; |
|
| 2469 | 2469 | } |
| 2470 | 2470 | |
| 2471 | 2471 | /** |
@@ -2473,12 +2473,12 @@ discard block |
||
| 2473 | 2473 | */ |
| 2474 | 2474 | protected function _putimages() : void |
| 2475 | 2475 | {
|
| 2476 | - foreach(array_keys($this->images) as $file) |
|
| 2477 | - {
|
|
| 2478 | - $this->_putimage($this->images[$file]); |
|
| 2479 | - unset($this->images[$file]['data']); |
|
| 2480 | - unset($this->images[$file]['smask']); |
|
| 2481 | - } |
|
| 2476 | + foreach(array_keys($this->images) as $file) |
|
| 2477 | + {
|
|
| 2478 | + $this->_putimage($this->images[$file]); |
|
| 2479 | + unset($this->images[$file]['data']); |
|
| 2480 | + unset($this->images[$file]['smask']); |
|
| 2481 | + } |
|
| 2482 | 2482 | } |
| 2483 | 2483 | |
| 2484 | 2484 | /** |
@@ -2487,47 +2487,47 @@ discard block |
||
| 2487 | 2487 | */ |
| 2488 | 2488 | protected function _putimage(array &$info) : void |
| 2489 | 2489 | {
|
| 2490 | - $this->_newobj(); |
|
| 2491 | - $info['n'] = $this->n; |
|
| 2492 | - $this->_put('<</Type /XObject');
|
|
| 2493 | - $this->_put('/Subtype /Image');
|
|
| 2494 | - $this->_put('/Width '.$info['w']);
|
|
| 2495 | - $this->_put('/Height '.$info['h']);
|
|
| 2496 | - if($info['cs']=='Indexed') |
|
| 2497 | - $this->_put('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
|
|
| 2498 | - else |
|
| 2499 | - {
|
|
| 2500 | - $this->_put('/ColorSpace /'.$info['cs']);
|
|
| 2501 | - if($info['cs']=='DeviceCMYK') |
|
| 2502 | - $this->_put('/Decode [1 0 1 0 1 0 1 0]');
|
|
| 2503 | - } |
|
| 2504 | - $this->_put('/BitsPerComponent '.$info['bpc']);
|
|
| 2505 | - if(isset($info['f'])) |
|
| 2506 | - $this->_put('/Filter /'.$info['f']);
|
|
| 2507 | - if(isset($info['dp'])) |
|
| 2508 | - $this->_put('/DecodeParms <<'.$info['dp'].'>>');
|
|
| 2509 | - if(isset($info['trns']) && is_array($info['trns'])) |
|
| 2510 | - {
|
|
| 2511 | - $trns = ''; |
|
| 2512 | - for($i=0;$i<count($info['trns']);$i++) |
|
| 2513 | - $trns .= $info['trns'][$i].' '.$info['trns'][$i].' '; |
|
| 2514 | - $this->_put('/Mask ['.$trns.']');
|
|
| 2515 | - } |
|
| 2516 | - if(isset($info['smask'])) |
|
| 2517 | - $this->_put('/SMask '.($this->n+1).' 0 R');
|
|
| 2518 | - $this->_put('/Length '.strlen($info['data']).'>>');
|
|
| 2519 | - $this->_putstream($info['data']); |
|
| 2520 | - $this->_put('endobj');
|
|
| 2521 | - // Soft mask |
|
| 2522 | - if(isset($info['smask'])) |
|
| 2523 | - {
|
|
| 2524 | - $dp = '/Predictor 15 /Colors 1 /BitsPerComponent 8 /Columns '.$info['w']; |
|
| 2525 | - $smask = array('w'=>$info['w'], 'h'=>$info['h'], 'cs'=>'DeviceGray', 'bpc'=>8, 'f'=>$info['f'], 'dp'=>$dp, 'data'=>$info['smask']);
|
|
| 2526 | - $this->_putimage($smask); |
|
| 2527 | - } |
|
| 2528 | - // Palette |
|
| 2529 | - if($info['cs']=='Indexed') |
|
| 2530 | - $this->_putstreamobject($info['pal']); |
|
| 2490 | + $this->_newobj(); |
|
| 2491 | + $info['n'] = $this->n; |
|
| 2492 | + $this->_put('<</Type /XObject');
|
|
| 2493 | + $this->_put('/Subtype /Image');
|
|
| 2494 | + $this->_put('/Width '.$info['w']);
|
|
| 2495 | + $this->_put('/Height '.$info['h']);
|
|
| 2496 | + if($info['cs']=='Indexed') |
|
| 2497 | + $this->_put('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
|
|
| 2498 | + else |
|
| 2499 | + {
|
|
| 2500 | + $this->_put('/ColorSpace /'.$info['cs']);
|
|
| 2501 | + if($info['cs']=='DeviceCMYK') |
|
| 2502 | + $this->_put('/Decode [1 0 1 0 1 0 1 0]');
|
|
| 2503 | + } |
|
| 2504 | + $this->_put('/BitsPerComponent '.$info['bpc']);
|
|
| 2505 | + if(isset($info['f'])) |
|
| 2506 | + $this->_put('/Filter /'.$info['f']);
|
|
| 2507 | + if(isset($info['dp'])) |
|
| 2508 | + $this->_put('/DecodeParms <<'.$info['dp'].'>>');
|
|
| 2509 | + if(isset($info['trns']) && is_array($info['trns'])) |
|
| 2510 | + {
|
|
| 2511 | + $trns = ''; |
|
| 2512 | + for($i=0;$i<count($info['trns']);$i++) |
|
| 2513 | + $trns .= $info['trns'][$i].' '.$info['trns'][$i].' '; |
|
| 2514 | + $this->_put('/Mask ['.$trns.']');
|
|
| 2515 | + } |
|
| 2516 | + if(isset($info['smask'])) |
|
| 2517 | + $this->_put('/SMask '.($this->n+1).' 0 R');
|
|
| 2518 | + $this->_put('/Length '.strlen($info['data']).'>>');
|
|
| 2519 | + $this->_putstream($info['data']); |
|
| 2520 | + $this->_put('endobj');
|
|
| 2521 | + // Soft mask |
|
| 2522 | + if(isset($info['smask'])) |
|
| 2523 | + {
|
|
| 2524 | + $dp = '/Predictor 15 /Colors 1 /BitsPerComponent 8 /Columns '.$info['w']; |
|
| 2525 | + $smask = array('w'=>$info['w'], 'h'=>$info['h'], 'cs'=>'DeviceGray', 'bpc'=>8, 'f'=>$info['f'], 'dp'=>$dp, 'data'=>$info['smask']);
|
|
| 2526 | + $this->_putimage($smask); |
|
| 2527 | + } |
|
| 2528 | + // Palette |
|
| 2529 | + if($info['cs']=='Indexed') |
|
| 2530 | + $this->_putstreamobject($info['pal']); |
|
| 2531 | 2531 | } |
| 2532 | 2532 | |
| 2533 | 2533 | /** |
@@ -2535,8 +2535,8 @@ discard block |
||
| 2535 | 2535 | */ |
| 2536 | 2536 | protected function _putxobjectdict() : void |
| 2537 | 2537 | {
|
| 2538 | - foreach($this->images as $image) |
|
| 2539 | - $this->_put('/I'.$image['i'].' '.$image['n'].' 0 R');
|
|
| 2538 | + foreach($this->images as $image) |
|
| 2539 | + $this->_put('/I'.$image['i'].' '.$image['n'].' 0 R');
|
|
| 2540 | 2540 | } |
| 2541 | 2541 | |
| 2542 | 2542 | /** |
@@ -2544,14 +2544,14 @@ discard block |
||
| 2544 | 2544 | */ |
| 2545 | 2545 | protected function _putresourcedict() : void |
| 2546 | 2546 | {
|
| 2547 | - $this->_put('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
|
|
| 2548 | - $this->_put('/Font <<');
|
|
| 2549 | - foreach($this->fonts as $font) |
|
| 2550 | - $this->_put('/F'.$font['i'].' '.$font['n'].' 0 R');
|
|
| 2551 | - $this->_put('>>');
|
|
| 2552 | - $this->_put('/XObject <<');
|
|
| 2553 | - $this->_putxobjectdict(); |
|
| 2554 | - $this->_put('>>');
|
|
| 2547 | + $this->_put('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
|
|
| 2548 | + $this->_put('/Font <<');
|
|
| 2549 | + foreach($this->fonts as $font) |
|
| 2550 | + $this->_put('/F'.$font['i'].' '.$font['n'].' 0 R');
|
|
| 2551 | + $this->_put('>>');
|
|
| 2552 | + $this->_put('/XObject <<');
|
|
| 2553 | + $this->_putxobjectdict(); |
|
| 2554 | + $this->_put('>>');
|
|
| 2555 | 2555 | } |
| 2556 | 2556 | |
| 2557 | 2557 | /** |
@@ -2559,14 +2559,14 @@ discard block |
||
| 2559 | 2559 | */ |
| 2560 | 2560 | protected function _putresources() : void |
| 2561 | 2561 | {
|
| 2562 | - $this->_putfonts(); |
|
| 2563 | - $this->_putimages(); |
|
| 2564 | - // Resource dictionary |
|
| 2565 | - $this->_newobj(2); |
|
| 2566 | - $this->_put('<<');
|
|
| 2567 | - $this->_putresourcedict(); |
|
| 2568 | - $this->_put('>>');
|
|
| 2569 | - $this->_put('endobj');
|
|
| 2562 | + $this->_putfonts(); |
|
| 2563 | + $this->_putimages(); |
|
| 2564 | + // Resource dictionary |
|
| 2565 | + $this->_newobj(2); |
|
| 2566 | + $this->_put('<<');
|
|
| 2567 | + $this->_putresourcedict(); |
|
| 2568 | + $this->_put('>>');
|
|
| 2569 | + $this->_put('endobj');
|
|
| 2570 | 2570 | } |
| 2571 | 2571 | |
| 2572 | 2572 | /** |
@@ -2574,10 +2574,10 @@ discard block |
||
| 2574 | 2574 | */ |
| 2575 | 2575 | protected function _putinfo() : void |
| 2576 | 2576 | {
|
| 2577 | - $this->metadata['Producer'] = 'FPDF '.FPDF_VERSION; |
|
| 2578 | - $this->metadata['CreationDate'] = 'D:'.@date('YmdHis');
|
|
| 2579 | - foreach($this->metadata as $key=>$value) |
|
| 2580 | - $this->_put('/'.$key.' '.$this->_textstring($value));
|
|
| 2577 | + $this->metadata['Producer'] = 'FPDF '.FPDF_VERSION; |
|
| 2578 | + $this->metadata['CreationDate'] = 'D:'.@date('YmdHis');
|
|
| 2579 | + foreach($this->metadata as $key=>$value) |
|
| 2580 | + $this->_put('/'.$key.' '.$this->_textstring($value));
|
|
| 2581 | 2581 | } |
| 2582 | 2582 | |
| 2583 | 2583 | /** |
@@ -2585,23 +2585,23 @@ discard block |
||
| 2585 | 2585 | */ |
| 2586 | 2586 | protected function _putcatalog() : void |
| 2587 | 2587 | {
|
| 2588 | - $n = $this->PageInfo[1]['n']; |
|
| 2589 | - $this->_put('/Type /Catalog');
|
|
| 2590 | - $this->_put('/Pages 1 0 R');
|
|
| 2591 | - if($this->ZoomMode=='fullpage') |
|
| 2592 | - $this->_put('/OpenAction ['.$n.' 0 R /Fit]');
|
|
| 2593 | - elseif($this->ZoomMode=='fullwidth') |
|
| 2594 | - $this->_put('/OpenAction ['.$n.' 0 R /FitH null]');
|
|
| 2595 | - elseif($this->ZoomMode=='real') |
|
| 2596 | - $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null 1]');
|
|
| 2597 | - elseif(!is_string($this->ZoomMode)) |
|
| 2598 | - $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']');
|
|
| 2599 | - if($this->LayoutMode=='single') |
|
| 2600 | - $this->_put('/PageLayout /SinglePage');
|
|
| 2601 | - elseif($this->LayoutMode=='continuous') |
|
| 2602 | - $this->_put('/PageLayout /OneColumn');
|
|
| 2603 | - elseif($this->LayoutMode=='two') |
|
| 2604 | - $this->_put('/PageLayout /TwoColumnLeft');
|
|
| 2588 | + $n = $this->PageInfo[1]['n']; |
|
| 2589 | + $this->_put('/Type /Catalog');
|
|
| 2590 | + $this->_put('/Pages 1 0 R');
|
|
| 2591 | + if($this->ZoomMode=='fullpage') |
|
| 2592 | + $this->_put('/OpenAction ['.$n.' 0 R /Fit]');
|
|
| 2593 | + elseif($this->ZoomMode=='fullwidth') |
|
| 2594 | + $this->_put('/OpenAction ['.$n.' 0 R /FitH null]');
|
|
| 2595 | + elseif($this->ZoomMode=='real') |
|
| 2596 | + $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null 1]');
|
|
| 2597 | + elseif(!is_string($this->ZoomMode)) |
|
| 2598 | + $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']');
|
|
| 2599 | + if($this->LayoutMode=='single') |
|
| 2600 | + $this->_put('/PageLayout /SinglePage');
|
|
| 2601 | + elseif($this->LayoutMode=='continuous') |
|
| 2602 | + $this->_put('/PageLayout /OneColumn');
|
|
| 2603 | + elseif($this->LayoutMode=='two') |
|
| 2604 | + $this->_put('/PageLayout /TwoColumnLeft');
|
|
| 2605 | 2605 | } |
| 2606 | 2606 | |
| 2607 | 2607 | /** |
@@ -2609,7 +2609,7 @@ discard block |
||
| 2609 | 2609 | */ |
| 2610 | 2610 | protected function _putheader() : void |
| 2611 | 2611 | {
|
| 2612 | - $this->_put('%PDF-'.$this->PDFVersion);
|
|
| 2612 | + $this->_put('%PDF-'.$this->PDFVersion);
|
|
| 2613 | 2613 | } |
| 2614 | 2614 | |
| 2615 | 2615 | /** |
@@ -2617,9 +2617,9 @@ discard block |
||
| 2617 | 2617 | */ |
| 2618 | 2618 | protected function _puttrailer() : void |
| 2619 | 2619 | {
|
| 2620 | - $this->_put('/Size '.($this->n+1));
|
|
| 2621 | - $this->_put('/Root '.$this->n.' 0 R');
|
|
| 2622 | - $this->_put('/Info '.($this->n-1).' 0 R');
|
|
| 2620 | + $this->_put('/Size '.($this->n+1));
|
|
| 2621 | + $this->_put('/Root '.$this->n.' 0 R');
|
|
| 2622 | + $this->_put('/Info '.($this->n-1).' 0 R');
|
|
| 2623 | 2623 | } |
| 2624 | 2624 | |
| 2625 | 2625 | /** |
@@ -2627,37 +2627,37 @@ discard block |
||
| 2627 | 2627 | */ |
| 2628 | 2628 | protected function _enddoc() : void |
| 2629 | 2629 | {
|
| 2630 | - $this->_putheader(); |
|
| 2631 | - $this->_putpages(); |
|
| 2632 | - $this->_putresources(); |
|
| 2633 | - // Info |
|
| 2634 | - $this->_newobj(); |
|
| 2635 | - $this->_put('<<');
|
|
| 2636 | - $this->_putinfo(); |
|
| 2637 | - $this->_put('>>');
|
|
| 2638 | - $this->_put('endobj');
|
|
| 2639 | - // Catalog |
|
| 2640 | - $this->_newobj(); |
|
| 2641 | - $this->_put('<<');
|
|
| 2642 | - $this->_putcatalog(); |
|
| 2643 | - $this->_put('>>');
|
|
| 2644 | - $this->_put('endobj');
|
|
| 2645 | - // Cross-ref |
|
| 2646 | - $offset = $this->_getoffset(); |
|
| 2647 | - $this->_put('xref');
|
|
| 2648 | - $this->_put('0 '.($this->n+1));
|
|
| 2649 | - $this->_put('0000000000 65535 f ');
|
|
| 2650 | - for($i=1;$i<=$this->n;$i++) |
|
| 2651 | - $this->_put(sprintf('%010d 00000 n ',$this->offsets[$i]));
|
|
| 2652 | - // Trailer |
|
| 2653 | - $this->_put('trailer');
|
|
| 2654 | - $this->_put('<<');
|
|
| 2655 | - $this->_puttrailer(); |
|
| 2656 | - $this->_put('>>');
|
|
| 2657 | - $this->_put('startxref');
|
|
| 2658 | - $this->_put(strval($offset)); |
|
| 2659 | - $this->_put('%%EOF');
|
|
| 2660 | - $this->state = 3; |
|
| 2630 | + $this->_putheader(); |
|
| 2631 | + $this->_putpages(); |
|
| 2632 | + $this->_putresources(); |
|
| 2633 | + // Info |
|
| 2634 | + $this->_newobj(); |
|
| 2635 | + $this->_put('<<');
|
|
| 2636 | + $this->_putinfo(); |
|
| 2637 | + $this->_put('>>');
|
|
| 2638 | + $this->_put('endobj');
|
|
| 2639 | + // Catalog |
|
| 2640 | + $this->_newobj(); |
|
| 2641 | + $this->_put('<<');
|
|
| 2642 | + $this->_putcatalog(); |
|
| 2643 | + $this->_put('>>');
|
|
| 2644 | + $this->_put('endobj');
|
|
| 2645 | + // Cross-ref |
|
| 2646 | + $offset = $this->_getoffset(); |
|
| 2647 | + $this->_put('xref');
|
|
| 2648 | + $this->_put('0 '.($this->n+1));
|
|
| 2649 | + $this->_put('0000000000 65535 f ');
|
|
| 2650 | + for($i=1;$i<=$this->n;$i++) |
|
| 2651 | + $this->_put(sprintf('%010d 00000 n ',$this->offsets[$i]));
|
|
| 2652 | + // Trailer |
|
| 2653 | + $this->_put('trailer');
|
|
| 2654 | + $this->_put('<<');
|
|
| 2655 | + $this->_puttrailer(); |
|
| 2656 | + $this->_put('>>');
|
|
| 2657 | + $this->_put('startxref');
|
|
| 2658 | + $this->_put(strval($offset)); |
|
| 2659 | + $this->_put('%%EOF');
|
|
| 2660 | + $this->state = 3; |
|
| 2661 | 2661 | } |
| 2662 | 2662 | } |
| 2663 | 2663 | ?> |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * http://www.fpdf.org/en/doc/index.php |
| 25 | 25 | *******************************************************************************/ |
| 26 | 26 | |
| 27 | -define('FPDF_VERSION','1.82');
|
|
| 27 | +define('FPDF_VERSION', '1.82');
|
|
| 28 | 28 | |
| 29 | 29 | class FPDF |
| 30 | 30 | {
|
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * or an array containing the width and the height (expressed in the unit given by unit). <br/> |
| 174 | 174 | * Default value is 'A4'. |
| 175 | 175 | */ |
| 176 | - public function __construct(string $orientation='P', string $unit='mm', $size='A4') |
|
| 176 | + public function __construct(string $orientation = 'P', string $unit = 'mm', $size = 'A4') |
|
| 177 | 177 | {
|
| 178 | 178 | // Some checks |
| 179 | 179 | $this->_dochecks(); |
@@ -204,65 +204,65 @@ discard block |
||
| 204 | 204 | $this->WithAlpha = false; |
| 205 | 205 | $this->ws = 0; |
| 206 | 206 | // Font path |
| 207 | - if(defined('FPDF_FONTPATH'))
|
|
| 207 | + if (defined('FPDF_FONTPATH'))
|
|
| 208 | 208 | {
|
| 209 | 209 | $this->fontpath = FPDF_FONTPATH; |
| 210 | - if(substr($this->fontpath,-1)!='/' && substr($this->fontpath,-1)!='\\') |
|
| 210 | + if (substr($this->fontpath, -1) != '/' && substr($this->fontpath, -1) != '\\') |
|
| 211 | 211 | $this->fontpath .= '/'; |
| 212 | 212 | } |
| 213 | - elseif(is_dir(dirname(__FILE__).'/font')) |
|
| 214 | - $this->fontpath = dirname(__FILE__).'/font/'; |
|
| 213 | + elseif (is_dir(dirname(__FILE__) . '/font')) |
|
| 214 | + $this->fontpath = dirname(__FILE__) . '/font/'; |
|
| 215 | 215 | else |
| 216 | 216 | $this->fontpath = ''; |
| 217 | 217 | // Core fonts |
| 218 | 218 | $this->CoreFonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats');
|
| 219 | 219 | // Scale factor |
| 220 | - if($unit=='pt') |
|
| 220 | + if ($unit == 'pt') |
|
| 221 | 221 | $this->k = 1; |
| 222 | - elseif($unit=='mm') |
|
| 223 | - $this->k = 72/25.4; |
|
| 224 | - elseif($unit=='cm') |
|
| 225 | - $this->k = 72/2.54; |
|
| 226 | - elseif($unit=='in') |
|
| 222 | + elseif ($unit == 'mm') |
|
| 223 | + $this->k = 72 / 25.4; |
|
| 224 | + elseif ($unit == 'cm') |
|
| 225 | + $this->k = 72 / 2.54; |
|
| 226 | + elseif ($unit == 'in') |
|
| 227 | 227 | $this->k = 72; |
| 228 | 228 | else |
| 229 | - $this->Error('Incorrect unit: '.$unit);
|
|
| 229 | + $this->Error('Incorrect unit: ' . $unit);
|
|
| 230 | 230 | // Page sizes |
| 231 | - $this->StdPageSizes = array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
|
|
| 232 | - 'letter'=>array(612,792), 'legal'=>array(612,1008)); |
|
| 231 | + $this->StdPageSizes = array('a3'=>array(841.89, 1190.55), 'a4'=>array(595.28, 841.89), 'a5'=>array(420.94, 595.28),
|
|
| 232 | + 'letter'=>array(612, 792), 'legal'=>array(612, 1008)); |
|
| 233 | 233 | $size = $this->_getpagesize($size); |
| 234 | 234 | $this->DefPageSize = $size; |
| 235 | 235 | $this->CurPageSize = $size; |
| 236 | 236 | // Page orientation |
| 237 | 237 | $orientation = strtolower($orientation); |
| 238 | - if($orientation=='p' || $orientation=='portrait') |
|
| 238 | + if ($orientation == 'p' || $orientation == 'portrait') |
|
| 239 | 239 | {
|
| 240 | 240 | $this->DefOrientation = 'P'; |
| 241 | 241 | $this->w = $size[0]; |
| 242 | 242 | $this->h = $size[1]; |
| 243 | 243 | } |
| 244 | - elseif($orientation=='l' || $orientation=='landscape') |
|
| 244 | + elseif ($orientation == 'l' || $orientation == 'landscape') |
|
| 245 | 245 | {
|
| 246 | 246 | $this->DefOrientation = 'L'; |
| 247 | 247 | $this->w = $size[1]; |
| 248 | 248 | $this->h = $size[0]; |
| 249 | 249 | } |
| 250 | 250 | else |
| 251 | - $this->Error('Incorrect orientation: '.$orientation);
|
|
| 251 | + $this->Error('Incorrect orientation: ' . $orientation);
|
|
| 252 | 252 | $this->CurOrientation = $this->DefOrientation; |
| 253 | - $this->wPt = $this->w*$this->k; |
|
| 254 | - $this->hPt = $this->h*$this->k; |
|
| 253 | + $this->wPt = $this->w * $this->k; |
|
| 254 | + $this->hPt = $this->h * $this->k; |
|
| 255 | 255 | // Page rotation |
| 256 | 256 | $this->CurRotation = 0; |
| 257 | 257 | // Page margins (1 cm) |
| 258 | - $margin = 28.35/$this->k; |
|
| 259 | - $this->setMargins($margin,$margin); |
|
| 258 | + $margin = 28.35 / $this->k; |
|
| 259 | + $this->setMargins($margin, $margin); |
|
| 260 | 260 | // Interior cell margin (1 mm) |
| 261 | - $this->cMargin = $margin/10; |
|
| 261 | + $this->cMargin = $margin / 10; |
|
| 262 | 262 | // Line width (0.2 mm) |
| 263 | - $this->LineWidth = .567/$this->k; |
|
| 263 | + $this->LineWidth = .567 / $this->k; |
|
| 264 | 264 | // Automatic page break |
| 265 | - $this->setAutoPageBreak(true,2*$margin); |
|
| 265 | + $this->setAutoPageBreak(true, 2 * $margin); |
|
| 266 | 266 | // Default display mode |
| 267 | 267 | $this->setDisplayMode('default');
|
| 268 | 268 | // Enable compression |
@@ -278,12 +278,12 @@ discard block |
||
| 278 | 278 | * @param float $top Top margin. |
| 279 | 279 | * @param float $right Right margin. Default value is the left one. |
| 280 | 280 | */ |
| 281 | - public function SetMargins(float $left, float $top, ?float $right=null) : void |
|
| 281 | + public function SetMargins(float $left, float $top, ?float $right = null) : void |
|
| 282 | 282 | {
|
| 283 | 283 | // Set left, top and right margins |
| 284 | 284 | $this->lMargin = $left; |
| 285 | 285 | $this->tMargin = $top; |
| 286 | - if($right===null) |
|
| 286 | + if ($right === null) |
|
| 287 | 287 | $right = $left; |
| 288 | 288 | $this->rMargin = $right; |
| 289 | 289 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | {
|
| 299 | 299 | // Set left margin |
| 300 | 300 | $this->lMargin = $margin; |
| 301 | - if($this->page>0 && $this->x<$margin) |
|
| 301 | + if ($this->page > 0 && $this->x < $margin) |
|
| 302 | 302 | $this->x = $margin; |
| 303 | 303 | } |
| 304 | 304 | |
@@ -332,12 +332,12 @@ discard block |
||
| 332 | 332 | * @param bool $auto indicating if mode should be on or off. |
| 333 | 333 | * @param float $margin Distance from the bottom of the page. |
| 334 | 334 | */ |
| 335 | - public function SetAutoPageBreak(bool $auto, float $margin=0) : void |
|
| 335 | + public function SetAutoPageBreak(bool $auto, float $margin = 0) : void |
|
| 336 | 336 | {
|
| 337 | 337 | // Set auto page break mode and triggering margin |
| 338 | 338 | $this->AutoPageBreak = $auto; |
| 339 | 339 | $this->bMargin = $margin; |
| 340 | - $this->PageBreakTrigger = $this->h-$margin; |
|
| 340 | + $this->PageBreakTrigger = $this->h - $margin; |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /** |
@@ -368,17 +368,17 @@ discard block |
||
| 368 | 368 | * <li> 'defaul't: uses viewer default mode </li></ul> |
| 369 | 369 | * Default value is default. |
| 370 | 370 | */ |
| 371 | - public function SetDisplayMode($zoom, string $layout='default') : void |
|
| 371 | + public function SetDisplayMode($zoom, string $layout = 'default') : void |
|
| 372 | 372 | {
|
| 373 | 373 | // Set display mode in viewer |
| 374 | - if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) |
|
| 374 | + if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom)) |
|
| 375 | 375 | $this->ZoomMode = $zoom; |
| 376 | 376 | else |
| 377 | - $this->Error('Incorrect zoom display mode: '.$zoom);
|
|
| 378 | - if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') |
|
| 377 | + $this->Error('Incorrect zoom display mode: ' . $zoom);
|
|
| 378 | + if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default') |
|
| 379 | 379 | $this->LayoutMode = $layout; |
| 380 | 380 | else |
| 381 | - $this->Error('Incorrect layout display mode: '.$layout);
|
|
| 381 | + $this->Error('Incorrect layout display mode: ' . $layout);
|
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | /** |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | public function SetCompression(bool $compress) : void |
| 394 | 394 | {
|
| 395 | 395 | // Set page compression |
| 396 | - if(function_exists('gzcompress'))
|
|
| 396 | + if (function_exists('gzcompress'))
|
|
| 397 | 397 | $this->compress = $compress; |
| 398 | 398 | else |
| 399 | 399 | $this->compress = false; |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | * @param string $title The title. |
| 405 | 405 | * @param bool $isUTF8 Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true). Default value: false. |
| 406 | 406 | */ |
| 407 | - public function SetTitle(string $title, bool $isUTF8=false) : void |
|
| 407 | + public function SetTitle(string $title, bool $isUTF8 = false) : void |
|
| 408 | 408 | {
|
| 409 | 409 | // Title of document |
| 410 | 410 | $this->metadata['Title'] = $isUTF8 ? $title : utf8_encode($title); |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | * @param string $author |
| 416 | 416 | * @param bool $isUTF8 Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true). Default value: false. |
| 417 | 417 | */ |
| 418 | - public function SetAuthor(string $author, bool $isUTF8=false) : void |
|
| 418 | + public function SetAuthor(string $author, bool $isUTF8 = false) : void |
|
| 419 | 419 | {
|
| 420 | 420 | // Author of document |
| 421 | 421 | $this->metadata['Author'] = $isUTF8 ? $author : utf8_encode($author); |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | * @param string $subject |
| 427 | 427 | * @param bool $isUTF8 Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true). Default value: false. |
| 428 | 428 | */ |
| 429 | - public function SetSubject(string $subject, bool $isUTF8=false) : void |
|
| 429 | + public function SetSubject(string $subject, bool $isUTF8 = false) : void |
|
| 430 | 430 | {
|
| 431 | 431 | // Subject of document |
| 432 | 432 | $this->metadata['Subject'] = $isUTF8 ? $subject : utf8_encode($subject); |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | * @param string $keywords |
| 438 | 438 | * @param bool $isUTF8 Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true). Default value: false. |
| 439 | 439 | */ |
| 440 | - public function SetKeywords(string $keywords, bool $isUTF8=false) : void |
|
| 440 | + public function SetKeywords(string $keywords, bool $isUTF8 = false) : void |
|
| 441 | 441 | {
|
| 442 | 442 | // Keywords of document |
| 443 | 443 | $this->metadata['Keywords'] = $isUTF8 ? $keywords : utf8_encode($keywords); |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | * @param string $creator |
| 449 | 449 | * @param bool $isUTF8 Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true). Default value: false. |
| 450 | 450 | */ |
| 451 | - public function SetCreator(string $creator, bool $isUTF8=false) : void |
|
| 451 | + public function SetCreator(string $creator, bool $isUTF8 = false) : void |
|
| 452 | 452 | {
|
| 453 | 453 | // Creator of document |
| 454 | 454 | $this->metadata['Creator'] = $isUTF8 ? $creator : utf8_encode($creator); |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | * Defines an alias for the total number of pages. It will be substituted as the document is closed. |
| 459 | 459 | * @param string $alias The alias. Default value: {nb}.
|
| 460 | 460 | */ |
| 461 | - public function AliasNbPages(string $alias='{nb}') : void
|
|
| 461 | + public function AliasNbPages(string $alias = '{nb}') : void
|
|
| 462 | 462 | {
|
| 463 | 463 | // Define an alias for total number of pages |
| 464 | 464 | $this->AliasNbPages = $alias; |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | public function Error(string $msg) : void |
| 476 | 476 | {
|
| 477 | 477 | // Fatal error |
| 478 | - throw new \Exception('FPDF error: '.$msg);
|
|
| 478 | + throw new \Exception('FPDF error: ' . $msg);
|
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | /** |
@@ -487,9 +487,9 @@ discard block |
||
| 487 | 487 | public function Close() : void |
| 488 | 488 | {
|
| 489 | 489 | // Terminate document |
| 490 | - if($this->state==3) |
|
| 490 | + if ($this->state == 3) |
|
| 491 | 491 | return; |
| 492 | - if($this->page==0) |
|
| 492 | + if ($this->page == 0) |
|
| 493 | 493 | $this->addPage(); |
| 494 | 494 | // Page footer |
| 495 | 495 | $this->InFooter = true; |
@@ -529,20 +529,20 @@ discard block |
||
| 529 | 529 | * It must be a multiple of 90; positive values mean clockwise rotation. </br> |
| 530 | 530 | * The default value is 0. |
| 531 | 531 | */ |
| 532 | - public function AddPage(string $orientation='', $size='', int $rotation=0) : void |
|
| 532 | + public function AddPage(string $orientation = '', $size = '', int $rotation = 0) : void |
|
| 533 | 533 | {
|
| 534 | 534 | // Start a new page |
| 535 | - if($this->state==3) |
|
| 535 | + if ($this->state == 3) |
|
| 536 | 536 | $this->Error('The document is closed');
|
| 537 | 537 | $family = $this->FontFamily; |
| 538 | - $style = $this->FontStyle.($this->underline ? 'U' : ''); |
|
| 538 | + $style = $this->FontStyle . ($this->underline ? 'U' : ''); |
|
| 539 | 539 | $fontsize = $this->FontSizePt; |
| 540 | 540 | $lw = $this->LineWidth; |
| 541 | 541 | $dc = $this->DrawColor; |
| 542 | 542 | $fc = $this->FillColor; |
| 543 | 543 | $tc = $this->TextColor; |
| 544 | 544 | $cf = $this->ColorFlag; |
| 545 | - if($this->page>0) |
|
| 545 | + if ($this->page > 0) |
|
| 546 | 546 | {
|
| 547 | 547 | // Page footer |
| 548 | 548 | $this->InFooter = true; |
@@ -552,21 +552,21 @@ discard block |
||
| 552 | 552 | $this->_endpage(); |
| 553 | 553 | } |
| 554 | 554 | // Start new page |
| 555 | - $this->_beginpage($orientation,$size,$rotation); |
|
| 555 | + $this->_beginpage($orientation, $size, $rotation); |
|
| 556 | 556 | // Set line cap style to square |
| 557 | 557 | $this->_out('2 J');
|
| 558 | 558 | // Set line width |
| 559 | 559 | $this->LineWidth = $lw; |
| 560 | - $this->_out(sprintf('%.2F w',$lw*$this->k));
|
|
| 560 | + $this->_out(sprintf('%.2F w', $lw * $this->k));
|
|
| 561 | 561 | // Set font |
| 562 | - if($family) |
|
| 563 | - $this->setFont($family,$style,$fontsize); |
|
| 562 | + if ($family) |
|
| 563 | + $this->setFont($family, $style, $fontsize); |
|
| 564 | 564 | // Set colors |
| 565 | 565 | $this->DrawColor = $dc; |
| 566 | - if($dc!='0 G') |
|
| 566 | + if ($dc != '0 G') |
|
| 567 | 567 | $this->_out($dc); |
| 568 | 568 | $this->FillColor = $fc; |
| 569 | - if($fc!='0 g') |
|
| 569 | + if ($fc != '0 g') |
|
| 570 | 570 | $this->_out($fc); |
| 571 | 571 | $this->TextColor = $tc; |
| 572 | 572 | $this->ColorFlag = $cf; |
@@ -575,21 +575,21 @@ discard block |
||
| 575 | 575 | $this->Header(); |
| 576 | 576 | $this->InHeader = false; |
| 577 | 577 | // Restore line width |
| 578 | - if($this->LineWidth!=$lw) |
|
| 578 | + if ($this->LineWidth != $lw) |
|
| 579 | 579 | {
|
| 580 | 580 | $this->LineWidth = $lw; |
| 581 | - $this->_out(sprintf('%.2F w',$lw*$this->k));
|
|
| 581 | + $this->_out(sprintf('%.2F w', $lw * $this->k));
|
|
| 582 | 582 | } |
| 583 | 583 | // Restore font |
| 584 | - if($family) |
|
| 585 | - $this->setFont($family,$style,$fontsize); |
|
| 584 | + if ($family) |
|
| 585 | + $this->setFont($family, $style, $fontsize); |
|
| 586 | 586 | // Restore colors |
| 587 | - if($this->DrawColor!=$dc) |
|
| 587 | + if ($this->DrawColor != $dc) |
|
| 588 | 588 | {
|
| 589 | 589 | $this->DrawColor = $dc; |
| 590 | 590 | $this->_out($dc); |
| 591 | 591 | } |
| 592 | - if($this->FillColor!=$fc) |
|
| 592 | + if ($this->FillColor != $fc) |
|
| 593 | 593 | {
|
| 594 | 594 | $this->FillColor = $fc; |
| 595 | 595 | $this->_out($fc); |
@@ -638,14 +638,14 @@ discard block |
||
| 638 | 638 | * @param int $g Green component (between 0 and 255). |
| 639 | 639 | * @param int $b Blue component (between 0 and 255). |
| 640 | 640 | */ |
| 641 | - public function SetDrawColor(int $r, ?int $g=null, ?int $b=null) : void |
|
| 641 | + public function SetDrawColor(int $r, ?int $g = null, ?int $b = null) : void |
|
| 642 | 642 | {
|
| 643 | 643 | // Set color for all stroking operations |
| 644 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 645 | - $this->DrawColor = sprintf('%.3F G',$r/255);
|
|
| 644 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) |
|
| 645 | + $this->DrawColor = sprintf('%.3F G', $r / 255);
|
|
| 646 | 646 | else |
| 647 | - $this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
|
|
| 648 | - if($this->page>0) |
|
| 647 | + $this->DrawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255);
|
|
| 648 | + if ($this->page > 0) |
|
| 649 | 649 | $this->_out($this->DrawColor); |
| 650 | 650 | } |
| 651 | 651 | |
@@ -657,15 +657,15 @@ discard block |
||
| 657 | 657 | * @param int $g Green component (between 0 and 255). |
| 658 | 658 | * @param int $b Blue component (between 0 and 255). |
| 659 | 659 | */ |
| 660 | - public function SetFillColor(int $r, ?int $g=null, ?int $b=null) : void |
|
| 660 | + public function SetFillColor(int $r, ?int $g = null, ?int $b = null) : void |
|
| 661 | 661 | {
|
| 662 | 662 | // Set color for all filling operations |
| 663 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 664 | - $this->FillColor = sprintf('%.3F g',$r/255);
|
|
| 663 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) |
|
| 664 | + $this->FillColor = sprintf('%.3F g', $r / 255);
|
|
| 665 | 665 | else |
| 666 | - $this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
|
| 667 | - $this->ColorFlag = ($this->FillColor!=$this->TextColor); |
|
| 668 | - if($this->page>0) |
|
| 666 | + $this->FillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
|
|
| 667 | + $this->ColorFlag = ($this->FillColor != $this->TextColor); |
|
| 668 | + if ($this->page > 0) |
|
| 669 | 669 | $this->_out($this->FillColor); |
| 670 | 670 | } |
| 671 | 671 | |
@@ -677,14 +677,14 @@ discard block |
||
| 677 | 677 | * @param int $g Green component (between 0 and 255). |
| 678 | 678 | * @param int $b Blue component (between 0 and 255). |
| 679 | 679 | */ |
| 680 | - public function SetTextColor(int $r, ?int $g=null, ?int $b=null) : void |
|
| 680 | + public function SetTextColor(int $r, ?int $g = null, ?int $b = null) : void |
|
| 681 | 681 | {
|
| 682 | 682 | // Set color for text |
| 683 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 684 | - $this->TextColor = sprintf('%.3F g',$r/255);
|
|
| 683 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) |
|
| 684 | + $this->TextColor = sprintf('%.3F g', $r / 255);
|
|
| 685 | 685 | else |
| 686 | - $this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
|
| 687 | - $this->ColorFlag = ($this->FillColor!=$this->TextColor); |
|
| 686 | + $this->TextColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
|
|
| 687 | + $this->ColorFlag = ($this->FillColor != $this->TextColor); |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | /** |
@@ -696,13 +696,13 @@ discard block |
||
| 696 | 696 | public function GetStringWidth(string $s) : float |
| 697 | 697 | {
|
| 698 | 698 | // Get width of a string in the current font |
| 699 | - $s = (string)$s; |
|
| 699 | + $s = (string) $s; |
|
| 700 | 700 | $cw = &$this->CurrentFont['cw']; |
| 701 | 701 | $w = 0; |
| 702 | 702 | $l = strlen($s); |
| 703 | - for($i=0;$i<$l;$i++) |
|
| 703 | + for ($i = 0; $i < $l; $i++) |
|
| 704 | 704 | $w += $cw[$s[$i]]; |
| 705 | - return $w*$this->FontSize/1000; |
|
| 705 | + return $w * $this->FontSize / 1000; |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | /** |
@@ -715,8 +715,8 @@ discard block |
||
| 715 | 715 | {
|
| 716 | 716 | // Set line width |
| 717 | 717 | $this->LineWidth = $width; |
| 718 | - if($this->page>0) |
|
| 719 | - $this->_out(sprintf('%.2F w',$width*$this->k));
|
|
| 718 | + if ($this->page > 0) |
|
| 719 | + $this->_out(sprintf('%.2F w', $width * $this->k));
|
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | /** |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | public function Line(float $x1, float $y1, float $x2, float $y2) : void |
| 732 | 732 | {
|
| 733 | 733 | // Draw a line |
| 734 | - $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));
|
|
| 734 | + $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S', $x1 * $this->k, ($this->h - $y1) * $this->k, $x2 * $this->k, ($this->h - $y2) * $this->k));
|
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | /** |
@@ -749,16 +749,16 @@ discard block |
||
| 749 | 749 | * <li> 'F': fill. </li> |
| 750 | 750 | * <li> 'DF' or 'FD': draw the shape and fill. </li></ul> |
| 751 | 751 | */ |
| 752 | - public function Rect(float $x, float $y, float $w, float $h, string $style='') : void |
|
| 752 | + public function Rect(float $x, float $y, float $w, float $h, string $style = '') : void |
|
| 753 | 753 | {
|
| 754 | 754 | // Draw a rectangle |
| 755 | - if($style=='F') |
|
| 755 | + if ($style == 'F') |
|
| 756 | 756 | $op = 'f'; |
| 757 | - elseif($style=='FD' || $style=='DF') |
|
| 757 | + elseif ($style == 'FD' || $style == 'DF') |
|
| 758 | 758 | $op = 'B'; |
| 759 | 759 | else |
| 760 | 760 | $op = 'S'; |
| 761 | - $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
|
|
| 761 | + $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s', $x * $this->k, ($this->h - $y) * $this->k, $w * $this->k, -$h * $this->k, $op));
|
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | /** |
@@ -778,24 +778,24 @@ discard block |
||
| 778 | 778 | * @param string $file The font definition file. <br/> |
| 779 | 779 | * By default, the name is built from the family and style, in lower case with no space. |
| 780 | 780 | */ |
| 781 | - public function AddFont(string $family, string $style='', string $file='') : void |
|
| 781 | + public function AddFont(string $family, string $style = '', string $file = '') : void |
|
| 782 | 782 | {
|
| 783 | 783 | // Add a TrueType, OpenType or Type1 font |
| 784 | 784 | $family = strtolower($family); |
| 785 | - if($file=='') |
|
| 786 | - $file = str_replace(' ','',$family).strtolower($style).'.php';
|
|
| 785 | + if ($file == '') |
|
| 786 | + $file = str_replace(' ', '', $family) . strtolower($style) . '.php';
|
|
| 787 | 787 | $style = strtoupper($style); |
| 788 | - if($style=='IB') |
|
| 788 | + if ($style == 'IB') |
|
| 789 | 789 | $style = 'BI'; |
| 790 | - $fontkey = $family.$style; |
|
| 791 | - if(isset($this->fonts[$fontkey])) |
|
| 790 | + $fontkey = $family . $style; |
|
| 791 | + if (isset($this->fonts[$fontkey])) |
|
| 792 | 792 | return; |
| 793 | 793 | $info = $this->_loadfont($file); |
| 794 | - $info['i'] = count($this->fonts)+1; |
|
| 795 | - if(!empty($info['file'])) |
|
| 794 | + $info['i'] = count($this->fonts) + 1; |
|
| 795 | + if (!empty($info['file'])) |
|
| 796 | 796 | {
|
| 797 | 797 | // Embedded font |
| 798 | - if($info['type']=='TrueType') |
|
| 798 | + if ($info['type'] == 'TrueType') |
|
| 799 | 799 | $this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']);
|
| 800 | 800 | else |
| 801 | 801 | $this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']);
|
@@ -838,54 +838,54 @@ discard block |
||
| 838 | 838 | * The default value is the current size. <br/> |
| 839 | 839 | * If no size has been specified since the beginning of the document, the value taken is 12. |
| 840 | 840 | */ |
| 841 | - public function SetFont(string $family, string $style='', float $size=0) : void |
|
| 841 | + public function SetFont(string $family, string $style = '', float $size = 0) : void |
|
| 842 | 842 | {
|
| 843 | 843 | // Select a font; size given in points |
| 844 | - if($family=='') |
|
| 844 | + if ($family == '') |
|
| 845 | 845 | $family = $this->FontFamily; |
| 846 | 846 | else |
| 847 | 847 | $family = strtolower($family); |
| 848 | 848 | $style = strtoupper($style); |
| 849 | - if(strpos($style,'U')!==false) |
|
| 849 | + if (strpos($style, 'U') !== false) |
|
| 850 | 850 | {
|
| 851 | 851 | $this->underline = true; |
| 852 | - $style = str_replace('U','',$style);
|
|
| 852 | + $style = str_replace('U', '', $style);
|
|
| 853 | 853 | } |
| 854 | 854 | else |
| 855 | 855 | $this->underline = false; |
| 856 | - if($style=='IB') |
|
| 856 | + if ($style == 'IB') |
|
| 857 | 857 | $style = 'BI'; |
| 858 | - if($size==0) |
|
| 858 | + if ($size == 0) |
|
| 859 | 859 | $size = $this->FontSizePt; |
| 860 | 860 | // Test if font is already selected |
| 861 | - if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) |
|
| 861 | + if ($this->FontFamily == $family && $this->FontStyle == $style && $this->FontSizePt == $size) |
|
| 862 | 862 | return; |
| 863 | 863 | // Test if font is already loaded |
| 864 | - $fontkey = $family.$style; |
|
| 865 | - if(!isset($this->fonts[$fontkey])) |
|
| 864 | + $fontkey = $family . $style; |
|
| 865 | + if (!isset($this->fonts[$fontkey])) |
|
| 866 | 866 | {
|
| 867 | 867 | // Test if one of the core fonts |
| 868 | - if($family=='arial') |
|
| 868 | + if ($family == 'arial') |
|
| 869 | 869 | $family = 'helvetica'; |
| 870 | - if(in_array($family,$this->CoreFonts)) |
|
| 870 | + if (in_array($family, $this->CoreFonts)) |
|
| 871 | 871 | {
|
| 872 | - if($family=='symbol' || $family=='zapfdingbats') |
|
| 872 | + if ($family == 'symbol' || $family == 'zapfdingbats') |
|
| 873 | 873 | $style = ''; |
| 874 | - $fontkey = $family.$style; |
|
| 875 | - if(!isset($this->fonts[$fontkey])) |
|
| 876 | - $this->addFont($family,$style); |
|
| 874 | + $fontkey = $family . $style; |
|
| 875 | + if (!isset($this->fonts[$fontkey])) |
|
| 876 | + $this->addFont($family, $style); |
|
| 877 | 877 | } |
| 878 | 878 | else |
| 879 | - $this->Error('Undefined font: '.$family.' '.$style);
|
|
| 879 | + $this->Error('Undefined font: ' . $family . ' ' . $style);
|
|
| 880 | 880 | } |
| 881 | 881 | // Select it |
| 882 | 882 | $this->FontFamily = $family; |
| 883 | 883 | $this->FontStyle = $style; |
| 884 | 884 | $this->FontSizePt = $size; |
| 885 | - $this->FontSize = $size/$this->k; |
|
| 885 | + $this->FontSize = $size / $this->k; |
|
| 886 | 886 | $this->CurrentFont = &$this->fonts[$fontkey]; |
| 887 | - if($this->page>0) |
|
| 888 | - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
|
| 887 | + if ($this->page > 0) |
|
| 888 | + $this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
|
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | /** |
@@ -895,12 +895,12 @@ discard block |
||
| 895 | 895 | public function SetFontSize(float $size) : void |
| 896 | 896 | {
|
| 897 | 897 | // Set font size in points |
| 898 | - if($this->FontSizePt==$size) |
|
| 898 | + if ($this->FontSizePt == $size) |
|
| 899 | 899 | return; |
| 900 | 900 | $this->FontSizePt = $size; |
| 901 | - $this->FontSize = $size/$this->k; |
|
| 902 | - if($this->page>0) |
|
| 903 | - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
|
| 901 | + $this->FontSize = $size / $this->k; |
|
| 902 | + if ($this->page > 0) |
|
| 903 | + $this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
|
|
| 904 | 904 | } |
| 905 | 905 | |
| 906 | 906 | /** |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | public function AddLink() : int |
| 914 | 914 | {
|
| 915 | 915 | // Create a new internal link |
| 916 | - $n = count($this->links)+1; |
|
| 916 | + $n = count($this->links) + 1; |
|
| 917 | 917 | $this->links[$n] = array(0, 0); |
| 918 | 918 | return $n; |
| 919 | 919 | } |
@@ -924,12 +924,12 @@ discard block |
||
| 924 | 924 | * @param float $y Y-position of target position; -1 indicates the current position. The default value is 0 (top of page). |
| 925 | 925 | * @param int $page Number of target page; -1 indicates the current page. This is the default value. |
| 926 | 926 | */ |
| 927 | - public function SetLink(int $link, float $y=0, int $page=-1) : void |
|
| 927 | + public function SetLink(int $link, float $y = 0, int $page = -1) : void |
|
| 928 | 928 | {
|
| 929 | 929 | // Set destination of internal link |
| 930 | - if($y==-1) |
|
| 930 | + if ($y == -1) |
|
| 931 | 931 | $y = $this->y; |
| 932 | - if($page==-1) |
|
| 932 | + if ($page == -1) |
|
| 933 | 933 | $page = $this->page; |
| 934 | 934 | $this->links[$link] = array($page, $y); |
| 935 | 935 | } |
@@ -948,7 +948,7 @@ discard block |
||
| 948 | 948 | public function Link(float $x, float $y, float $w, float $h, $link) : void |
| 949 | 949 | {
|
| 950 | 950 | // Put a link on the page |
| 951 | - $this->PageLinks[$this->page][] = array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link); |
|
| 951 | + $this->PageLinks[$this->page][] = array($x * $this->k, $this->hPt - $y * $this->k, $w * $this->k, $h * $this->k, $link); |
|
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | /** |
@@ -964,13 +964,13 @@ discard block |
||
| 964 | 964 | public function Text(float $x, float $y, string $txt) : void |
| 965 | 965 | {
|
| 966 | 966 | // Output a string |
| 967 | - if(!isset($this->CurrentFont)) |
|
| 967 | + if (!isset($this->CurrentFont)) |
|
| 968 | 968 | $this->Error('No font has been set');
|
| 969 | - $s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
|
|
| 970 | - if($this->underline && $txt!='') |
|
| 971 | - $s .= ' '.$this->_dounderline($x,$y,$txt); |
|
| 972 | - if($this->ColorFlag) |
|
| 973 | - $s = 'q '.$this->TextColor.' '.$s.' Q'; |
|
| 969 | + $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt));
|
|
| 970 | + if ($this->underline && $txt != '') |
|
| 971 | + $s .= ' ' . $this->_dounderline($x, $y, $txt); |
|
| 972 | + if ($this->ColorFlag) |
|
| 973 | + $s = 'q ' . $this->TextColor . ' ' . $s . ' Q'; |
|
| 974 | 974 | $this->_out($s); |
| 975 | 975 | } |
| 976 | 976 | |
@@ -1028,80 +1028,80 @@ discard block |
||
| 1028 | 1028 | * Default value: false. <br/> |
| 1029 | 1029 | * @param string|int $link URL or identifier for internal link created by AddLink(). |
| 1030 | 1030 | */ |
| 1031 | - public function Cell(float $w, float $h=0, string $txt='', $border=0, float $ln=0, $align='', $fill=false, $link='') : void |
|
| 1031 | + public function Cell(float $w, float $h = 0, string $txt = '', $border = 0, float $ln = 0, $align = '', $fill = false, $link = '') : void |
|
| 1032 | 1032 | {
|
| 1033 | 1033 | // Output a cell |
| 1034 | 1034 | $k = $this->k; |
| 1035 | - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
| 1035 | + if ($this->y + $h > $this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
| 1036 | 1036 | {
|
| 1037 | 1037 | // Automatic page break |
| 1038 | 1038 | $x = $this->x; |
| 1039 | 1039 | $ws = $this->ws; |
| 1040 | - if($ws>0) |
|
| 1040 | + if ($ws > 0) |
|
| 1041 | 1041 | {
|
| 1042 | 1042 | $this->ws = 0; |
| 1043 | 1043 | $this->_out('0 Tw');
|
| 1044 | 1044 | } |
| 1045 | - $this->addPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation); |
|
| 1045 | + $this->addPage($this->CurOrientation, $this->CurPageSize, $this->CurRotation); |
|
| 1046 | 1046 | $this->x = $x; |
| 1047 | - if($ws>0) |
|
| 1047 | + if ($ws > 0) |
|
| 1048 | 1048 | {
|
| 1049 | 1049 | $this->ws = $ws; |
| 1050 | - $this->_out(sprintf('%.3F Tw',$ws*$k));
|
|
| 1050 | + $this->_out(sprintf('%.3F Tw', $ws * $k));
|
|
| 1051 | 1051 | } |
| 1052 | 1052 | } |
| 1053 | - if($w==0) |
|
| 1054 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1053 | + if ($w == 0) |
|
| 1054 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 1055 | 1055 | $s = ''; |
| 1056 | - if($fill || $border==1) |
|
| 1056 | + if ($fill || $border == 1) |
|
| 1057 | 1057 | {
|
| 1058 | - if($fill) |
|
| 1059 | - $op = ($border==1) ? 'B' : 'f'; |
|
| 1058 | + if ($fill) |
|
| 1059 | + $op = ($border == 1) ? 'B' : 'f'; |
|
| 1060 | 1060 | else |
| 1061 | 1061 | $op = 'S'; |
| 1062 | - $s = sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
|
|
| 1062 | + $s = sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op);
|
|
| 1063 | 1063 | } |
| 1064 | - if(is_string($border)) |
|
| 1064 | + if (is_string($border)) |
|
| 1065 | 1065 | {
|
| 1066 | 1066 | $x = $this->x; |
| 1067 | 1067 | $y = $this->y; |
| 1068 | - if(strpos($border,'L')!==false) |
|
| 1069 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
|
|
| 1070 | - if(strpos($border,'T')!==false) |
|
| 1071 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
|
|
| 1072 | - if(strpos($border,'R')!==false) |
|
| 1073 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
|
| 1074 | - if(strpos($border,'B')!==false) |
|
| 1075 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
|
| 1068 | + if (strpos($border, 'L') !== false) |
|
| 1069 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, $x * $k, ($this->h - ($y + $h)) * $k);
|
|
| 1070 | + if (strpos($border, 'T') !== false) |
|
| 1071 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - $y) * $k);
|
|
| 1072 | + if (strpos($border, 'R') !== false) |
|
| 1073 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', ($x + $w) * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - ($y + $h)) * $k);
|
|
| 1074 | + if (strpos($border, 'B') !== false) |
|
| 1075 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - ($y + $h)) * $k, ($x + $w) * $k, ($this->h - ($y + $h)) * $k);
|
|
| 1076 | 1076 | } |
| 1077 | - if($txt!=='') |
|
| 1077 | + if ($txt !== '') |
|
| 1078 | 1078 | {
|
| 1079 | - if(!isset($this->CurrentFont)) |
|
| 1079 | + if (!isset($this->CurrentFont)) |
|
| 1080 | 1080 | $this->Error('No font has been set');
|
| 1081 | - if($align=='R') |
|
| 1082 | - $dx = $w-$this->cMargin-$this->getStringWidth($txt); |
|
| 1083 | - elseif($align=='C') |
|
| 1084 | - $dx = ($w-$this->getStringWidth($txt))/2; |
|
| 1081 | + if ($align == 'R') |
|
| 1082 | + $dx = $w - $this->cMargin - $this->getStringWidth($txt); |
|
| 1083 | + elseif ($align == 'C') |
|
| 1084 | + $dx = ($w - $this->getStringWidth($txt)) / 2; |
|
| 1085 | 1085 | else |
| 1086 | 1086 | $dx = $this->cMargin; |
| 1087 | - if($this->ColorFlag) |
|
| 1088 | - $s .= 'q '.$this->TextColor.' '; |
|
| 1089 | - $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$this->_escape($txt));
|
|
| 1090 | - if($this->underline) |
|
| 1091 | - $s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); |
|
| 1092 | - if($this->ColorFlag) |
|
| 1087 | + if ($this->ColorFlag) |
|
| 1088 | + $s .= 'q ' . $this->TextColor . ' '; |
|
| 1089 | + $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET', ($this->x + $dx) * $k, ($this->h - ($this->y + .5 * $h + .3 * $this->FontSize)) * $k, $this->_escape($txt));
|
|
| 1090 | + if ($this->underline) |
|
| 1091 | + $s .= ' ' . $this->_dounderline($this->x + $dx, $this->y + .5 * $h + .3 * $this->FontSize, $txt); |
|
| 1092 | + if ($this->ColorFlag) |
|
| 1093 | 1093 | $s .= ' Q'; |
| 1094 | - if($link) |
|
| 1095 | - $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->getStringWidth($txt),$this->FontSize,$link); |
|
| 1094 | + if ($link) |
|
| 1095 | + $this->Link($this->x + $dx, $this->y + .5 * $h - .5 * $this->FontSize, $this->getStringWidth($txt), $this->FontSize, $link); |
|
| 1096 | 1096 | } |
| 1097 | - if($s) |
|
| 1097 | + if ($s) |
|
| 1098 | 1098 | $this->_out($s); |
| 1099 | 1099 | $this->lasth = $h; |
| 1100 | - if($ln>0) |
|
| 1100 | + if ($ln > 0) |
|
| 1101 | 1101 | {
|
| 1102 | 1102 | // Go to next line |
| 1103 | 1103 | $this->y += $h; |
| 1104 | - if($ln==1) |
|
| 1104 | + if ($ln == 1) |
|
| 1105 | 1105 | $this->x = $this->lMargin; |
| 1106 | 1106 | } |
| 1107 | 1107 | else |
@@ -1136,24 +1136,24 @@ discard block |
||
| 1136 | 1136 | * If set to true, current FillColor is used for the background. <br/> |
| 1137 | 1137 | * Default value: false. |
| 1138 | 1138 | */ |
| 1139 | - public function MultiCell(float $w, float $h, string $txt, $border=0, string $align='J', bool $fill=false) : void |
|
| 1139 | + public function MultiCell(float $w, float $h, string $txt, $border = 0, string $align = 'J', bool $fill = false) : void |
|
| 1140 | 1140 | {
|
| 1141 | 1141 | // Output text with automatic or explicit line breaks |
| 1142 | - if(!isset($this->CurrentFont)) |
|
| 1142 | + if (!isset($this->CurrentFont)) |
|
| 1143 | 1143 | $this->Error('No font has been set');
|
| 1144 | 1144 | $cw = &$this->CurrentFont['cw']; |
| 1145 | - if($w==0) |
|
| 1146 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1147 | - $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1148 | - $s = str_replace("\r",'',$txt);
|
|
| 1145 | + if ($w == 0) |
|
| 1146 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 1147 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; |
|
| 1148 | + $s = str_replace("\r", '', $txt);
|
|
| 1149 | 1149 | $nb = strlen($s); |
| 1150 | - if($nb>0 && $s[$nb-1]=="\n") |
|
| 1150 | + if ($nb > 0 && $s[$nb - 1] == "\n") |
|
| 1151 | 1151 | $nb--; |
| 1152 | 1152 | $b = 0; |
| 1153 | 1153 | $b2 = ''; |
| 1154 | - if($border) |
|
| 1154 | + if ($border) |
|
| 1155 | 1155 | {
|
| 1156 | - if($border==1) |
|
| 1156 | + if ($border == 1) |
|
| 1157 | 1157 | {
|
| 1158 | 1158 | $border = 'LTRB'; |
| 1159 | 1159 | $b = 'LRT'; |
@@ -1162,11 +1162,11 @@ discard block |
||
| 1162 | 1162 | else |
| 1163 | 1163 | {
|
| 1164 | 1164 | $b2 = ''; |
| 1165 | - if(strpos($border,'L')!==false) |
|
| 1165 | + if (strpos($border, 'L') !== false) |
|
| 1166 | 1166 | $b2 .= 'L'; |
| 1167 | - if(strpos($border,'R')!==false) |
|
| 1167 | + if (strpos($border, 'R') !== false) |
|
| 1168 | 1168 | $b2 .= 'R'; |
| 1169 | - $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2; |
|
| 1169 | + $b = (strpos($border, 'T') !== false) ? $b2 . 'T' : $b2; |
|
| 1170 | 1170 | } |
| 1171 | 1171 | } |
| 1172 | 1172 | $sep = -1; |
@@ -1176,80 +1176,80 @@ discard block |
||
| 1176 | 1176 | $ns = 0; |
| 1177 | 1177 | $nl = 1; |
| 1178 | 1178 | $ls = 0; |
| 1179 | - while($i<$nb) |
|
| 1179 | + while ($i < $nb) |
|
| 1180 | 1180 | {
|
| 1181 | 1181 | // Get next character |
| 1182 | 1182 | $c = $s[$i]; |
| 1183 | - if($c=="\n") |
|
| 1183 | + if ($c == "\n") |
|
| 1184 | 1184 | {
|
| 1185 | 1185 | // Explicit line break |
| 1186 | - if($this->ws>0) |
|
| 1186 | + if ($this->ws > 0) |
|
| 1187 | 1187 | {
|
| 1188 | 1188 | $this->ws = 0; |
| 1189 | 1189 | $this->_out('0 Tw');
|
| 1190 | 1190 | } |
| 1191 | - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
| 1191 | + $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 1192 | 1192 | $i++; |
| 1193 | 1193 | $sep = -1; |
| 1194 | 1194 | $j = $i; |
| 1195 | 1195 | $l = 0; |
| 1196 | 1196 | $ns = 0; |
| 1197 | 1197 | $nl++; |
| 1198 | - if($border && $nl==2) |
|
| 1198 | + if ($border && $nl == 2) |
|
| 1199 | 1199 | $b = $b2; |
| 1200 | 1200 | continue; |
| 1201 | 1201 | } |
| 1202 | - if($c==' ') |
|
| 1202 | + if ($c == ' ') |
|
| 1203 | 1203 | {
|
| 1204 | 1204 | $sep = $i; |
| 1205 | 1205 | $ls = $l; |
| 1206 | 1206 | $ns++; |
| 1207 | 1207 | } |
| 1208 | 1208 | $l += $cw[$c]; |
| 1209 | - if($l>$wmax) |
|
| 1209 | + if ($l > $wmax) |
|
| 1210 | 1210 | {
|
| 1211 | 1211 | // Automatic line break |
| 1212 | - if($sep==-1) |
|
| 1212 | + if ($sep == -1) |
|
| 1213 | 1213 | {
|
| 1214 | - if($i==$j) |
|
| 1214 | + if ($i == $j) |
|
| 1215 | 1215 | $i++; |
| 1216 | - if($this->ws>0) |
|
| 1216 | + if ($this->ws > 0) |
|
| 1217 | 1217 | {
|
| 1218 | 1218 | $this->ws = 0; |
| 1219 | 1219 | $this->_out('0 Tw');
|
| 1220 | 1220 | } |
| 1221 | - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
| 1221 | + $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 1222 | 1222 | } |
| 1223 | 1223 | else |
| 1224 | 1224 | {
|
| 1225 | - if($align=='J') |
|
| 1225 | + if ($align == 'J') |
|
| 1226 | 1226 | {
|
| 1227 | - $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; |
|
| 1228 | - $this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
|
|
| 1227 | + $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->FontSize / ($ns - 1) : 0; |
|
| 1228 | + $this->_out(sprintf('%.3F Tw', $this->ws * $this->k));
|
|
| 1229 | 1229 | } |
| 1230 | - $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); |
|
| 1231 | - $i = $sep+1; |
|
| 1230 | + $this->Cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill); |
|
| 1231 | + $i = $sep + 1; |
|
| 1232 | 1232 | } |
| 1233 | 1233 | $sep = -1; |
| 1234 | 1234 | $j = $i; |
| 1235 | 1235 | $l = 0; |
| 1236 | 1236 | $ns = 0; |
| 1237 | 1237 | $nl++; |
| 1238 | - if($border && $nl==2) |
|
| 1238 | + if ($border && $nl == 2) |
|
| 1239 | 1239 | $b = $b2; |
| 1240 | 1240 | } |
| 1241 | 1241 | else |
| 1242 | 1242 | $i++; |
| 1243 | 1243 | } |
| 1244 | 1244 | // Last chunk |
| 1245 | - if($this->ws>0) |
|
| 1245 | + if ($this->ws > 0) |
|
| 1246 | 1246 | {
|
| 1247 | 1247 | $this->ws = 0; |
| 1248 | 1248 | $this->_out('0 Tw');
|
| 1249 | 1249 | } |
| 1250 | - if($border && strpos($border,'B')!==false) |
|
| 1250 | + if ($border && strpos($border, 'B') !== false) |
|
| 1251 | 1251 | $b .= 'B'; |
| 1252 | - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
| 1252 | + $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 1253 | 1253 | $this->x = $this->lMargin; |
| 1254 | 1254 | } |
| 1255 | 1255 | |
@@ -1263,78 +1263,78 @@ discard block |
||
| 1263 | 1263 | * @param string $txt String to print. |
| 1264 | 1264 | * @param string|int $link URL or identifier for internal link created by AddLink(). |
| 1265 | 1265 | */ |
| 1266 | - public function Write(float $h, string $txt, $link='') : void |
|
| 1266 | + public function Write(float $h, string $txt, $link = '') : void |
|
| 1267 | 1267 | {
|
| 1268 | 1268 | // Output text in flowing mode |
| 1269 | - if(!isset($this->CurrentFont)) |
|
| 1269 | + if (!isset($this->CurrentFont)) |
|
| 1270 | 1270 | $this->Error('No font has been set');
|
| 1271 | 1271 | $cw = &$this->CurrentFont['cw']; |
| 1272 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1273 | - $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1274 | - $s = str_replace("\r",'',$txt);
|
|
| 1272 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 1273 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; |
|
| 1274 | + $s = str_replace("\r", '', $txt);
|
|
| 1275 | 1275 | $nb = strlen($s); |
| 1276 | 1276 | $sep = -1; |
| 1277 | 1277 | $i = 0; |
| 1278 | 1278 | $j = 0; |
| 1279 | 1279 | $l = 0; |
| 1280 | 1280 | $nl = 1; |
| 1281 | - while($i<$nb) |
|
| 1281 | + while ($i < $nb) |
|
| 1282 | 1282 | {
|
| 1283 | 1283 | // Get next character |
| 1284 | 1284 | $c = $s[$i]; |
| 1285 | - if($c=="\n") |
|
| 1285 | + if ($c == "\n") |
|
| 1286 | 1286 | {
|
| 1287 | 1287 | // Explicit line break |
| 1288 | - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link); |
|
| 1288 | + $this->Cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', false, $link); |
|
| 1289 | 1289 | $i++; |
| 1290 | 1290 | $sep = -1; |
| 1291 | 1291 | $j = $i; |
| 1292 | 1292 | $l = 0; |
| 1293 | - if($nl==1) |
|
| 1293 | + if ($nl == 1) |
|
| 1294 | 1294 | {
|
| 1295 | 1295 | $this->x = $this->lMargin; |
| 1296 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1297 | - $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1296 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 1297 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; |
|
| 1298 | 1298 | } |
| 1299 | 1299 | $nl++; |
| 1300 | 1300 | continue; |
| 1301 | 1301 | } |
| 1302 | - if($c==' ') |
|
| 1302 | + if ($c == ' ') |
|
| 1303 | 1303 | $sep = $i; |
| 1304 | 1304 | $l += $cw[$c]; |
| 1305 | - if($l>$wmax) |
|
| 1305 | + if ($l > $wmax) |
|
| 1306 | 1306 | {
|
| 1307 | 1307 | // Automatic line break |
| 1308 | - if($sep==-1) |
|
| 1308 | + if ($sep == -1) |
|
| 1309 | 1309 | {
|
| 1310 | - if($this->x>$this->lMargin) |
|
| 1310 | + if ($this->x > $this->lMargin) |
|
| 1311 | 1311 | {
|
| 1312 | 1312 | // Move to next line |
| 1313 | 1313 | $this->x = $this->lMargin; |
| 1314 | 1314 | $this->y += $h; |
| 1315 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1316 | - $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1315 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 1316 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; |
|
| 1317 | 1317 | $i++; |
| 1318 | 1318 | $nl++; |
| 1319 | 1319 | continue; |
| 1320 | 1320 | } |
| 1321 | - if($i==$j) |
|
| 1321 | + if ($i == $j) |
|
| 1322 | 1322 | $i++; |
| 1323 | - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link); |
|
| 1323 | + $this->Cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', false, $link); |
|
| 1324 | 1324 | } |
| 1325 | 1325 | else |
| 1326 | 1326 | {
|
| 1327 | - $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',false,$link); |
|
| 1328 | - $i = $sep+1; |
|
| 1327 | + $this->Cell($w, $h, substr($s, $j, $sep - $j), 0, 2, '', false, $link); |
|
| 1328 | + $i = $sep + 1; |
|
| 1329 | 1329 | } |
| 1330 | 1330 | $sep = -1; |
| 1331 | 1331 | $j = $i; |
| 1332 | 1332 | $l = 0; |
| 1333 | - if($nl==1) |
|
| 1333 | + if ($nl == 1) |
|
| 1334 | 1334 | {
|
| 1335 | 1335 | $this->x = $this->lMargin; |
| 1336 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1337 | - $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
|
| 1336 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 1337 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; |
|
| 1338 | 1338 | } |
| 1339 | 1339 | $nl++; |
| 1340 | 1340 | } |
@@ -1342,8 +1342,8 @@ discard block |
||
| 1342 | 1342 | $i++; |
| 1343 | 1343 | } |
| 1344 | 1344 | // Last chunk |
| 1345 | - if($i!=$j) |
|
| 1346 | - $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link); |
|
| 1345 | + if ($i != $j) |
|
| 1346 | + $this->Cell($l / 1000 * $this->FontSize, $h, substr($s, $j), 0, 0, '', false, $link); |
|
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | 1349 | /** |
@@ -1353,11 +1353,11 @@ discard block |
||
| 1353 | 1353 | * @param float $h The height of the break. <br/> |
| 1354 | 1354 | * By default, the value equals the height of the last printed cell. |
| 1355 | 1355 | */ |
| 1356 | - public function Ln(float $h=null) : void |
|
| 1356 | + public function Ln(float $h = null) : void |
|
| 1357 | 1357 | {
|
| 1358 | 1358 | // Line feed; default value is the last cell height |
| 1359 | 1359 | $this->x = $this->lMargin; |
| 1360 | - if($h===null) |
|
| 1360 | + if ($h === null) |
|
| 1361 | 1361 | $this->y += $this->lasth; |
| 1362 | 1362 | else |
| 1363 | 1363 | $this->y += $h; |
@@ -1409,69 +1409,69 @@ discard block |
||
| 1409 | 1409 | * If not specified, the type is inferred from the file extension. <br/> |
| 1410 | 1410 | * @param string|int $link URL or identifier for internal link created by AddLink(). |
| 1411 | 1411 | */ |
| 1412 | - public function Image(string $file, ?float $x=null, ?float $y=null, float $w=0, float $h=0, string $type='', $link='') : void |
|
| 1412 | + public function Image(string $file, ?float $x = null, ?float $y = null, float $w = 0, float $h = 0, string $type = '', $link = '') : void |
|
| 1413 | 1413 | {
|
| 1414 | 1414 | // Put an image on the page |
| 1415 | - if($file=='') |
|
| 1415 | + if ($file == '') |
|
| 1416 | 1416 | $this->Error('Image file name is empty');
|
| 1417 | - if(!isset($this->images[$file])) |
|
| 1417 | + if (!isset($this->images[$file])) |
|
| 1418 | 1418 | {
|
| 1419 | 1419 | // First use of this image, get info |
| 1420 | - if($type=='') |
|
| 1420 | + if ($type == '') |
|
| 1421 | 1421 | {
|
| 1422 | - $pos = strrpos($file,'.'); |
|
| 1423 | - if(!$pos) |
|
| 1424 | - $this->Error('Image file has no extension and no type was specified: '.$file);
|
|
| 1425 | - $type = substr($file,$pos+1); |
|
| 1422 | + $pos = strrpos($file, '.'); |
|
| 1423 | + if (!$pos) |
|
| 1424 | + $this->Error('Image file has no extension and no type was specified: ' . $file);
|
|
| 1425 | + $type = substr($file, $pos + 1); |
|
| 1426 | 1426 | } |
| 1427 | 1427 | $type = strtolower($type); |
| 1428 | - if($type=='jpeg') |
|
| 1428 | + if ($type == 'jpeg') |
|
| 1429 | 1429 | $type = 'jpg'; |
| 1430 | - $mtd = '_parse'.$type; |
|
| 1431 | - if(!method_exists($this,$mtd)) |
|
| 1432 | - $this->Error('Unsupported image type: '.$type);
|
|
| 1430 | + $mtd = '_parse' . $type; |
|
| 1431 | + if (!method_exists($this, $mtd)) |
|
| 1432 | + $this->Error('Unsupported image type: ' . $type);
|
|
| 1433 | 1433 | $info = $this->$mtd($file); |
| 1434 | - $info['i'] = count($this->images)+1; |
|
| 1434 | + $info['i'] = count($this->images) + 1; |
|
| 1435 | 1435 | $this->images[$file] = $info; |
| 1436 | 1436 | } |
| 1437 | 1437 | else |
| 1438 | 1438 | $info = $this->images[$file]; |
| 1439 | 1439 | |
| 1440 | 1440 | // Automatic width and height calculation if needed |
| 1441 | - if($w==0 && $h==0) |
|
| 1441 | + if ($w == 0 && $h == 0) |
|
| 1442 | 1442 | {
|
| 1443 | 1443 | // Put image at 96 dpi |
| 1444 | 1444 | $w = -96; |
| 1445 | 1445 | $h = -96; |
| 1446 | 1446 | } |
| 1447 | - if($w<0) |
|
| 1448 | - $w = -$info['w']*72/$w/$this->k; |
|
| 1449 | - if($h<0) |
|
| 1450 | - $h = -$info['h']*72/$h/$this->k; |
|
| 1451 | - if($w==0) |
|
| 1452 | - $w = $h*$info['w']/$info['h']; |
|
| 1453 | - if($h==0) |
|
| 1454 | - $h = $w*$info['h']/$info['w']; |
|
| 1447 | + if ($w < 0) |
|
| 1448 | + $w = -$info['w'] * 72 / $w / $this->k; |
|
| 1449 | + if ($h < 0) |
|
| 1450 | + $h = -$info['h'] * 72 / $h / $this->k; |
|
| 1451 | + if ($w == 0) |
|
| 1452 | + $w = $h * $info['w'] / $info['h']; |
|
| 1453 | + if ($h == 0) |
|
| 1454 | + $h = $w * $info['h'] / $info['w']; |
|
| 1455 | 1455 | |
| 1456 | 1456 | // Flowing mode |
| 1457 | - if($y===null) |
|
| 1457 | + if ($y === null) |
|
| 1458 | 1458 | {
|
| 1459 | - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
| 1459 | + if ($this->y + $h > $this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
| 1460 | 1460 | {
|
| 1461 | 1461 | // Automatic page break |
| 1462 | 1462 | $x2 = $this->x; |
| 1463 | - $this->addPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation); |
|
| 1463 | + $this->addPage($this->CurOrientation, $this->CurPageSize, $this->CurRotation); |
|
| 1464 | 1464 | $this->x = $x2; |
| 1465 | 1465 | } |
| 1466 | 1466 | $y = $this->y; |
| 1467 | 1467 | $this->y += $h; |
| 1468 | 1468 | } |
| 1469 | 1469 | |
| 1470 | - if($x===null) |
|
| 1470 | + if ($x === null) |
|
| 1471 | 1471 | $x = $this->x; |
| 1472 | - $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
|
|
| 1473 | - if($link) |
|
| 1474 | - $this->Link($x,$y,$w,$h,$link); |
|
| 1472 | + $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q', $w * $this->k, $h * $this->k, $x * $this->k, ($this->h - ($y + $h)) * $this->k, $info['i']));
|
|
| 1473 | + if ($link) |
|
| 1474 | + $this->Link($x, $y, $w, $h, $link); |
|
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | 1477 | /** |
@@ -1512,10 +1512,10 @@ discard block |
||
| 1512 | 1512 | public function SetX(float $x) : void |
| 1513 | 1513 | {
|
| 1514 | 1514 | // Set x position |
| 1515 | - if($x>=0) |
|
| 1515 | + if ($x >= 0) |
|
| 1516 | 1516 | $this->x = $x; |
| 1517 | 1517 | else |
| 1518 | - $this->x = $this->w+$x; |
|
| 1518 | + $this->x = $this->w + $x; |
|
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | 1521 | /** |
@@ -1534,14 +1534,14 @@ discard block |
||
| 1534 | 1534 | * @param float $y |
| 1535 | 1535 | * @param bool $resetX |
| 1536 | 1536 | */ |
| 1537 | - public function SetY(float $y, bool $resetX=true) : void |
|
| 1537 | + public function SetY(float $y, bool $resetX = true) : void |
|
| 1538 | 1538 | {
|
| 1539 | 1539 | // Set y position and optionally reset x |
| 1540 | - if($y>=0) |
|
| 1540 | + if ($y >= 0) |
|
| 1541 | 1541 | $this->y = $y; |
| 1542 | 1542 | else |
| 1543 | - $this->y = $this->h+$y; |
|
| 1544 | - if($resetX) |
|
| 1543 | + $this->y = $this->h + $y; |
|
| 1544 | + if ($resetX) |
|
| 1545 | 1545 | $this->x = $this->lMargin; |
| 1546 | 1546 | } |
| 1547 | 1547 | |
@@ -1555,7 +1555,7 @@ discard block |
||
| 1555 | 1555 | {
|
| 1556 | 1556 | // Set x and y positions |
| 1557 | 1557 | $this->setX($x); |
| 1558 | - $this->setY($y,false); |
|
| 1558 | + $this->setY($y, false); |
|
| 1559 | 1559 | } |
| 1560 | 1560 | |
| 1561 | 1561 | /** |
@@ -1576,31 +1576,31 @@ discard block |
||
| 1576 | 1576 | * The default value is false. <br/> |
| 1577 | 1577 | * @return string |
| 1578 | 1578 | */ |
| 1579 | - public function Output(string $dest='', string $name='', bool $isUTF8=false) : string |
|
| 1579 | + public function Output(string $dest = '', string $name = '', bool $isUTF8 = false) : string |
|
| 1580 | 1580 | {
|
| 1581 | 1581 | // Output PDF to some destination |
| 1582 | 1582 | $this->Close(); |
| 1583 | - if(strlen($name)==1 && strlen($dest)!=1) |
|
| 1583 | + if (strlen($name) == 1 && strlen($dest) != 1) |
|
| 1584 | 1584 | {
|
| 1585 | 1585 | // Fix parameter order |
| 1586 | 1586 | $tmp = $dest; |
| 1587 | 1587 | $dest = $name; |
| 1588 | 1588 | $name = $tmp; |
| 1589 | 1589 | } |
| 1590 | - if($dest=='') |
|
| 1590 | + if ($dest == '') |
|
| 1591 | 1591 | $dest = 'I'; |
| 1592 | - if($name=='') |
|
| 1592 | + if ($name == '') |
|
| 1593 | 1593 | $name = 'doc.pdf'; |
| 1594 | - switch(strtoupper($dest)) |
|
| 1594 | + switch (strtoupper($dest)) |
|
| 1595 | 1595 | {
|
| 1596 | 1596 | case 'I': |
| 1597 | 1597 | // Send to standard output |
| 1598 | 1598 | $this->_checkoutput(); |
| 1599 | - if(PHP_SAPI!='cli') |
|
| 1599 | + if (PHP_SAPI != 'cli') |
|
| 1600 | 1600 | {
|
| 1601 | 1601 | // We send to a browser |
| 1602 | 1602 | header('Content-Type: application/pdf; charset=UTF-8');
|
| 1603 | - header('Content-Disposition: inline; '.$this->_httpencode('filename',$name,$isUTF8));
|
|
| 1603 | + header('Content-Disposition: inline; ' . $this->_httpencode('filename', $name, $isUTF8));
|
|
| 1604 | 1604 | header('Cache-Control: private, max-age=0, must-revalidate');
|
| 1605 | 1605 | header('Pragma: public');
|
| 1606 | 1606 | } |
@@ -1610,21 +1610,21 @@ discard block |
||
| 1610 | 1610 | // Download file |
| 1611 | 1611 | $this->_checkoutput(); |
| 1612 | 1612 | header('Content-Type: application/x-download');
|
| 1613 | - header('Content-Disposition: attachment; '.$this->_httpencode('filename',$name,$isUTF8));
|
|
| 1613 | + header('Content-Disposition: attachment; ' . $this->_httpencode('filename', $name, $isUTF8));
|
|
| 1614 | 1614 | header('Cache-Control: private, max-age=0, must-revalidate');
|
| 1615 | 1615 | header('Pragma: public');
|
| 1616 | 1616 | echo $this->buffer; |
| 1617 | 1617 | break; |
| 1618 | 1618 | case 'F': |
| 1619 | 1619 | // Save to local file |
| 1620 | - if(!file_put_contents($name,$this->buffer)) |
|
| 1621 | - $this->Error('Unable to create output file: '.$name);
|
|
| 1620 | + if (!file_put_contents($name, $this->buffer)) |
|
| 1621 | + $this->Error('Unable to create output file: ' . $name);
|
|
| 1622 | 1622 | break; |
| 1623 | 1623 | case 'S': |
| 1624 | 1624 | // Return as a string |
| 1625 | 1625 | return $this->buffer; |
| 1626 | 1626 | default: |
| 1627 | - $this->Error('Incorrect output destination: '.$dest);
|
|
| 1627 | + $this->Error('Incorrect output destination: ' . $dest);
|
|
| 1628 | 1628 | } |
| 1629 | 1629 | return ''; |
| 1630 | 1630 | } |
@@ -1635,7 +1635,7 @@ discard block |
||
| 1635 | 1635 | protected function _dochecks() : void |
| 1636 | 1636 | {
|
| 1637 | 1637 | // Check mbstring overloading |
| 1638 | - if(ini_get('mbstring.func_overload') & 2)
|
|
| 1638 | + if (ini_get('mbstring.func_overload') & 2)
|
|
| 1639 | 1639 | $this->Error('mbstring overloading must be disabled');
|
| 1640 | 1640 | } |
| 1641 | 1641 | |
@@ -1644,17 +1644,17 @@ discard block |
||
| 1644 | 1644 | */ |
| 1645 | 1645 | protected function _checkoutput() : void |
| 1646 | 1646 | {
|
| 1647 | - if(PHP_SAPI!='cli') |
|
| 1647 | + if (PHP_SAPI != 'cli') |
|
| 1648 | 1648 | {
|
| 1649 | 1649 | $file = ''; |
| 1650 | 1650 | $line = 0; |
| 1651 | - if(headers_sent($file,$line)) |
|
| 1651 | + if (headers_sent($file, $line)) |
|
| 1652 | 1652 | $this->Error("Some data has already been output, can't send PDF file (output started at $file:$line)");
|
| 1653 | 1653 | } |
| 1654 | - if(ob_get_length()) |
|
| 1654 | + if (ob_get_length()) |
|
| 1655 | 1655 | {
|
| 1656 | 1656 | // The output buffer is not empty |
| 1657 | - if(preg_match('/^(\xEF\xBB\xBF)?\s*$/',ob_get_contents()))
|
|
| 1657 | + if (preg_match('/^(\xEF\xBB\xBF)?\s*$/', ob_get_contents()))
|
|
| 1658 | 1658 | {
|
| 1659 | 1659 | // It contains only a UTF-8 BOM and/or whitespace, let's clean it |
| 1660 | 1660 | ob_clean(); |
@@ -1671,17 +1671,17 @@ discard block |
||
| 1671 | 1671 | */ |
| 1672 | 1672 | protected function _getpagesize($size) : array |
| 1673 | 1673 | {
|
| 1674 | - if(is_string($size)) |
|
| 1674 | + if (is_string($size)) |
|
| 1675 | 1675 | {
|
| 1676 | 1676 | $size = strtolower($size); |
| 1677 | - if(!isset($this->StdPageSizes[$size])) |
|
| 1678 | - $this->Error('Unknown page size: '.$size);
|
|
| 1677 | + if (!isset($this->StdPageSizes[$size])) |
|
| 1678 | + $this->Error('Unknown page size: ' . $size);
|
|
| 1679 | 1679 | $a = $this->StdPageSizes[$size]; |
| 1680 | - return array($a[0]/$this->k, $a[1]/$this->k); |
|
| 1680 | + return array($a[0] / $this->k, $a[1] / $this->k); |
|
| 1681 | 1681 | } |
| 1682 | 1682 | else |
| 1683 | 1683 | {
|
| 1684 | - if($size[0]>$size[1]) |
|
| 1684 | + if ($size[0] > $size[1]) |
|
| 1685 | 1685 | return array($size[1], $size[0]); |
| 1686 | 1686 | else |
| 1687 | 1687 | return $size; |
@@ -1703,18 +1703,18 @@ discard block |
||
| 1703 | 1703 | $this->y = $this->tMargin; |
| 1704 | 1704 | $this->FontFamily = ''; |
| 1705 | 1705 | // Check page size and orientation |
| 1706 | - if($orientation=='') |
|
| 1706 | + if ($orientation == '') |
|
| 1707 | 1707 | $orientation = $this->DefOrientation; |
| 1708 | 1708 | else |
| 1709 | 1709 | $orientation = strtoupper($orientation[0]); |
| 1710 | - if($size=='') |
|
| 1710 | + if ($size == '') |
|
| 1711 | 1711 | $size = $this->DefPageSize; |
| 1712 | 1712 | else |
| 1713 | 1713 | $size = $this->_getpagesize($size); |
| 1714 | - if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) |
|
| 1714 | + if ($orientation != $this->CurOrientation || $size[0] != $this->CurPageSize[0] || $size[1] != $this->CurPageSize[1]) |
|
| 1715 | 1715 | {
|
| 1716 | 1716 | // New size or orientation |
| 1717 | - if($orientation=='P') |
|
| 1717 | + if ($orientation == 'P') |
|
| 1718 | 1718 | {
|
| 1719 | 1719 | $this->w = $size[0]; |
| 1720 | 1720 | $this->h = $size[1]; |
@@ -1724,18 +1724,18 @@ discard block |
||
| 1724 | 1724 | $this->w = $size[1]; |
| 1725 | 1725 | $this->h = $size[0]; |
| 1726 | 1726 | } |
| 1727 | - $this->wPt = $this->w*$this->k; |
|
| 1728 | - $this->hPt = $this->h*$this->k; |
|
| 1729 | - $this->PageBreakTrigger = $this->h-$this->bMargin; |
|
| 1727 | + $this->wPt = $this->w * $this->k; |
|
| 1728 | + $this->hPt = $this->h * $this->k; |
|
| 1729 | + $this->PageBreakTrigger = $this->h - $this->bMargin; |
|
| 1730 | 1730 | $this->CurOrientation = $orientation; |
| 1731 | 1731 | $this->CurPageSize = $size; |
| 1732 | 1732 | } |
| 1733 | - if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) |
|
| 1733 | + if ($orientation != $this->DefOrientation || $size[0] != $this->DefPageSize[0] || $size[1] != $this->DefPageSize[1]) |
|
| 1734 | 1734 | $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt); |
| 1735 | - if($rotation!=0) |
|
| 1735 | + if ($rotation != 0) |
|
| 1736 | 1736 | {
|
| 1737 | - if($rotation%90!=0) |
|
| 1738 | - $this->Error('Incorrect rotation value: '.$rotation);
|
|
| 1737 | + if ($rotation % 90 != 0) |
|
| 1738 | + $this->Error('Incorrect rotation value: ' . $rotation);
|
|
| 1739 | 1739 | $this->CurRotation = $rotation; |
| 1740 | 1740 | $this->PageInfo[$this->page]['rotation'] = $rotation; |
| 1741 | 1741 | } |
@@ -1757,23 +1757,23 @@ discard block |
||
| 1757 | 1757 | protected function _loadfont(string $font) : array |
| 1758 | 1758 | {
|
| 1759 | 1759 | // Load a font definition file from the font directory |
| 1760 | - if(strpos($font,'/')!==false || strpos($font,"\\")!==false) {
|
|
| 1761 | - $this->Error('Incorrect font definition file name: '.$font);
|
|
| 1760 | + if (strpos($font, '/') !== false || strpos($font, "\\") !== false) {
|
|
| 1761 | + $this->Error('Incorrect font definition file name: ' . $font);
|
|
| 1762 | 1762 | } |
| 1763 | 1763 | // following vars must be initialized in the font definition file beeing included |
| 1764 | 1764 | $name = null; |
| 1765 | 1765 | $enc = null; |
| 1766 | 1766 | $subsetted = null; |
| 1767 | - include($this->fontpath.$font); |
|
| 1767 | + include($this->fontpath . $font); |
|
| 1768 | 1768 | |
| 1769 | 1769 | // phpstan can't see the code dynamicly included before so assuming $name, $enc, $subsetted always set to null! |
| 1770 | - if(!isset($name)) { /* @phpstan-ignore-line */
|
|
| 1770 | + if (!isset($name)) { /* @phpstan-ignore-line */
|
|
| 1771 | 1771 | $this->Error('Could not include font definition file');
|
| 1772 | 1772 | } |
| 1773 | - if(isset($enc)) { /* @phpstan-ignore-line */
|
|
| 1773 | + if (isset($enc)) { /* @phpstan-ignore-line */
|
|
| 1774 | 1774 | $enc = strtolower($enc); |
| 1775 | 1775 | } |
| 1776 | - if(!isset($subsetted)) { /* @phpstan-ignore-line */
|
|
| 1776 | + if (!isset($subsetted)) { /* @phpstan-ignore-line */
|
|
| 1777 | 1777 | $subsetted = false; |
| 1778 | 1778 | } |
| 1779 | 1779 | return get_defined_vars(); |
@@ -1788,9 +1788,9 @@ discard block |
||
| 1788 | 1788 | {
|
| 1789 | 1789 | // Test if string is ASCII |
| 1790 | 1790 | $nb = strlen($s); |
| 1791 | - for($i=0;$i<$nb;$i++) |
|
| 1791 | + for ($i = 0; $i < $nb; $i++) |
|
| 1792 | 1792 | {
|
| 1793 | - if(ord($s[$i])>127) |
|
| 1793 | + if (ord($s[$i]) > 127) |
|
| 1794 | 1794 | return false; |
| 1795 | 1795 | } |
| 1796 | 1796 | return true; |
@@ -1805,14 +1805,14 @@ discard block |
||
| 1805 | 1805 | protected function _httpencode(string $param, string $value, bool $isUTF8) : string |
| 1806 | 1806 | {
|
| 1807 | 1807 | // Encode HTTP header field parameter |
| 1808 | - if($this->_isascii($value)) |
|
| 1809 | - return $param.'="'.$value.'"'; |
|
| 1810 | - if(!$isUTF8) |
|
| 1808 | + if ($this->_isascii($value)) |
|
| 1809 | + return $param . '="' . $value . '"'; |
|
| 1810 | + if (!$isUTF8) |
|
| 1811 | 1811 | $value = utf8_encode($value); |
| 1812 | - if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')!==false) |
|
| 1813 | - return $param.'="'.rawurlencode($value).'"'; |
|
| 1812 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) |
|
| 1813 | + return $param . '="' . rawurlencode($value) . '"'; |
|
| 1814 | 1814 | else |
| 1815 | - return $param."*=UTF-8''".rawurlencode($value); |
|
| 1815 | + return $param . "*=UTF-8''" . rawurlencode($value); |
|
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | 1818 | /** |
@@ -1826,28 +1826,28 @@ discard block |
||
| 1826 | 1826 | $res = "\xFE\xFF"; |
| 1827 | 1827 | $nb = strlen($s); |
| 1828 | 1828 | $i = 0; |
| 1829 | - while($i<$nb) |
|
| 1829 | + while ($i < $nb) |
|
| 1830 | 1830 | {
|
| 1831 | 1831 | $c1 = ord($s[$i++]); |
| 1832 | - if($c1>=224) |
|
| 1832 | + if ($c1 >= 224) |
|
| 1833 | 1833 | {
|
| 1834 | 1834 | // 3-byte character |
| 1835 | 1835 | $c2 = ord($s[$i++]); |
| 1836 | 1836 | $c3 = ord($s[$i++]); |
| 1837 | - $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); |
|
| 1838 | - $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); |
|
| 1837 | + $res .= chr((($c1 & 0x0F) << 4) + (($c2 & 0x3C) >> 2)); |
|
| 1838 | + $res .= chr((($c2 & 0x03) << 6) + ($c3 & 0x3F)); |
|
| 1839 | 1839 | } |
| 1840 | - elseif($c1>=192) |
|
| 1840 | + elseif ($c1 >= 192) |
|
| 1841 | 1841 | {
|
| 1842 | 1842 | // 2-byte character |
| 1843 | 1843 | $c2 = ord($s[$i++]); |
| 1844 | - $res .= chr(($c1 & 0x1C)>>2); |
|
| 1845 | - $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); |
|
| 1844 | + $res .= chr(($c1 & 0x1C) >> 2); |
|
| 1845 | + $res .= chr((($c1 & 0x03) << 6) + ($c2 & 0x3F)); |
|
| 1846 | 1846 | } |
| 1847 | 1847 | else |
| 1848 | 1848 | {
|
| 1849 | 1849 | // Single-byte character |
| 1850 | - $res .= "\0".chr($c1); |
|
| 1850 | + $res .= "\0" . chr($c1); |
|
| 1851 | 1851 | } |
| 1852 | 1852 | } |
| 1853 | 1853 | return $res; |
@@ -1861,8 +1861,8 @@ discard block |
||
| 1861 | 1861 | protected function _escape(string $s) : string |
| 1862 | 1862 | {
|
| 1863 | 1863 | // Escape special characters |
| 1864 | - if(strpos($s,'(')!==false || strpos($s,')')!==false || strpos($s,'\\')!==false || strpos($s,"\r")!==false)
|
|
| 1865 | - return str_replace(array('\\','(',')',"\r"), array('\\\\','\\(','\\)','\\r'), $s);
|
|
| 1864 | + if (strpos($s, '(') !== false || strpos($s, ')') !== false || strpos($s, '\\') !== false || strpos($s, "\r") !== false)
|
|
| 1865 | + return str_replace(array('\\', '(', ')', "\r"), array('\\\\', '\\(', '\\)', '\\r'), $s);
|
|
| 1866 | 1866 | else |
| 1867 | 1867 | return $s; |
| 1868 | 1868 | } |
@@ -1875,9 +1875,9 @@ discard block |
||
| 1875 | 1875 | protected function _textstring(string $s) : string |
| 1876 | 1876 | {
|
| 1877 | 1877 | // Format a text string |
| 1878 | - if(!$this->_isascii($s)) |
|
| 1878 | + if (!$this->_isascii($s)) |
|
| 1879 | 1879 | $s = $this->_UTF8toUTF16($s); |
| 1880 | - return '('.$this->_escape($s).')';
|
|
| 1880 | + return '(' . $this->_escape($s) . ')';
|
|
| 1881 | 1881 | } |
| 1882 | 1882 | |
| 1883 | 1883 | /** |
@@ -1892,8 +1892,8 @@ discard block |
||
| 1892 | 1892 | // Underline text |
| 1893 | 1893 | $up = $this->CurrentFont['up']; |
| 1894 | 1894 | $ut = $this->CurrentFont['ut']; |
| 1895 | - $w = $this->getStringWidth($txt)+$this->ws*substr_count($txt,' '); |
|
| 1896 | - return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
|
|
| 1895 | + $w = $this->getStringWidth($txt) + $this->ws * substr_count($txt, ' '); |
|
| 1896 | + return sprintf('%.2F %.2F %.2F %.2F re f', $x * $this->k, ($this->h - ($y - $up / 1000 * $this->FontSize)) * $this->k, $w * $this->k, -$ut / 1000 * $this->FontSizePt);
|
|
| 1897 | 1897 | } |
| 1898 | 1898 | |
| 1899 | 1899 | /** |
@@ -1905,13 +1905,13 @@ discard block |
||
| 1905 | 1905 | {
|
| 1906 | 1906 | // Extract info from a JPEG file |
| 1907 | 1907 | $a = getimagesize($file); |
| 1908 | - if(!$a) |
|
| 1909 | - $this->Error('Missing or incorrect image file: '.$file);
|
|
| 1910 | - if($a[2]!=2) |
|
| 1911 | - $this->Error('Not a JPEG file: '.$file);
|
|
| 1912 | - if(!isset($a['channels']) || $a['channels']==3) |
|
| 1908 | + if (!$a) |
|
| 1909 | + $this->Error('Missing or incorrect image file: ' . $file);
|
|
| 1910 | + if ($a[2] != 2) |
|
| 1911 | + $this->Error('Not a JPEG file: ' . $file);
|
|
| 1912 | + if (!isset($a['channels']) || $a['channels'] == 3) |
|
| 1913 | 1913 | $colspace = 'DeviceRGB'; |
| 1914 | - elseif($a['channels']==4) |
|
| 1914 | + elseif ($a['channels'] == 4) |
|
| 1915 | 1915 | $colspace = 'DeviceCMYK'; |
| 1916 | 1916 | else |
| 1917 | 1917 | $colspace = 'DeviceGray'; |
@@ -1928,10 +1928,10 @@ discard block |
||
| 1928 | 1928 | protected function _parsepng(string $file) : array |
| 1929 | 1929 | {
|
| 1930 | 1930 | // Extract info from a PNG file |
| 1931 | - $f = fopen($file,'rb'); |
|
| 1932 | - if(!$f) |
|
| 1933 | - $this->Error('Can\'t open image file: '.$file);
|
|
| 1934 | - $info = $this->_parsepngstream($f,$file); |
|
| 1931 | + $f = fopen($file, 'rb'); |
|
| 1932 | + if (!$f) |
|
| 1933 | + $this->Error('Can\'t open image file: ' . $file);
|
|
| 1934 | + $info = $this->_parsepngstream($f, $file); |
|
| 1935 | 1935 | fclose($f); |
| 1936 | 1936 | return $info; |
| 1937 | 1937 | } |
@@ -1945,36 +1945,36 @@ discard block |
||
| 1945 | 1945 | protected function _parsepngstream($f, string $file) : array |
| 1946 | 1946 | {
|
| 1947 | 1947 | // Check signature |
| 1948 | - if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) |
|
| 1949 | - $this->Error('Not a PNG file: '.$file);
|
|
| 1948 | + if ($this->_readstream($f, 8) != chr(137) . 'PNG' . chr(13) . chr(10) . chr(26) . chr(10)) |
|
| 1949 | + $this->Error('Not a PNG file: ' . $file);
|
|
| 1950 | 1950 | |
| 1951 | 1951 | // Read header chunk |
| 1952 | - $this->_readstream($f,4); |
|
| 1953 | - if($this->_readstream($f,4)!='IHDR') |
|
| 1954 | - $this->Error('Incorrect PNG file: '.$file);
|
|
| 1952 | + $this->_readstream($f, 4); |
|
| 1953 | + if ($this->_readstream($f, 4) != 'IHDR') |
|
| 1954 | + $this->Error('Incorrect PNG file: ' . $file);
|
|
| 1955 | 1955 | $w = $this->_readint($f); |
| 1956 | 1956 | $h = $this->_readint($f); |
| 1957 | - $bpc = ord($this->_readstream($f,1)); |
|
| 1958 | - if($bpc>8) |
|
| 1959 | - $this->Error('16-bit depth not supported: '.$file);
|
|
| 1960 | - $ct = ord($this->_readstream($f,1)); |
|
| 1957 | + $bpc = ord($this->_readstream($f, 1)); |
|
| 1958 | + if ($bpc > 8) |
|
| 1959 | + $this->Error('16-bit depth not supported: ' . $file);
|
|
| 1960 | + $ct = ord($this->_readstream($f, 1)); |
|
| 1961 | 1961 | $colspace = ''; |
| 1962 | - if($ct==0 || $ct==4) |
|
| 1962 | + if ($ct == 0 || $ct == 4) |
|
| 1963 | 1963 | $colspace = 'DeviceGray'; |
| 1964 | - elseif($ct==2 || $ct==6) |
|
| 1964 | + elseif ($ct == 2 || $ct == 6) |
|
| 1965 | 1965 | $colspace = 'DeviceRGB'; |
| 1966 | - elseif($ct==3) |
|
| 1966 | + elseif ($ct == 3) |
|
| 1967 | 1967 | $colspace = 'Indexed'; |
| 1968 | 1968 | else |
| 1969 | - $this->Error('Unknown color type: '.$file);
|
|
| 1970 | - if(ord($this->_readstream($f,1))!=0) |
|
| 1971 | - $this->Error('Unknown compression method: '.$file);
|
|
| 1972 | - if(ord($this->_readstream($f,1))!=0) |
|
| 1973 | - $this->Error('Unknown filter method: '.$file);
|
|
| 1974 | - if(ord($this->_readstream($f,1))!=0) |
|
| 1975 | - $this->Error('Interlacing not supported: '.$file);
|
|
| 1976 | - $this->_readstream($f,4); |
|
| 1977 | - $dp = '/Predictor 15 /Colors '.($colspace=='DeviceRGB' ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w; |
|
| 1969 | + $this->Error('Unknown color type: ' . $file);
|
|
| 1970 | + if (ord($this->_readstream($f, 1)) != 0) |
|
| 1971 | + $this->Error('Unknown compression method: ' . $file);
|
|
| 1972 | + if (ord($this->_readstream($f, 1)) != 0) |
|
| 1973 | + $this->Error('Unknown filter method: ' . $file);
|
|
| 1974 | + if (ord($this->_readstream($f, 1)) != 0) |
|
| 1975 | + $this->Error('Interlacing not supported: ' . $file);
|
|
| 1976 | + $this->_readstream($f, 4); |
|
| 1977 | + $dp = '/Predictor 15 /Colors ' . ($colspace == 'DeviceRGB' ? 3 : 1) . ' /BitsPerComponent ' . $bpc . ' /Columns ' . $w; |
|
| 1978 | 1978 | |
| 1979 | 1979 | // Scan chunks looking for palette, transparency and image data |
| 1980 | 1980 | $pal = ''; |
@@ -1983,86 +1983,86 @@ discard block |
||
| 1983 | 1983 | do |
| 1984 | 1984 | {
|
| 1985 | 1985 | $n = $this->_readint($f); |
| 1986 | - $type = $this->_readstream($f,4); |
|
| 1987 | - if($type=='PLTE') |
|
| 1986 | + $type = $this->_readstream($f, 4); |
|
| 1987 | + if ($type == 'PLTE') |
|
| 1988 | 1988 | {
|
| 1989 | 1989 | // Read palette |
| 1990 | - $pal = $this->_readstream($f,$n); |
|
| 1991 | - $this->_readstream($f,4); |
|
| 1990 | + $pal = $this->_readstream($f, $n); |
|
| 1991 | + $this->_readstream($f, 4); |
|
| 1992 | 1992 | } |
| 1993 | - elseif($type=='tRNS') |
|
| 1993 | + elseif ($type == 'tRNS') |
|
| 1994 | 1994 | {
|
| 1995 | 1995 | // Read transparency info |
| 1996 | - $t = $this->_readstream($f,$n); |
|
| 1997 | - if($ct==0) |
|
| 1998 | - $trns = array(ord(substr($t,1,1))); |
|
| 1999 | - elseif($ct==2) |
|
| 2000 | - $trns = array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); |
|
| 1996 | + $t = $this->_readstream($f, $n); |
|
| 1997 | + if ($ct == 0) |
|
| 1998 | + $trns = array(ord(substr($t, 1, 1))); |
|
| 1999 | + elseif ($ct == 2) |
|
| 2000 | + $trns = array(ord(substr($t, 1, 1)), ord(substr($t, 3, 1)), ord(substr($t, 5, 1))); |
|
| 2001 | 2001 | else |
| 2002 | 2002 | {
|
| 2003 | - $pos = strpos($t,chr(0)); |
|
| 2004 | - if($pos!==false) |
|
| 2003 | + $pos = strpos($t, chr(0)); |
|
| 2004 | + if ($pos !== false) |
|
| 2005 | 2005 | $trns = array($pos); |
| 2006 | 2006 | } |
| 2007 | - $this->_readstream($f,4); |
|
| 2007 | + $this->_readstream($f, 4); |
|
| 2008 | 2008 | } |
| 2009 | - elseif($type=='IDAT') |
|
| 2009 | + elseif ($type == 'IDAT') |
|
| 2010 | 2010 | {
|
| 2011 | 2011 | // Read image data block |
| 2012 | - $data .= $this->_readstream($f,$n); |
|
| 2013 | - $this->_readstream($f,4); |
|
| 2012 | + $data .= $this->_readstream($f, $n); |
|
| 2013 | + $this->_readstream($f, 4); |
|
| 2014 | 2014 | } |
| 2015 | - elseif($type=='IEND') |
|
| 2015 | + elseif ($type == 'IEND') |
|
| 2016 | 2016 | break; |
| 2017 | 2017 | else |
| 2018 | - $this->_readstream($f,$n+4); |
|
| 2018 | + $this->_readstream($f, $n + 4); |
|
| 2019 | 2019 | } |
| 2020 | - while($n); |
|
| 2020 | + while ($n); |
|
| 2021 | 2021 | |
| 2022 | - if($colspace=='Indexed' && empty($pal)) |
|
| 2023 | - $this->Error('Missing palette in '.$file);
|
|
| 2022 | + if ($colspace == 'Indexed' && empty($pal)) |
|
| 2023 | + $this->Error('Missing palette in ' . $file);
|
|
| 2024 | 2024 | $info = array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'dp'=>$dp, 'pal'=>$pal, 'trns'=>$trns);
|
| 2025 | - if($ct>=4) |
|
| 2025 | + if ($ct >= 4) |
|
| 2026 | 2026 | {
|
| 2027 | 2027 | // Extract alpha channel |
| 2028 | - if(!function_exists('gzuncompress'))
|
|
| 2029 | - $this->Error('Zlib not available, can\'t handle alpha channel: '.$file);
|
|
| 2028 | + if (!function_exists('gzuncompress'))
|
|
| 2029 | + $this->Error('Zlib not available, can\'t handle alpha channel: ' . $file);
|
|
| 2030 | 2030 | $data = gzuncompress($data); |
| 2031 | 2031 | $color = ''; |
| 2032 | 2032 | $alpha = ''; |
| 2033 | - if($ct==4) |
|
| 2033 | + if ($ct == 4) |
|
| 2034 | 2034 | {
|
| 2035 | 2035 | // Gray image |
| 2036 | - $len = 2*$w; |
|
| 2037 | - for($i=0;$i<$h;$i++) |
|
| 2036 | + $len = 2 * $w; |
|
| 2037 | + for ($i = 0; $i < $h; $i++) |
|
| 2038 | 2038 | {
|
| 2039 | - $pos = (1+$len)*$i; |
|
| 2039 | + $pos = (1 + $len) * $i; |
|
| 2040 | 2040 | $color .= $data[$pos]; |
| 2041 | 2041 | $alpha .= $data[$pos]; |
| 2042 | - $line = substr($data,$pos+1,$len); |
|
| 2043 | - $color .= preg_replace('/(.)./s','$1',$line);
|
|
| 2044 | - $alpha .= preg_replace('/.(.)/s','$1',$line);
|
|
| 2042 | + $line = substr($data, $pos + 1, $len); |
|
| 2043 | + $color .= preg_replace('/(.)./s', '$1', $line);
|
|
| 2044 | + $alpha .= preg_replace('/.(.)/s', '$1', $line);
|
|
| 2045 | 2045 | } |
| 2046 | 2046 | } |
| 2047 | 2047 | else |
| 2048 | 2048 | {
|
| 2049 | 2049 | // RGB image |
| 2050 | - $len = 4*$w; |
|
| 2051 | - for($i=0;$i<$h;$i++) |
|
| 2050 | + $len = 4 * $w; |
|
| 2051 | + for ($i = 0; $i < $h; $i++) |
|
| 2052 | 2052 | {
|
| 2053 | - $pos = (1+$len)*$i; |
|
| 2053 | + $pos = (1 + $len) * $i; |
|
| 2054 | 2054 | $color .= $data[$pos]; |
| 2055 | 2055 | $alpha .= $data[$pos]; |
| 2056 | - $line = substr($data,$pos+1,$len); |
|
| 2057 | - $color .= preg_replace('/(.{3})./s','$1',$line);
|
|
| 2058 | - $alpha .= preg_replace('/.{3}(.)/s','$1',$line);
|
|
| 2056 | + $line = substr($data, $pos + 1, $len); |
|
| 2057 | + $color .= preg_replace('/(.{3})./s', '$1', $line);
|
|
| 2058 | + $alpha .= preg_replace('/.{3}(.)/s', '$1', $line);
|
|
| 2059 | 2059 | } |
| 2060 | 2060 | } |
| 2061 | 2061 | unset($data); |
| 2062 | 2062 | $data = gzcompress($color); |
| 2063 | 2063 | $info['smask'] = gzcompress($alpha); |
| 2064 | 2064 | $this->WithAlpha = true; |
| 2065 | - if($this->PDFVersion<'1.4') |
|
| 2065 | + if ($this->PDFVersion < '1.4') |
|
| 2066 | 2066 | $this->PDFVersion = '1.4'; |
| 2067 | 2067 | } |
| 2068 | 2068 | $info['data'] = $data; |
@@ -2079,15 +2079,15 @@ discard block |
||
| 2079 | 2079 | {
|
| 2080 | 2080 | // Read n bytes from stream |
| 2081 | 2081 | $res = ''; |
| 2082 | - while($n>0 && !feof($f)) |
|
| 2082 | + while ($n > 0 && !feof($f)) |
|
| 2083 | 2083 | {
|
| 2084 | - $s = fread($f,$n); |
|
| 2085 | - if($s===false) |
|
| 2084 | + $s = fread($f, $n); |
|
| 2085 | + if ($s === false) |
|
| 2086 | 2086 | $this->Error('Error while reading stream');
|
| 2087 | 2087 | $n -= strlen($s); |
| 2088 | 2088 | $res .= $s; |
| 2089 | 2089 | } |
| 2090 | - if($n>0) |
|
| 2090 | + if ($n > 0) |
|
| 2091 | 2091 | $this->Error('Unexpected end of stream');
|
| 2092 | 2092 | return $res; |
| 2093 | 2093 | } |
@@ -2100,7 +2100,7 @@ discard block |
||
| 2100 | 2100 | protected function _readint($f) : int |
| 2101 | 2101 | {
|
| 2102 | 2102 | // Read a 4-byte integer from stream |
| 2103 | - $a = unpack('Ni',$this->_readstream($f,4));
|
|
| 2103 | + $a = unpack('Ni', $this->_readstream($f, 4));
|
|
| 2104 | 2104 | return $a['i']; |
| 2105 | 2105 | } |
| 2106 | 2106 | |
@@ -2112,24 +2112,24 @@ discard block |
||
| 2112 | 2112 | protected function _parsegif(string $file) : array |
| 2113 | 2113 | {
|
| 2114 | 2114 | // Extract info from a GIF file (via PNG conversion) |
| 2115 | - if(!function_exists('imagepng'))
|
|
| 2115 | + if (!function_exists('imagepng'))
|
|
| 2116 | 2116 | $this->Error('GD extension is required for GIF support');
|
| 2117 | - if(!function_exists('imagecreatefromgif'))
|
|
| 2117 | + if (!function_exists('imagecreatefromgif'))
|
|
| 2118 | 2118 | $this->Error('GD has no GIF read support');
|
| 2119 | 2119 | $im = imagecreatefromgif($file); |
| 2120 | - if(!$im) |
|
| 2121 | - $this->Error('Missing or incorrect image file: '.$file);
|
|
| 2122 | - imageinterlace($im,0); |
|
| 2120 | + if (!$im) |
|
| 2121 | + $this->Error('Missing or incorrect image file: ' . $file);
|
|
| 2122 | + imageinterlace($im, 0); |
|
| 2123 | 2123 | ob_start(); |
| 2124 | 2124 | imagepng($im); |
| 2125 | 2125 | $data = ob_get_clean(); |
| 2126 | 2126 | imagedestroy($im); |
| 2127 | - $f = fopen('php://temp','rb+');
|
|
| 2128 | - if(!$f) |
|
| 2127 | + $f = fopen('php://temp', 'rb+');
|
|
| 2128 | + if (!$f) |
|
| 2129 | 2129 | $this->Error('Unable to create memory stream');
|
| 2130 | - fwrite($f,$data); |
|
| 2130 | + fwrite($f, $data); |
|
| 2131 | 2131 | rewind($f); |
| 2132 | - $info = $this->_parsepngstream($f,$file); |
|
| 2132 | + $info = $this->_parsepngstream($f, $file); |
|
| 2133 | 2133 | fclose($f); |
| 2134 | 2134 | return $info; |
| 2135 | 2135 | } |
@@ -2141,13 +2141,13 @@ discard block |
||
| 2141 | 2141 | protected function _out(string $s) : void |
| 2142 | 2142 | {
|
| 2143 | 2143 | // Add a line to the document |
| 2144 | - if($this->state==2) |
|
| 2145 | - $this->pages[$this->page] .= $s."\n"; |
|
| 2146 | - elseif($this->state==1) |
|
| 2144 | + if ($this->state == 2) |
|
| 2145 | + $this->pages[$this->page] .= $s . "\n"; |
|
| 2146 | + elseif ($this->state == 1) |
|
| 2147 | 2147 | $this->_put($s); |
| 2148 | - elseif($this->state==0) |
|
| 2148 | + elseif ($this->state == 0) |
|
| 2149 | 2149 | $this->Error('No page has been added yet');
|
| 2150 | - elseif($this->state==3) |
|
| 2150 | + elseif ($this->state == 3) |
|
| 2151 | 2151 | $this->Error('The document is closed');
|
| 2152 | 2152 | } |
| 2153 | 2153 | |
@@ -2157,7 +2157,7 @@ discard block |
||
| 2157 | 2157 | */ |
| 2158 | 2158 | protected function _put(string $s) : void |
| 2159 | 2159 | {
|
| 2160 | - $this->buffer .= $s."\n"; |
|
| 2160 | + $this->buffer .= $s . "\n"; |
|
| 2161 | 2161 | } |
| 2162 | 2162 | |
| 2163 | 2163 | /** |
@@ -2173,13 +2173,13 @@ discard block |
||
| 2173 | 2173 | * Begin a new object. |
| 2174 | 2174 | * @param int $n |
| 2175 | 2175 | */ |
| 2176 | - protected function _newobj(?int $n=null) : void |
|
| 2176 | + protected function _newobj(?int $n = null) : void |
|
| 2177 | 2177 | {
|
| 2178 | 2178 | // Begin a new object |
| 2179 | - if($n===null) |
|
| 2179 | + if ($n === null) |
|
| 2180 | 2180 | $n = ++$this->n; |
| 2181 | 2181 | $this->offsets[$n] = $this->_getoffset(); |
| 2182 | - $this->_put($n.' 0 obj'); |
|
| 2182 | + $this->_put($n . ' 0 obj'); |
|
| 2183 | 2183 | } |
| 2184 | 2184 | |
| 2185 | 2185 | /** |
@@ -2199,16 +2199,16 @@ discard block |
||
| 2199 | 2199 | */ |
| 2200 | 2200 | protected function _putstreamobject(string $data) : void |
| 2201 | 2201 | {
|
| 2202 | - if($this->compress) |
|
| 2202 | + if ($this->compress) |
|
| 2203 | 2203 | {
|
| 2204 | 2204 | $entries = '/Filter /FlateDecode '; |
| 2205 | 2205 | $data = gzcompress($data); |
| 2206 | 2206 | } |
| 2207 | 2207 | else |
| 2208 | 2208 | $entries = ''; |
| 2209 | - $entries .= '/Length '.strlen($data); |
|
| 2209 | + $entries .= '/Length ' . strlen($data); |
|
| 2210 | 2210 | $this->_newobj(); |
| 2211 | - $this->_put('<<'.$entries.'>>');
|
|
| 2211 | + $this->_put('<<' . $entries . '>>');
|
|
| 2212 | 2212 | $this->_putstream($data); |
| 2213 | 2213 | $this->_put('endobj');
|
| 2214 | 2214 | } |
@@ -2222,39 +2222,39 @@ discard block |
||
| 2222 | 2222 | $this->_newobj(); |
| 2223 | 2223 | $this->_put('<</Type /Page');
|
| 2224 | 2224 | $this->_put('/Parent 1 0 R');
|
| 2225 | - if(isset($this->PageInfo[$n]['size'])) |
|
| 2226 | - $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageInfo[$n]['size'][0],$this->PageInfo[$n]['size'][1]));
|
|
| 2227 | - if(isset($this->PageInfo[$n]['rotation'])) |
|
| 2228 | - $this->_put('/Rotate '.$this->PageInfo[$n]['rotation']);
|
|
| 2225 | + if (isset($this->PageInfo[$n]['size'])) |
|
| 2226 | + $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]', $this->PageInfo[$n]['size'][0], $this->PageInfo[$n]['size'][1]));
|
|
| 2227 | + if (isset($this->PageInfo[$n]['rotation'])) |
|
| 2228 | + $this->_put('/Rotate ' . $this->PageInfo[$n]['rotation']);
|
|
| 2229 | 2229 | $this->_put('/Resources 2 0 R');
|
| 2230 | - if(isset($this->PageLinks[$n])) |
|
| 2230 | + if (isset($this->PageLinks[$n])) |
|
| 2231 | 2231 | {
|
| 2232 | 2232 | // Links |
| 2233 | 2233 | $annots = '/Annots ['; |
| 2234 | - foreach($this->PageLinks[$n] as $pl) |
|
| 2234 | + foreach ($this->PageLinks[$n] as $pl) |
|
| 2235 | 2235 | {
|
| 2236 | - $rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
|
|
| 2237 | - $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; |
|
| 2238 | - if(is_string($pl[4])) |
|
| 2239 | - $annots .= '/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; |
|
| 2236 | + $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]);
|
|
| 2237 | + $annots .= '<</Type /Annot /Subtype /Link /Rect [' . $rect . '] /Border [0 0 0] '; |
|
| 2238 | + if (is_string($pl[4])) |
|
| 2239 | + $annots .= '/A <</S /URI /URI ' . $this->_textstring($pl[4]) . '>>>>'; |
|
| 2240 | 2240 | else |
| 2241 | 2241 | {
|
| 2242 | 2242 | $l = $this->links[$pl[4]]; |
| 2243 | - if(isset($this->PageInfo[$l[0]]['size'])) |
|
| 2243 | + if (isset($this->PageInfo[$l[0]]['size'])) |
|
| 2244 | 2244 | $h = $this->PageInfo[$l[0]]['size'][1]; |
| 2245 | 2245 | else |
| 2246 | - $h = ($this->DefOrientation=='P') ? $this->DefPageSize[1]*$this->k : $this->DefPageSize[0]*$this->k; |
|
| 2247 | - $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',$this->PageInfo[$l[0]]['n'],$h-$l[1]*$this->k);
|
|
| 2246 | + $h = ($this->DefOrientation == 'P') ? $this->DefPageSize[1] * $this->k : $this->DefPageSize[0] * $this->k; |
|
| 2247 | + $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', $this->PageInfo[$l[0]]['n'], $h - $l[1] * $this->k);
|
|
| 2248 | 2248 | } |
| 2249 | 2249 | } |
| 2250 | - $this->_put($annots.']'); |
|
| 2250 | + $this->_put($annots . ']'); |
|
| 2251 | 2251 | } |
| 2252 | - if($this->WithAlpha) |
|
| 2252 | + if ($this->WithAlpha) |
|
| 2253 | 2253 | $this->_put('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
|
| 2254 | - $this->_put('/Contents '.($this->n+1).' 0 R>>');
|
|
| 2254 | + $this->_put('/Contents ' . ($this->n + 1) . ' 0 R>>');
|
|
| 2255 | 2255 | $this->_put('endobj');
|
| 2256 | 2256 | // Page content |
| 2257 | - if(!empty($this->AliasNbPages)) |
|
| 2257 | + if (!empty($this->AliasNbPages)) |
|
| 2258 | 2258 | $this->pages[$n] = str_replace($this->AliasNbPages, strval($this->page), $this->pages[$n]); |
| 2259 | 2259 | $this->_putstreamobject($this->pages[$n]); |
| 2260 | 2260 | } |
@@ -2265,19 +2265,19 @@ discard block |
||
| 2265 | 2265 | protected function _putpages() : void |
| 2266 | 2266 | {
|
| 2267 | 2267 | $nb = $this->page; |
| 2268 | - for($n=1;$n<=$nb;$n++) |
|
| 2269 | - $this->PageInfo[$n]['n'] = $this->n+1+2*($n-1); |
|
| 2270 | - for($n=1;$n<=$nb;$n++) |
|
| 2268 | + for ($n = 1; $n <= $nb; $n++) |
|
| 2269 | + $this->PageInfo[$n]['n'] = $this->n + 1 + 2 * ($n - 1); |
|
| 2270 | + for ($n = 1; $n <= $nb; $n++) |
|
| 2271 | 2271 | $this->_putpage($n); |
| 2272 | 2272 | // Pages root |
| 2273 | 2273 | $this->_newobj(1); |
| 2274 | 2274 | $this->_put('<</Type /Pages');
|
| 2275 | 2275 | $kids = '/Kids ['; |
| 2276 | - for($n=1;$n<=$nb;$n++) |
|
| 2277 | - $kids .= $this->PageInfo[$n]['n'].' 0 R '; |
|
| 2278 | - $this->_put($kids.']'); |
|
| 2279 | - $this->_put('/Count '.$nb);
|
|
| 2280 | - if($this->DefOrientation=='P') |
|
| 2276 | + for ($n = 1; $n <= $nb; $n++) |
|
| 2277 | + $kids .= $this->PageInfo[$n]['n'] . ' 0 R '; |
|
| 2278 | + $this->_put($kids . ']'); |
|
| 2279 | + $this->_put('/Count ' . $nb);
|
|
| 2280 | + if ($this->DefOrientation == 'P') |
|
| 2281 | 2281 | {
|
| 2282 | 2282 | $w = $this->DefPageSize[0]; |
| 2283 | 2283 | $h = $this->DefPageSize[1]; |
@@ -2287,7 +2287,7 @@ discard block |
||
| 2287 | 2287 | $w = $this->DefPageSize[1]; |
| 2288 | 2288 | $h = $this->DefPageSize[0]; |
| 2289 | 2289 | } |
| 2290 | - $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$w*$this->k,$h*$this->k));
|
|
| 2290 | + $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]', $w * $this->k, $h * $this->k));
|
|
| 2291 | 2291 | $this->_put('>>');
|
| 2292 | 2292 | $this->_put('endobj');
|
| 2293 | 2293 | } |
@@ -2297,49 +2297,49 @@ discard block |
||
| 2297 | 2297 | */ |
| 2298 | 2298 | protected function _putfonts() : void |
| 2299 | 2299 | {
|
| 2300 | - foreach($this->FontFiles as $file=>$info) |
|
| 2300 | + foreach ($this->FontFiles as $file=>$info) |
|
| 2301 | 2301 | {
|
| 2302 | 2302 | // Font file embedding |
| 2303 | 2303 | $this->_newobj(); |
| 2304 | 2304 | $this->FontFiles[$file]['n'] = $this->n; |
| 2305 | - $font = file_get_contents($this->fontpath.$file,true); |
|
| 2306 | - if(!$font) |
|
| 2307 | - $this->Error('Font file not found: '.$file);
|
|
| 2308 | - $compressed = (substr($file,-2)=='.z'); |
|
| 2309 | - if(!$compressed && isset($info['length2'])) |
|
| 2310 | - $font = substr($font,6,$info['length1']).substr($font,6+$info['length1']+6,$info['length2']); |
|
| 2311 | - $this->_put('<</Length '.strlen($font));
|
|
| 2312 | - if($compressed) |
|
| 2305 | + $font = file_get_contents($this->fontpath . $file, true); |
|
| 2306 | + if (!$font) |
|
| 2307 | + $this->Error('Font file not found: ' . $file);
|
|
| 2308 | + $compressed = (substr($file, -2) == '.z'); |
|
| 2309 | + if (!$compressed && isset($info['length2'])) |
|
| 2310 | + $font = substr($font, 6, $info['length1']) . substr($font, 6 + $info['length1'] + 6, $info['length2']); |
|
| 2311 | + $this->_put('<</Length ' . strlen($font));
|
|
| 2312 | + if ($compressed) |
|
| 2313 | 2313 | $this->_put('/Filter /FlateDecode');
|
| 2314 | - $this->_put('/Length1 '.$info['length1']);
|
|
| 2315 | - if(isset($info['length2'])) |
|
| 2316 | - $this->_put('/Length2 '.$info['length2'].' /Length3 0');
|
|
| 2314 | + $this->_put('/Length1 ' . $info['length1']);
|
|
| 2315 | + if (isset($info['length2'])) |
|
| 2316 | + $this->_put('/Length2 ' . $info['length2'] . ' /Length3 0');
|
|
| 2317 | 2317 | $this->_put('>>');
|
| 2318 | 2318 | $this->_putstream($font); |
| 2319 | 2319 | $this->_put('endobj');
|
| 2320 | 2320 | } |
| 2321 | - foreach($this->fonts as $k=>$font) |
|
| 2321 | + foreach ($this->fonts as $k=>$font) |
|
| 2322 | 2322 | {
|
| 2323 | 2323 | // Encoding |
| 2324 | - if(isset($font['diff'])) |
|
| 2324 | + if (isset($font['diff'])) |
|
| 2325 | 2325 | {
|
| 2326 | - if(!isset($this->encodings[$font['enc']])) |
|
| 2326 | + if (!isset($this->encodings[$font['enc']])) |
|
| 2327 | 2327 | {
|
| 2328 | 2328 | $this->_newobj(); |
| 2329 | - $this->_put('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$font['diff'].']>>');
|
|
| 2329 | + $this->_put('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $font['diff'] . ']>>');
|
|
| 2330 | 2330 | $this->_put('endobj');
|
| 2331 | 2331 | $this->encodings[$font['enc']] = $this->n; |
| 2332 | 2332 | } |
| 2333 | 2333 | } |
| 2334 | 2334 | // ToUnicode CMap |
| 2335 | 2335 | $cmapkey = ''; |
| 2336 | - if(isset($font['uv'])) |
|
| 2336 | + if (isset($font['uv'])) |
|
| 2337 | 2337 | {
|
| 2338 | - if(isset($font['enc'])) |
|
| 2338 | + if (isset($font['enc'])) |
|
| 2339 | 2339 | $cmapkey = $font['enc']; |
| 2340 | 2340 | else |
| 2341 | 2341 | $cmapkey = $font['name']; |
| 2342 | - if(!isset($this->cmaps[$cmapkey])) |
|
| 2342 | + if (!isset($this->cmaps[$cmapkey])) |
|
| 2343 | 2343 | {
|
| 2344 | 2344 | $cmap = $this->_tounicodecmap($font['uv']); |
| 2345 | 2345 | $this->_putstreamobject($cmap); |
@@ -2347,67 +2347,67 @@ discard block |
||
| 2347 | 2347 | } |
| 2348 | 2348 | } |
| 2349 | 2349 | // Font object |
| 2350 | - $this->fonts[$k]['n'] = $this->n+1; |
|
| 2350 | + $this->fonts[$k]['n'] = $this->n + 1; |
|
| 2351 | 2351 | $type = $font['type']; |
| 2352 | 2352 | $name = $font['name']; |
| 2353 | - if($font['subsetted']) |
|
| 2354 | - $name = 'AAAAAA+'.$name; |
|
| 2355 | - if($type=='Core') |
|
| 2353 | + if ($font['subsetted']) |
|
| 2354 | + $name = 'AAAAAA+' . $name; |
|
| 2355 | + if ($type == 'Core') |
|
| 2356 | 2356 | {
|
| 2357 | 2357 | // Core font |
| 2358 | 2358 | $this->_newobj(); |
| 2359 | 2359 | $this->_put('<</Type /Font');
|
| 2360 | - $this->_put('/BaseFont /'.$name);
|
|
| 2360 | + $this->_put('/BaseFont /' . $name);
|
|
| 2361 | 2361 | $this->_put('/Subtype /Type1');
|
| 2362 | - if($name!='Symbol' && $name!='ZapfDingbats') |
|
| 2362 | + if ($name != 'Symbol' && $name != 'ZapfDingbats') |
|
| 2363 | 2363 | $this->_put('/Encoding /WinAnsiEncoding');
|
| 2364 | - if(isset($font['uv'])) |
|
| 2365 | - $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
|
|
| 2364 | + if (isset($font['uv'])) |
|
| 2365 | + $this->_put('/ToUnicode ' . $this->cmaps[$cmapkey] . ' 0 R');
|
|
| 2366 | 2366 | $this->_put('>>');
|
| 2367 | 2367 | $this->_put('endobj');
|
| 2368 | 2368 | } |
| 2369 | - elseif($type=='Type1' || $type=='TrueType') |
|
| 2369 | + elseif ($type == 'Type1' || $type == 'TrueType') |
|
| 2370 | 2370 | {
|
| 2371 | 2371 | // Additional Type1 or TrueType/OpenType font |
| 2372 | 2372 | $this->_newobj(); |
| 2373 | 2373 | $this->_put('<</Type /Font');
|
| 2374 | - $this->_put('/BaseFont /'.$name);
|
|
| 2375 | - $this->_put('/Subtype /'.$type);
|
|
| 2374 | + $this->_put('/BaseFont /' . $name);
|
|
| 2375 | + $this->_put('/Subtype /' . $type);
|
|
| 2376 | 2376 | $this->_put('/FirstChar 32 /LastChar 255');
|
| 2377 | - $this->_put('/Widths '.($this->n+1).' 0 R');
|
|
| 2378 | - $this->_put('/FontDescriptor '.($this->n+2).' 0 R');
|
|
| 2379 | - if(isset($font['diff'])) |
|
| 2380 | - $this->_put('/Encoding '.$this->encodings[$font['enc']].' 0 R');
|
|
| 2377 | + $this->_put('/Widths ' . ($this->n + 1) . ' 0 R');
|
|
| 2378 | + $this->_put('/FontDescriptor ' . ($this->n + 2) . ' 0 R');
|
|
| 2379 | + if (isset($font['diff'])) |
|
| 2380 | + $this->_put('/Encoding ' . $this->encodings[$font['enc']] . ' 0 R');
|
|
| 2381 | 2381 | else |
| 2382 | 2382 | $this->_put('/Encoding /WinAnsiEncoding');
|
| 2383 | - if(isset($font['uv'])) |
|
| 2384 | - $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
|
|
| 2383 | + if (isset($font['uv'])) |
|
| 2384 | + $this->_put('/ToUnicode ' . $this->cmaps[$cmapkey] . ' 0 R');
|
|
| 2385 | 2385 | $this->_put('>>');
|
| 2386 | 2386 | $this->_put('endobj');
|
| 2387 | 2387 | // Widths |
| 2388 | 2388 | $this->_newobj(); |
| 2389 | 2389 | $cw = &$font['cw']; |
| 2390 | 2390 | $s = '['; |
| 2391 | - for($i=32;$i<=255;$i++) |
|
| 2392 | - $s .= $cw[chr($i)].' '; |
|
| 2393 | - $this->_put($s.']'); |
|
| 2391 | + for ($i = 32; $i <= 255; $i++) |
|
| 2392 | + $s .= $cw[chr($i)] . ' '; |
|
| 2393 | + $this->_put($s . ']'); |
|
| 2394 | 2394 | $this->_put('endobj');
|
| 2395 | 2395 | // Descriptor |
| 2396 | 2396 | $this->_newobj(); |
| 2397 | - $s = '<</Type /FontDescriptor /FontName /'.$name; |
|
| 2398 | - foreach($font['desc'] as $k=>$v) |
|
| 2399 | - $s .= ' /'.$k.' '.$v; |
|
| 2400 | - if(!empty($font['file'])) |
|
| 2401 | - $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R'; |
|
| 2402 | - $this->_put($s.'>>'); |
|
| 2397 | + $s = '<</Type /FontDescriptor /FontName /' . $name; |
|
| 2398 | + foreach ($font['desc'] as $k=>$v) |
|
| 2399 | + $s .= ' /' . $k . ' ' . $v; |
|
| 2400 | + if (!empty($font['file'])) |
|
| 2401 | + $s .= ' /FontFile' . ($type == 'Type1' ? '' : '2') . ' ' . $this->FontFiles[$font['file']]['n'] . ' 0 R'; |
|
| 2402 | + $this->_put($s . '>>'); |
|
| 2403 | 2403 | $this->_put('endobj');
|
| 2404 | 2404 | } |
| 2405 | 2405 | else |
| 2406 | 2406 | {
|
| 2407 | 2407 | // Allow for additional types |
| 2408 | - $mtd = '_put'.strtolower($type); |
|
| 2409 | - if(!method_exists($this,$mtd)) |
|
| 2410 | - $this->Error('Unsupported font type: '.$type);
|
|
| 2408 | + $mtd = '_put' . strtolower($type); |
|
| 2409 | + if (!method_exists($this, $mtd)) |
|
| 2410 | + $this->Error('Unsupported font type: ' . $type);
|
|
| 2411 | 2411 | $this->$mtd($font); |
| 2412 | 2412 | } |
| 2413 | 2413 | } |
@@ -2423,16 +2423,16 @@ discard block |
||
| 2423 | 2423 | $nbr = 0; |
| 2424 | 2424 | $chars = ''; |
| 2425 | 2425 | $nbc = 0; |
| 2426 | - foreach($uv as $c=>$v) |
|
| 2426 | + foreach ($uv as $c=>$v) |
|
| 2427 | 2427 | {
|
| 2428 | - if(is_array($v)) |
|
| 2428 | + if (is_array($v)) |
|
| 2429 | 2429 | {
|
| 2430 | - $ranges .= sprintf("<%02X> <%02X> <%04X>\n",$c,$c+$v[1]-1,$v[0]);
|
|
| 2430 | + $ranges .= sprintf("<%02X> <%02X> <%04X>\n", $c, $c + $v[1] - 1, $v[0]);
|
|
| 2431 | 2431 | $nbr++; |
| 2432 | 2432 | } |
| 2433 | 2433 | else |
| 2434 | 2434 | {
|
| 2435 | - $chars .= sprintf("<%02X> <%04X>\n",$c,$v);
|
|
| 2435 | + $chars .= sprintf("<%02X> <%04X>\n", $c, $v);
|
|
| 2436 | 2436 | $nbc++; |
| 2437 | 2437 | } |
| 2438 | 2438 | } |
@@ -2449,13 +2449,13 @@ discard block |
||
| 2449 | 2449 | $s .= "1 begincodespacerange\n"; |
| 2450 | 2450 | $s .= "<00> <FF>\n"; |
| 2451 | 2451 | $s .= "endcodespacerange\n"; |
| 2452 | - if($nbr>0) |
|
| 2452 | + if ($nbr > 0) |
|
| 2453 | 2453 | {
|
| 2454 | 2454 | $s .= "$nbr beginbfrange\n"; |
| 2455 | 2455 | $s .= $ranges; |
| 2456 | 2456 | $s .= "endbfrange\n"; |
| 2457 | 2457 | } |
| 2458 | - if($nbc>0) |
|
| 2458 | + if ($nbc > 0) |
|
| 2459 | 2459 | {
|
| 2460 | 2460 | $s .= "$nbc beginbfchar\n"; |
| 2461 | 2461 | $s .= $chars; |
@@ -2473,7 +2473,7 @@ discard block |
||
| 2473 | 2473 | */ |
| 2474 | 2474 | protected function _putimages() : void |
| 2475 | 2475 | {
|
| 2476 | - foreach(array_keys($this->images) as $file) |
|
| 2476 | + foreach (array_keys($this->images) as $file) |
|
| 2477 | 2477 | {
|
| 2478 | 2478 | $this->_putimage($this->images[$file]); |
| 2479 | 2479 | unset($this->images[$file]['data']); |
@@ -2491,42 +2491,42 @@ discard block |
||
| 2491 | 2491 | $info['n'] = $this->n; |
| 2492 | 2492 | $this->_put('<</Type /XObject');
|
| 2493 | 2493 | $this->_put('/Subtype /Image');
|
| 2494 | - $this->_put('/Width '.$info['w']);
|
|
| 2495 | - $this->_put('/Height '.$info['h']);
|
|
| 2496 | - if($info['cs']=='Indexed') |
|
| 2497 | - $this->_put('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
|
|
| 2494 | + $this->_put('/Width ' . $info['w']);
|
|
| 2495 | + $this->_put('/Height ' . $info['h']);
|
|
| 2496 | + if ($info['cs'] == 'Indexed') |
|
| 2497 | + $this->_put('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->n + 1) . ' 0 R]');
|
|
| 2498 | 2498 | else |
| 2499 | 2499 | {
|
| 2500 | - $this->_put('/ColorSpace /'.$info['cs']);
|
|
| 2501 | - if($info['cs']=='DeviceCMYK') |
|
| 2500 | + $this->_put('/ColorSpace /' . $info['cs']);
|
|
| 2501 | + if ($info['cs'] == 'DeviceCMYK') |
|
| 2502 | 2502 | $this->_put('/Decode [1 0 1 0 1 0 1 0]');
|
| 2503 | 2503 | } |
| 2504 | - $this->_put('/BitsPerComponent '.$info['bpc']);
|
|
| 2505 | - if(isset($info['f'])) |
|
| 2506 | - $this->_put('/Filter /'.$info['f']);
|
|
| 2507 | - if(isset($info['dp'])) |
|
| 2508 | - $this->_put('/DecodeParms <<'.$info['dp'].'>>');
|
|
| 2509 | - if(isset($info['trns']) && is_array($info['trns'])) |
|
| 2504 | + $this->_put('/BitsPerComponent ' . $info['bpc']);
|
|
| 2505 | + if (isset($info['f'])) |
|
| 2506 | + $this->_put('/Filter /' . $info['f']);
|
|
| 2507 | + if (isset($info['dp'])) |
|
| 2508 | + $this->_put('/DecodeParms <<' . $info['dp'] . '>>');
|
|
| 2509 | + if (isset($info['trns']) && is_array($info['trns'])) |
|
| 2510 | 2510 | {
|
| 2511 | 2511 | $trns = ''; |
| 2512 | - for($i=0;$i<count($info['trns']);$i++) |
|
| 2513 | - $trns .= $info['trns'][$i].' '.$info['trns'][$i].' '; |
|
| 2514 | - $this->_put('/Mask ['.$trns.']');
|
|
| 2512 | + for ($i = 0; $i < count($info['trns']); $i++) |
|
| 2513 | + $trns .= $info['trns'][$i] . ' ' . $info['trns'][$i] . ' '; |
|
| 2514 | + $this->_put('/Mask [' . $trns . ']');
|
|
| 2515 | 2515 | } |
| 2516 | - if(isset($info['smask'])) |
|
| 2517 | - $this->_put('/SMask '.($this->n+1).' 0 R');
|
|
| 2518 | - $this->_put('/Length '.strlen($info['data']).'>>');
|
|
| 2516 | + if (isset($info['smask'])) |
|
| 2517 | + $this->_put('/SMask ' . ($this->n + 1) . ' 0 R');
|
|
| 2518 | + $this->_put('/Length ' . strlen($info['data']) . '>>');
|
|
| 2519 | 2519 | $this->_putstream($info['data']); |
| 2520 | 2520 | $this->_put('endobj');
|
| 2521 | 2521 | // Soft mask |
| 2522 | - if(isset($info['smask'])) |
|
| 2522 | + if (isset($info['smask'])) |
|
| 2523 | 2523 | {
|
| 2524 | - $dp = '/Predictor 15 /Colors 1 /BitsPerComponent 8 /Columns '.$info['w']; |
|
| 2524 | + $dp = '/Predictor 15 /Colors 1 /BitsPerComponent 8 /Columns ' . $info['w']; |
|
| 2525 | 2525 | $smask = array('w'=>$info['w'], 'h'=>$info['h'], 'cs'=>'DeviceGray', 'bpc'=>8, 'f'=>$info['f'], 'dp'=>$dp, 'data'=>$info['smask']);
|
| 2526 | 2526 | $this->_putimage($smask); |
| 2527 | 2527 | } |
| 2528 | 2528 | // Palette |
| 2529 | - if($info['cs']=='Indexed') |
|
| 2529 | + if ($info['cs'] == 'Indexed') |
|
| 2530 | 2530 | $this->_putstreamobject($info['pal']); |
| 2531 | 2531 | } |
| 2532 | 2532 | |
@@ -2535,8 +2535,8 @@ discard block |
||
| 2535 | 2535 | */ |
| 2536 | 2536 | protected function _putxobjectdict() : void |
| 2537 | 2537 | {
|
| 2538 | - foreach($this->images as $image) |
|
| 2539 | - $this->_put('/I'.$image['i'].' '.$image['n'].' 0 R');
|
|
| 2538 | + foreach ($this->images as $image) |
|
| 2539 | + $this->_put('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
|
|
| 2540 | 2540 | } |
| 2541 | 2541 | |
| 2542 | 2542 | /** |
@@ -2546,8 +2546,8 @@ discard block |
||
| 2546 | 2546 | {
|
| 2547 | 2547 | $this->_put('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
|
| 2548 | 2548 | $this->_put('/Font <<');
|
| 2549 | - foreach($this->fonts as $font) |
|
| 2550 | - $this->_put('/F'.$font['i'].' '.$font['n'].' 0 R');
|
|
| 2549 | + foreach ($this->fonts as $font) |
|
| 2550 | + $this->_put('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
|
|
| 2551 | 2551 | $this->_put('>>');
|
| 2552 | 2552 | $this->_put('/XObject <<');
|
| 2553 | 2553 | $this->_putxobjectdict(); |
@@ -2574,10 +2574,10 @@ discard block |
||
| 2574 | 2574 | */ |
| 2575 | 2575 | protected function _putinfo() : void |
| 2576 | 2576 | {
|
| 2577 | - $this->metadata['Producer'] = 'FPDF '.FPDF_VERSION; |
|
| 2578 | - $this->metadata['CreationDate'] = 'D:'.@date('YmdHis');
|
|
| 2579 | - foreach($this->metadata as $key=>$value) |
|
| 2580 | - $this->_put('/'.$key.' '.$this->_textstring($value));
|
|
| 2577 | + $this->metadata['Producer'] = 'FPDF ' . FPDF_VERSION; |
|
| 2578 | + $this->metadata['CreationDate'] = 'D:' . @date('YmdHis');
|
|
| 2579 | + foreach ($this->metadata as $key=>$value) |
|
| 2580 | + $this->_put('/' . $key . ' ' . $this->_textstring($value));
|
|
| 2581 | 2581 | } |
| 2582 | 2582 | |
| 2583 | 2583 | /** |
@@ -2588,19 +2588,19 @@ discard block |
||
| 2588 | 2588 | $n = $this->PageInfo[1]['n']; |
| 2589 | 2589 | $this->_put('/Type /Catalog');
|
| 2590 | 2590 | $this->_put('/Pages 1 0 R');
|
| 2591 | - if($this->ZoomMode=='fullpage') |
|
| 2592 | - $this->_put('/OpenAction ['.$n.' 0 R /Fit]');
|
|
| 2593 | - elseif($this->ZoomMode=='fullwidth') |
|
| 2594 | - $this->_put('/OpenAction ['.$n.' 0 R /FitH null]');
|
|
| 2595 | - elseif($this->ZoomMode=='real') |
|
| 2596 | - $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null 1]');
|
|
| 2597 | - elseif(!is_string($this->ZoomMode)) |
|
| 2598 | - $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']');
|
|
| 2599 | - if($this->LayoutMode=='single') |
|
| 2591 | + if ($this->ZoomMode == 'fullpage') |
|
| 2592 | + $this->_put('/OpenAction [' . $n . ' 0 R /Fit]');
|
|
| 2593 | + elseif ($this->ZoomMode == 'fullwidth') |
|
| 2594 | + $this->_put('/OpenAction [' . $n . ' 0 R /FitH null]');
|
|
| 2595 | + elseif ($this->ZoomMode == 'real') |
|
| 2596 | + $this->_put('/OpenAction [' . $n . ' 0 R /XYZ null null 1]');
|
|
| 2597 | + elseif (!is_string($this->ZoomMode)) |
|
| 2598 | + $this->_put('/OpenAction [' . $n . ' 0 R /XYZ null null ' . sprintf('%.2F', $this->ZoomMode / 100) . ']');
|
|
| 2599 | + if ($this->LayoutMode == 'single') |
|
| 2600 | 2600 | $this->_put('/PageLayout /SinglePage');
|
| 2601 | - elseif($this->LayoutMode=='continuous') |
|
| 2601 | + elseif ($this->LayoutMode == 'continuous') |
|
| 2602 | 2602 | $this->_put('/PageLayout /OneColumn');
|
| 2603 | - elseif($this->LayoutMode=='two') |
|
| 2603 | + elseif ($this->LayoutMode == 'two') |
|
| 2604 | 2604 | $this->_put('/PageLayout /TwoColumnLeft');
|
| 2605 | 2605 | } |
| 2606 | 2606 | |
@@ -2609,7 +2609,7 @@ discard block |
||
| 2609 | 2609 | */ |
| 2610 | 2610 | protected function _putheader() : void |
| 2611 | 2611 | {
|
| 2612 | - $this->_put('%PDF-'.$this->PDFVersion);
|
|
| 2612 | + $this->_put('%PDF-' . $this->PDFVersion);
|
|
| 2613 | 2613 | } |
| 2614 | 2614 | |
| 2615 | 2615 | /** |
@@ -2617,9 +2617,9 @@ discard block |
||
| 2617 | 2617 | */ |
| 2618 | 2618 | protected function _puttrailer() : void |
| 2619 | 2619 | {
|
| 2620 | - $this->_put('/Size '.($this->n+1));
|
|
| 2621 | - $this->_put('/Root '.$this->n.' 0 R');
|
|
| 2622 | - $this->_put('/Info '.($this->n-1).' 0 R');
|
|
| 2620 | + $this->_put('/Size ' . ($this->n + 1));
|
|
| 2621 | + $this->_put('/Root ' . $this->n . ' 0 R');
|
|
| 2622 | + $this->_put('/Info ' . ($this->n - 1) . ' 0 R');
|
|
| 2623 | 2623 | } |
| 2624 | 2624 | |
| 2625 | 2625 | /** |
@@ -2645,10 +2645,10 @@ discard block |
||
| 2645 | 2645 | // Cross-ref |
| 2646 | 2646 | $offset = $this->_getoffset(); |
| 2647 | 2647 | $this->_put('xref');
|
| 2648 | - $this->_put('0 '.($this->n+1));
|
|
| 2648 | + $this->_put('0 ' . ($this->n + 1));
|
|
| 2649 | 2649 | $this->_put('0000000000 65535 f ');
|
| 2650 | - for($i=1;$i<=$this->n;$i++) |
|
| 2651 | - $this->_put(sprintf('%010d 00000 n ',$this->offsets[$i]));
|
|
| 2650 | + for ($i = 1; $i <= $this->n; $i++) |
|
| 2651 | + $this->_put(sprintf('%010d 00000 n ', $this->offsets[$i]));
|
|
| 2652 | 2652 | // Trailer |
| 2653 | 2653 | $this->_put('trailer');
|
| 2654 | 2654 | $this->_put('<<');
|
@@ -207,26 +207,28 @@ discard block |
||
| 207 | 207 | if(defined('FPDF_FONTPATH'))
|
| 208 | 208 | {
|
| 209 | 209 | $this->fontpath = FPDF_FONTPATH; |
| 210 | - if(substr($this->fontpath,-1)!='/' && substr($this->fontpath,-1)!='\\') |
|
| 211 | - $this->fontpath .= '/'; |
|
| 210 | + if(substr($this->fontpath,-1)!='/' && substr($this->fontpath,-1)!='\\') {
|
|
| 211 | + $this->fontpath .= '/'; |
|
| 212 | + } |
|
| 213 | + } elseif(is_dir(dirname(__FILE__).'/font')) {
|
|
| 214 | + $this->fontpath = dirname(__FILE__).'/font/'; |
|
| 215 | + } else {
|
|
| 216 | + $this->fontpath = ''; |
|
| 212 | 217 | } |
| 213 | - elseif(is_dir(dirname(__FILE__).'/font')) |
|
| 214 | - $this->fontpath = dirname(__FILE__).'/font/'; |
|
| 215 | - else |
|
| 216 | - $this->fontpath = ''; |
|
| 217 | 218 | // Core fonts |
| 218 | 219 | $this->CoreFonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats');
|
| 219 | 220 | // Scale factor |
| 220 | - if($unit=='pt') |
|
| 221 | - $this->k = 1; |
|
| 222 | - elseif($unit=='mm') |
|
| 223 | - $this->k = 72/25.4; |
|
| 224 | - elseif($unit=='cm') |
|
| 225 | - $this->k = 72/2.54; |
|
| 226 | - elseif($unit=='in') |
|
| 227 | - $this->k = 72; |
|
| 228 | - else |
|
| 229 | - $this->Error('Incorrect unit: '.$unit);
|
|
| 221 | + if($unit=='pt') {
|
|
| 222 | + $this->k = 1; |
|
| 223 | + } elseif($unit=='mm') {
|
|
| 224 | + $this->k = 72/25.4; |
|
| 225 | + } elseif($unit=='cm') {
|
|
| 226 | + $this->k = 72/2.54; |
|
| 227 | + } elseif($unit=='in') {
|
|
| 228 | + $this->k = 72; |
|
| 229 | + } else {
|
|
| 230 | + $this->Error('Incorrect unit: '.$unit);
|
|
| 231 | + } |
|
| 230 | 232 | // Page sizes |
| 231 | 233 | $this->StdPageSizes = array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
|
| 232 | 234 | 'letter'=>array(612,792), 'legal'=>array(612,1008)); |
@@ -240,15 +242,14 @@ discard block |
||
| 240 | 242 | $this->DefOrientation = 'P'; |
| 241 | 243 | $this->w = $size[0]; |
| 242 | 244 | $this->h = $size[1]; |
| 243 | - } |
|
| 244 | - elseif($orientation=='l' || $orientation=='landscape') |
|
| 245 | + } elseif($orientation=='l' || $orientation=='landscape') |
|
| 245 | 246 | {
|
| 246 | 247 | $this->DefOrientation = 'L'; |
| 247 | 248 | $this->w = $size[1]; |
| 248 | 249 | $this->h = $size[0]; |
| 250 | + } else {
|
|
| 251 | + $this->Error('Incorrect orientation: '.$orientation);
|
|
| 249 | 252 | } |
| 250 | - else |
|
| 251 | - $this->Error('Incorrect orientation: '.$orientation);
|
|
| 252 | 253 | $this->CurOrientation = $this->DefOrientation; |
| 253 | 254 | $this->wPt = $this->w*$this->k; |
| 254 | 255 | $this->hPt = $this->h*$this->k; |
@@ -283,8 +284,9 @@ discard block |
||
| 283 | 284 | // Set left, top and right margins |
| 284 | 285 | $this->lMargin = $left; |
| 285 | 286 | $this->tMargin = $top; |
| 286 | - if($right===null) |
|
| 287 | - $right = $left; |
|
| 287 | + if($right===null) {
|
|
| 288 | + $right = $left; |
|
| 289 | + } |
|
| 288 | 290 | $this->rMargin = $right; |
| 289 | 291 | } |
| 290 | 292 | |
@@ -298,8 +300,9 @@ discard block |
||
| 298 | 300 | {
|
| 299 | 301 | // Set left margin |
| 300 | 302 | $this->lMargin = $margin; |
| 301 | - if($this->page>0 && $this->x<$margin) |
|
| 302 | - $this->x = $margin; |
|
| 303 | + if($this->page>0 && $this->x<$margin) {
|
|
| 304 | + $this->x = $margin; |
|
| 305 | + } |
|
| 303 | 306 | } |
| 304 | 307 | |
| 305 | 308 | /** |
@@ -371,14 +374,16 @@ discard block |
||
| 371 | 374 | public function SetDisplayMode($zoom, string $layout='default') : void |
| 372 | 375 | {
|
| 373 | 376 | // Set display mode in viewer |
| 374 | - if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) |
|
| 375 | - $this->ZoomMode = $zoom; |
|
| 376 | - else |
|
| 377 | - $this->Error('Incorrect zoom display mode: '.$zoom);
|
|
| 378 | - if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') |
|
| 379 | - $this->LayoutMode = $layout; |
|
| 380 | - else |
|
| 381 | - $this->Error('Incorrect layout display mode: '.$layout);
|
|
| 377 | + if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) {
|
|
| 378 | + $this->ZoomMode = $zoom; |
|
| 379 | + } else {
|
|
| 380 | + $this->Error('Incorrect zoom display mode: '.$zoom);
|
|
| 381 | + } |
|
| 382 | + if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') {
|
|
| 383 | + $this->LayoutMode = $layout; |
|
| 384 | + } else {
|
|
| 385 | + $this->Error('Incorrect layout display mode: '.$layout);
|
|
| 386 | + } |
|
| 382 | 387 | } |
| 383 | 388 | |
| 384 | 389 | /** |
@@ -393,10 +398,11 @@ discard block |
||
| 393 | 398 | public function SetCompression(bool $compress) : void |
| 394 | 399 | {
|
| 395 | 400 | // Set page compression |
| 396 | - if(function_exists('gzcompress'))
|
|
| 397 | - $this->compress = $compress; |
|
| 398 | - else |
|
| 399 | - $this->compress = false; |
|
| 401 | + if(function_exists('gzcompress')) {
|
|
| 402 | + $this->compress = $compress; |
|
| 403 | + } else {
|
|
| 404 | + $this->compress = false; |
|
| 405 | + } |
|
| 400 | 406 | } |
| 401 | 407 | |
| 402 | 408 | /** |
@@ -487,10 +493,12 @@ discard block |
||
| 487 | 493 | public function Close() : void |
| 488 | 494 | {
|
| 489 | 495 | // Terminate document |
| 490 | - if($this->state==3) |
|
| 491 | - return; |
|
| 492 | - if($this->page==0) |
|
| 493 | - $this->addPage(); |
|
| 496 | + if($this->state==3) {
|
|
| 497 | + return; |
|
| 498 | + } |
|
| 499 | + if($this->page==0) {
|
|
| 500 | + $this->addPage(); |
|
| 501 | + } |
|
| 494 | 502 | // Page footer |
| 495 | 503 | $this->InFooter = true; |
| 496 | 504 | $this->Footer(); |
@@ -532,8 +540,9 @@ discard block |
||
| 532 | 540 | public function AddPage(string $orientation='', $size='', int $rotation=0) : void |
| 533 | 541 | {
|
| 534 | 542 | // Start a new page |
| 535 | - if($this->state==3) |
|
| 536 | - $this->Error('The document is closed');
|
|
| 543 | + if($this->state==3) {
|
|
| 544 | + $this->Error('The document is closed');
|
|
| 545 | + } |
|
| 537 | 546 | $family = $this->FontFamily; |
| 538 | 547 | $style = $this->FontStyle.($this->underline ? 'U' : ''); |
| 539 | 548 | $fontsize = $this->FontSizePt; |
@@ -559,15 +568,18 @@ discard block |
||
| 559 | 568 | $this->LineWidth = $lw; |
| 560 | 569 | $this->_out(sprintf('%.2F w',$lw*$this->k));
|
| 561 | 570 | // Set font |
| 562 | - if($family) |
|
| 563 | - $this->setFont($family,$style,$fontsize); |
|
| 571 | + if($family) {
|
|
| 572 | + $this->setFont($family,$style,$fontsize); |
|
| 573 | + } |
|
| 564 | 574 | // Set colors |
| 565 | 575 | $this->DrawColor = $dc; |
| 566 | - if($dc!='0 G') |
|
| 567 | - $this->_out($dc); |
|
| 576 | + if($dc!='0 G') {
|
|
| 577 | + $this->_out($dc); |
|
| 578 | + } |
|
| 568 | 579 | $this->FillColor = $fc; |
| 569 | - if($fc!='0 g') |
|
| 570 | - $this->_out($fc); |
|
| 580 | + if($fc!='0 g') {
|
|
| 581 | + $this->_out($fc); |
|
| 582 | + } |
|
| 571 | 583 | $this->TextColor = $tc; |
| 572 | 584 | $this->ColorFlag = $cf; |
| 573 | 585 | // Page header |
@@ -581,8 +593,9 @@ discard block |
||
| 581 | 593 | $this->_out(sprintf('%.2F w',$lw*$this->k));
|
| 582 | 594 | } |
| 583 | 595 | // Restore font |
| 584 | - if($family) |
|
| 585 | - $this->setFont($family,$style,$fontsize); |
|
| 596 | + if($family) {
|
|
| 597 | + $this->setFont($family,$style,$fontsize); |
|
| 598 | + } |
|
| 586 | 599 | // Restore colors |
| 587 | 600 | if($this->DrawColor!=$dc) |
| 588 | 601 | {
|
@@ -641,12 +654,14 @@ discard block |
||
| 641 | 654 | public function SetDrawColor(int $r, ?int $g=null, ?int $b=null) : void |
| 642 | 655 | {
|
| 643 | 656 | // Set color for all stroking operations |
| 644 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 645 | - $this->DrawColor = sprintf('%.3F G',$r/255);
|
|
| 646 | - else |
|
| 647 | - $this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
|
|
| 648 | - if($this->page>0) |
|
| 649 | - $this->_out($this->DrawColor); |
|
| 657 | + if(($r==0 && $g==0 && $b==0) || $g===null) {
|
|
| 658 | + $this->DrawColor = sprintf('%.3F G',$r/255);
|
|
| 659 | + } else {
|
|
| 660 | + $this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
|
|
| 661 | + } |
|
| 662 | + if($this->page>0) {
|
|
| 663 | + $this->_out($this->DrawColor); |
|
| 664 | + } |
|
| 650 | 665 | } |
| 651 | 666 | |
| 652 | 667 | /** |
@@ -660,13 +675,15 @@ discard block |
||
| 660 | 675 | public function SetFillColor(int $r, ?int $g=null, ?int $b=null) : void |
| 661 | 676 | {
|
| 662 | 677 | // Set color for all filling operations |
| 663 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 664 | - $this->FillColor = sprintf('%.3F g',$r/255);
|
|
| 665 | - else |
|
| 666 | - $this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
|
| 678 | + if(($r==0 && $g==0 && $b==0) || $g===null) {
|
|
| 679 | + $this->FillColor = sprintf('%.3F g',$r/255);
|
|
| 680 | + } else {
|
|
| 681 | + $this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
|
| 682 | + } |
|
| 667 | 683 | $this->ColorFlag = ($this->FillColor!=$this->TextColor); |
| 668 | - if($this->page>0) |
|
| 669 | - $this->_out($this->FillColor); |
|
| 684 | + if($this->page>0) {
|
|
| 685 | + $this->_out($this->FillColor); |
|
| 686 | + } |
|
| 670 | 687 | } |
| 671 | 688 | |
| 672 | 689 | /** |
@@ -680,10 +697,11 @@ discard block |
||
| 680 | 697 | public function SetTextColor(int $r, ?int $g=null, ?int $b=null) : void |
| 681 | 698 | {
|
| 682 | 699 | // Set color for text |
| 683 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
| 684 | - $this->TextColor = sprintf('%.3F g',$r/255);
|
|
| 685 | - else |
|
| 686 | - $this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
|
| 700 | + if(($r==0 && $g==0 && $b==0) || $g===null) {
|
|
| 701 | + $this->TextColor = sprintf('%.3F g',$r/255);
|
|
| 702 | + } else {
|
|
| 703 | + $this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
|
| 704 | + } |
|
| 687 | 705 | $this->ColorFlag = ($this->FillColor!=$this->TextColor); |
| 688 | 706 | } |
| 689 | 707 | |
@@ -700,8 +718,9 @@ discard block |
||
| 700 | 718 | $cw = &$this->CurrentFont['cw']; |
| 701 | 719 | $w = 0; |
| 702 | 720 | $l = strlen($s); |
| 703 | - for($i=0;$i<$l;$i++) |
|
| 704 | - $w += $cw[$s[$i]]; |
|
| 721 | + for($i=0;$i<$l;$i++) {
|
|
| 722 | + $w += $cw[$s[$i]]; |
|
| 723 | + } |
|
| 705 | 724 | return $w*$this->FontSize/1000; |
| 706 | 725 | } |
| 707 | 726 | |
@@ -715,8 +734,9 @@ discard block |
||
| 715 | 734 | {
|
| 716 | 735 | // Set line width |
| 717 | 736 | $this->LineWidth = $width; |
| 718 | - if($this->page>0) |
|
| 719 | - $this->_out(sprintf('%.2F w',$width*$this->k));
|
|
| 737 | + if($this->page>0) {
|
|
| 738 | + $this->_out(sprintf('%.2F w',$width*$this->k));
|
|
| 739 | + } |
|
| 720 | 740 | } |
| 721 | 741 | |
| 722 | 742 | /** |
@@ -752,12 +772,13 @@ discard block |
||
| 752 | 772 | public function Rect(float $x, float $y, float $w, float $h, string $style='') : void |
| 753 | 773 | {
|
| 754 | 774 | // Draw a rectangle |
| 755 | - if($style=='F') |
|
| 756 | - $op = 'f'; |
|
| 757 | - elseif($style=='FD' || $style=='DF') |
|
| 758 | - $op = 'B'; |
|
| 759 | - else |
|
| 760 | - $op = 'S'; |
|
| 775 | + if($style=='F') {
|
|
| 776 | + $op = 'f'; |
|
| 777 | + } elseif($style=='FD' || $style=='DF') {
|
|
| 778 | + $op = 'B'; |
|
| 779 | + } else {
|
|
| 780 | + $op = 'S'; |
|
| 781 | + } |
|
| 761 | 782 | $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
|
| 762 | 783 | } |
| 763 | 784 | |
@@ -782,23 +803,27 @@ discard block |
||
| 782 | 803 | {
|
| 783 | 804 | // Add a TrueType, OpenType or Type1 font |
| 784 | 805 | $family = strtolower($family); |
| 785 | - if($file=='') |
|
| 786 | - $file = str_replace(' ','',$family).strtolower($style).'.php';
|
|
| 806 | + if($file=='') {
|
|
| 807 | + $file = str_replace(' ','',$family).strtolower($style).'.php';
|
|
| 808 | + } |
|
| 787 | 809 | $style = strtoupper($style); |
| 788 | - if($style=='IB') |
|
| 789 | - $style = 'BI'; |
|
| 810 | + if($style=='IB') {
|
|
| 811 | + $style = 'BI'; |
|
| 812 | + } |
|
| 790 | 813 | $fontkey = $family.$style; |
| 791 | - if(isset($this->fonts[$fontkey])) |
|
| 792 | - return; |
|
| 814 | + if(isset($this->fonts[$fontkey])) {
|
|
| 815 | + return; |
|
| 816 | + } |
|
| 793 | 817 | $info = $this->_loadfont($file); |
| 794 | 818 | $info['i'] = count($this->fonts)+1; |
| 795 | 819 | if(!empty($info['file'])) |
| 796 | 820 | {
|
| 797 | 821 | // Embedded font |
| 798 | - if($info['type']=='TrueType') |
|
| 799 | - $this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']);
|
|
| 800 | - else |
|
| 801 | - $this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']);
|
|
| 822 | + if($info['type']=='TrueType') {
|
|
| 823 | + $this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']);
|
|
| 824 | + } else {
|
|
| 825 | + $this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']);
|
|
| 826 | + } |
|
| 802 | 827 | } |
| 803 | 828 | $this->fonts[$fontkey] = $info; |
| 804 | 829 | } |
@@ -841,42 +866,49 @@ discard block |
||
| 841 | 866 | public function SetFont(string $family, string $style='', float $size=0) : void |
| 842 | 867 | {
|
| 843 | 868 | // Select a font; size given in points |
| 844 | - if($family=='') |
|
| 845 | - $family = $this->FontFamily; |
|
| 846 | - else |
|
| 847 | - $family = strtolower($family); |
|
| 869 | + if($family=='') {
|
|
| 870 | + $family = $this->FontFamily; |
|
| 871 | + } else {
|
|
| 872 | + $family = strtolower($family); |
|
| 873 | + } |
|
| 848 | 874 | $style = strtoupper($style); |
| 849 | 875 | if(strpos($style,'U')!==false) |
| 850 | 876 | {
|
| 851 | 877 | $this->underline = true; |
| 852 | 878 | $style = str_replace('U','',$style);
|
| 879 | + } else {
|
|
| 880 | + $this->underline = false; |
|
| 881 | + } |
|
| 882 | + if($style=='IB') {
|
|
| 883 | + $style = 'BI'; |
|
| 884 | + } |
|
| 885 | + if($size==0) {
|
|
| 886 | + $size = $this->FontSizePt; |
|
| 853 | 887 | } |
| 854 | - else |
|
| 855 | - $this->underline = false; |
|
| 856 | - if($style=='IB') |
|
| 857 | - $style = 'BI'; |
|
| 858 | - if($size==0) |
|
| 859 | - $size = $this->FontSizePt; |
|
| 860 | 888 | // Test if font is already selected |
| 861 | - if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) |
|
| 862 | - return; |
|
| 889 | + if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) {
|
|
| 890 | + return; |
|
| 891 | + } |
|
| 863 | 892 | // Test if font is already loaded |
| 864 | 893 | $fontkey = $family.$style; |
| 865 | 894 | if(!isset($this->fonts[$fontkey])) |
| 866 | 895 | {
|
| 867 | 896 | // Test if one of the core fonts |
| 868 | - if($family=='arial') |
|
| 869 | - $family = 'helvetica'; |
|
| 897 | + if($family=='arial') {
|
|
| 898 | + $family = 'helvetica'; |
|
| 899 | + } |
|
| 870 | 900 | if(in_array($family,$this->CoreFonts)) |
| 871 | 901 | {
|
| 872 | - if($family=='symbol' || $family=='zapfdingbats') |
|
| 873 | - $style = ''; |
|
| 902 | + if($family=='symbol' || $family=='zapfdingbats') {
|
|
| 903 | + $style = ''; |
|
| 904 | + } |
|
| 874 | 905 | $fontkey = $family.$style; |
| 875 | - if(!isset($this->fonts[$fontkey])) |
|
| 876 | - $this->addFont($family,$style); |
|
| 906 | + if(!isset($this->fonts[$fontkey])) {
|
|
| 907 | + $this->addFont($family,$style); |
|
| 908 | + } |
|
| 909 | + } else {
|
|
| 910 | + $this->Error('Undefined font: '.$family.' '.$style);
|
|
| 877 | 911 | } |
| 878 | - else |
|
| 879 | - $this->Error('Undefined font: '.$family.' '.$style);
|
|
| 880 | 912 | } |
| 881 | 913 | // Select it |
| 882 | 914 | $this->FontFamily = $family; |
@@ -884,8 +916,9 @@ discard block |
||
| 884 | 916 | $this->FontSizePt = $size; |
| 885 | 917 | $this->FontSize = $size/$this->k; |
| 886 | 918 | $this->CurrentFont = &$this->fonts[$fontkey]; |
| 887 | - if($this->page>0) |
|
| 888 | - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
|
| 919 | + if($this->page>0) {
|
|
| 920 | + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
|
| 921 | + } |
|
| 889 | 922 | } |
| 890 | 923 | |
| 891 | 924 | /** |
@@ -895,12 +928,14 @@ discard block |
||
| 895 | 928 | public function SetFontSize(float $size) : void |
| 896 | 929 | {
|
| 897 | 930 | // Set font size in points |
| 898 | - if($this->FontSizePt==$size) |
|
| 899 | - return; |
|
| 931 | + if($this->FontSizePt==$size) {
|
|
| 932 | + return; |
|
| 933 | + } |
|
| 900 | 934 | $this->FontSizePt = $size; |
| 901 | 935 | $this->FontSize = $size/$this->k; |
| 902 | - if($this->page>0) |
|
| 903 | - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
|
| 936 | + if($this->page>0) {
|
|
| 937 | + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
|
| 938 | + } |
|
| 904 | 939 | } |
| 905 | 940 | |
| 906 | 941 | /** |
@@ -927,10 +962,12 @@ discard block |
||
| 927 | 962 | public function SetLink(int $link, float $y=0, int $page=-1) : void |
| 928 | 963 | {
|
| 929 | 964 | // Set destination of internal link |
| 930 | - if($y==-1) |
|
| 931 | - $y = $this->y; |
|
| 932 | - if($page==-1) |
|
| 933 | - $page = $this->page; |
|
| 965 | + if($y==-1) {
|
|
| 966 | + $y = $this->y; |
|
| 967 | + } |
|
| 968 | + if($page==-1) {
|
|
| 969 | + $page = $this->page; |
|
| 970 | + } |
|
| 934 | 971 | $this->links[$link] = array($page, $y); |
| 935 | 972 | } |
| 936 | 973 | |
@@ -964,13 +1001,16 @@ discard block |
||
| 964 | 1001 | public function Text(float $x, float $y, string $txt) : void |
| 965 | 1002 | {
|
| 966 | 1003 | // Output a string |
| 967 | - if(!isset($this->CurrentFont)) |
|
| 968 | - $this->Error('No font has been set');
|
|
| 1004 | + if(!isset($this->CurrentFont)) {
|
|
| 1005 | + $this->Error('No font has been set');
|
|
| 1006 | + } |
|
| 969 | 1007 | $s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
|
| 970 | - if($this->underline && $txt!='') |
|
| 971 | - $s .= ' '.$this->_dounderline($x,$y,$txt); |
|
| 972 | - if($this->ColorFlag) |
|
| 973 | - $s = 'q '.$this->TextColor.' '.$s.' Q'; |
|
| 1008 | + if($this->underline && $txt!='') {
|
|
| 1009 | + $s .= ' '.$this->_dounderline($x,$y,$txt); |
|
| 1010 | + } |
|
| 1011 | + if($this->ColorFlag) {
|
|
| 1012 | + $s = 'q '.$this->TextColor.' '.$s.' Q'; |
|
| 1013 | + } |
|
| 974 | 1014 | $this->_out($s); |
| 975 | 1015 | } |
| 976 | 1016 | |
@@ -1050,62 +1090,76 @@ discard block |
||
| 1050 | 1090 | $this->_out(sprintf('%.3F Tw',$ws*$k));
|
| 1051 | 1091 | } |
| 1052 | 1092 | } |
| 1053 | - if($w==0) |
|
| 1054 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1093 | + if($w==0) {
|
|
| 1094 | + $w = $this->w-$this->rMargin-$this->x; |
|
| 1095 | + } |
|
| 1055 | 1096 | $s = ''; |
| 1056 | 1097 | if($fill || $border==1) |
| 1057 | 1098 | {
|
| 1058 | - if($fill) |
|
| 1059 | - $op = ($border==1) ? 'B' : 'f'; |
|
| 1060 | - else |
|
| 1061 | - $op = 'S'; |
|
| 1099 | + if($fill) {
|
|
| 1100 | + $op = ($border==1) ? 'B' : 'f'; |
|
| 1101 | + } else {
|
|
| 1102 | + $op = 'S'; |
|
| 1103 | + } |
|
| 1062 | 1104 | $s = sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
|
| 1063 | 1105 | } |
| 1064 | 1106 | if(is_string($border)) |
| 1065 | 1107 | {
|
| 1066 | 1108 | $x = $this->x; |
| 1067 | 1109 | $y = $this->y; |
| 1068 | - if(strpos($border,'L')!==false) |
|
| 1069 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
|
|
| 1070 | - if(strpos($border,'T')!==false) |
|
| 1071 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
|
|
| 1072 | - if(strpos($border,'R')!==false) |
|
| 1073 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
|
| 1074 | - if(strpos($border,'B')!==false) |
|
| 1075 | - $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
|
| 1110 | + if(strpos($border,'L')!==false) {
|
|
| 1111 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
|
|
| 1112 | + } |
|
| 1113 | + if(strpos($border,'T')!==false) {
|
|
| 1114 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
|
|
| 1115 | + } |
|
| 1116 | + if(strpos($border,'R')!==false) {
|
|
| 1117 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
|
| 1118 | + } |
|
| 1119 | + if(strpos($border,'B')!==false) {
|
|
| 1120 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
|
| 1121 | + } |
|
| 1076 | 1122 | } |
| 1077 | 1123 | if($txt!=='') |
| 1078 | 1124 | {
|
| 1079 | - if(!isset($this->CurrentFont)) |
|
| 1080 | - $this->Error('No font has been set');
|
|
| 1081 | - if($align=='R') |
|
| 1082 | - $dx = $w-$this->cMargin-$this->getStringWidth($txt); |
|
| 1083 | - elseif($align=='C') |
|
| 1084 | - $dx = ($w-$this->getStringWidth($txt))/2; |
|
| 1085 | - else |
|
| 1086 | - $dx = $this->cMargin; |
|
| 1087 | - if($this->ColorFlag) |
|
| 1088 | - $s .= 'q '.$this->TextColor.' '; |
|
| 1125 | + if(!isset($this->CurrentFont)) {
|
|
| 1126 | + $this->Error('No font has been set');
|
|
| 1127 | + } |
|
| 1128 | + if($align=='R') {
|
|
| 1129 | + $dx = $w-$this->cMargin-$this->getStringWidth($txt); |
|
| 1130 | + } elseif($align=='C') {
|
|
| 1131 | + $dx = ($w-$this->getStringWidth($txt))/2; |
|
| 1132 | + } else {
|
|
| 1133 | + $dx = $this->cMargin; |
|
| 1134 | + } |
|
| 1135 | + if($this->ColorFlag) {
|
|
| 1136 | + $s .= 'q '.$this->TextColor.' '; |
|
| 1137 | + } |
|
| 1089 | 1138 | $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$this->_escape($txt));
|
| 1090 | - if($this->underline) |
|
| 1091 | - $s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); |
|
| 1092 | - if($this->ColorFlag) |
|
| 1093 | - $s .= ' Q'; |
|
| 1094 | - if($link) |
|
| 1095 | - $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->getStringWidth($txt),$this->FontSize,$link); |
|
| 1096 | - } |
|
| 1097 | - if($s) |
|
| 1098 | - $this->_out($s); |
|
| 1139 | + if($this->underline) {
|
|
| 1140 | + $s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); |
|
| 1141 | + } |
|
| 1142 | + if($this->ColorFlag) {
|
|
| 1143 | + $s .= ' Q'; |
|
| 1144 | + } |
|
| 1145 | + if($link) {
|
|
| 1146 | + $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->getStringWidth($txt),$this->FontSize,$link); |
|
| 1147 | + } |
|
| 1148 | + } |
|
| 1149 | + if($s) {
|
|
| 1150 | + $this->_out($s); |
|
| 1151 | + } |
|
| 1099 | 1152 | $this->lasth = $h; |
| 1100 | 1153 | if($ln>0) |
| 1101 | 1154 | {
|
| 1102 | 1155 | // Go to next line |
| 1103 | 1156 | $this->y += $h; |
| 1104 | - if($ln==1) |
|
| 1105 | - $this->x = $this->lMargin; |
|
| 1157 | + if($ln==1) {
|
|
| 1158 | + $this->x = $this->lMargin; |
|
| 1159 | + } |
|
| 1160 | + } else {
|
|
| 1161 | + $this->x += $w; |
|
| 1106 | 1162 | } |
| 1107 | - else |
|
| 1108 | - $this->x += $w; |
|
| 1109 | 1163 | } |
| 1110 | 1164 | |
| 1111 | 1165 | /** |
@@ -1139,16 +1193,19 @@ discard block |
||
| 1139 | 1193 | public function MultiCell(float $w, float $h, string $txt, $border=0, string $align='J', bool $fill=false) : void |
| 1140 | 1194 | {
|
| 1141 | 1195 | // Output text with automatic or explicit line breaks |
| 1142 | - if(!isset($this->CurrentFont)) |
|
| 1143 | - $this->Error('No font has been set');
|
|
| 1196 | + if(!isset($this->CurrentFont)) {
|
|
| 1197 | + $this->Error('No font has been set');
|
|
| 1198 | + } |
|
| 1144 | 1199 | $cw = &$this->CurrentFont['cw']; |
| 1145 | - if($w==0) |
|
| 1146 | - $w = $this->w-$this->rMargin-$this->x; |
|
| 1200 | + if($w==0) {
|
|
| 1201 | + $w = $this->w-$this->rMargin-$this->x; |
|
| 1202 | + } |
|
| 1147 | 1203 | $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
| 1148 | 1204 | $s = str_replace("\r",'',$txt);
|
| 1149 | 1205 | $nb = strlen($s); |
| 1150 | - if($nb>0 && $s[$nb-1]=="\n") |
|
| 1151 | - $nb--; |
|
| 1206 | + if($nb>0 && $s[$nb-1]=="\n") {
|
|
| 1207 | + $nb--; |
|
| 1208 | + } |
|
| 1152 | 1209 | $b = 0; |
| 1153 | 1210 | $b2 = ''; |
| 1154 | 1211 | if($border) |
@@ -1158,14 +1215,15 @@ discard block |
||
| 1158 | 1215 | $border = 'LTRB'; |
| 1159 | 1216 | $b = 'LRT'; |
| 1160 | 1217 | $b2 = 'LR'; |
| 1161 | - } |
|
| 1162 | - else |
|
| 1218 | + } else |
|
| 1163 | 1219 | {
|
| 1164 | 1220 | $b2 = ''; |
| 1165 | - if(strpos($border,'L')!==false) |
|
| 1166 | - $b2 .= 'L'; |
|
| 1167 | - if(strpos($border,'R')!==false) |
|
| 1168 | - $b2 .= 'R'; |
|
| 1221 | + if(strpos($border,'L')!==false) {
|
|
| 1222 | + $b2 .= 'L'; |
|
| 1223 | + } |
|
| 1224 | + if(strpos($border,'R')!==false) {
|
|
| 1225 | + $b2 .= 'R'; |
|
| 1226 | + } |
|
| 1169 | 1227 | $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2; |
| 1170 | 1228 | } |
| 1171 | 1229 | } |
@@ -1195,8 +1253,9 @@ discard block |
||
| 1195 | 1253 | $l = 0; |
| 1196 | 1254 | $ns = 0; |
| 1197 | 1255 | $nl++; |
| 1198 | - if($border && $nl==2) |
|
| 1199 | - $b = $b2; |
|
| 1256 | + if($border && $nl==2) {
|
|
| 1257 | + $b = $b2; |
|
| 1258 | + } |
|
| 1200 | 1259 | continue; |
| 1201 | 1260 | } |
| 1202 | 1261 | if($c==' ') |
@@ -1211,16 +1270,16 @@ discard block |
||
| 1211 | 1270 | // Automatic line break |
| 1212 | 1271 | if($sep==-1) |
| 1213 | 1272 | {
|
| 1214 | - if($i==$j) |
|
| 1215 | - $i++; |
|
| 1273 | + if($i==$j) {
|
|
| 1274 | + $i++; |
|
| 1275 | + } |
|
| 1216 | 1276 | if($this->ws>0) |
| 1217 | 1277 | {
|
| 1218 | 1278 | $this->ws = 0; |
| 1219 | 1279 | $this->_out('0 Tw');
|
| 1220 | 1280 | } |
| 1221 | 1281 | $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
| 1222 | - } |
|
| 1223 | - else |
|
| 1282 | + } else |
|
| 1224 | 1283 | {
|
| 1225 | 1284 | if($align=='J') |
| 1226 | 1285 | {
|
@@ -1235,11 +1294,12 @@ discard block |
||
| 1235 | 1294 | $l = 0; |
| 1236 | 1295 | $ns = 0; |
| 1237 | 1296 | $nl++; |
| 1238 | - if($border && $nl==2) |
|
| 1239 | - $b = $b2; |
|
| 1297 | + if($border && $nl==2) {
|
|
| 1298 | + $b = $b2; |
|
| 1299 | + } |
|
| 1300 | + } else {
|
|
| 1301 | + $i++; |
|
| 1240 | 1302 | } |
| 1241 | - else |
|
| 1242 | - $i++; |
|
| 1243 | 1303 | } |
| 1244 | 1304 | // Last chunk |
| 1245 | 1305 | if($this->ws>0) |
@@ -1247,8 +1307,9 @@ discard block |
||
| 1247 | 1307 | $this->ws = 0; |
| 1248 | 1308 | $this->_out('0 Tw');
|
| 1249 | 1309 | } |
| 1250 | - if($border && strpos($border,'B')!==false) |
|
| 1251 | - $b .= 'B'; |
|
| 1310 | + if($border && strpos($border,'B')!==false) {
|
|
| 1311 | + $b .= 'B'; |
|
| 1312 | + } |
|
| 1252 | 1313 | $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
| 1253 | 1314 | $this->x = $this->lMargin; |
| 1254 | 1315 | } |
@@ -1266,8 +1327,9 @@ discard block |
||
| 1266 | 1327 | public function Write(float $h, string $txt, $link='') : void |
| 1267 | 1328 | {
|
| 1268 | 1329 | // Output text in flowing mode |
| 1269 | - if(!isset($this->CurrentFont)) |
|
| 1270 | - $this->Error('No font has been set');
|
|
| 1330 | + if(!isset($this->CurrentFont)) {
|
|
| 1331 | + $this->Error('No font has been set');
|
|
| 1332 | + } |
|
| 1271 | 1333 | $cw = &$this->CurrentFont['cw']; |
| 1272 | 1334 | $w = $this->w-$this->rMargin-$this->x; |
| 1273 | 1335 | $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
@@ -1299,8 +1361,9 @@ discard block |
||
| 1299 | 1361 | $nl++; |
| 1300 | 1362 | continue; |
| 1301 | 1363 | } |
| 1302 | - if($c==' ') |
|
| 1303 | - $sep = $i; |
|
| 1364 | + if($c==' ') {
|
|
| 1365 | + $sep = $i; |
|
| 1366 | + } |
|
| 1304 | 1367 | $l += $cw[$c]; |
| 1305 | 1368 | if($l>$wmax) |
| 1306 | 1369 | {
|
@@ -1318,11 +1381,11 @@ discard block |
||
| 1318 | 1381 | $nl++; |
| 1319 | 1382 | continue; |
| 1320 | 1383 | } |
| 1321 | - if($i==$j) |
|
| 1322 | - $i++; |
|
| 1384 | + if($i==$j) {
|
|
| 1385 | + $i++; |
|
| 1386 | + } |
|
| 1323 | 1387 | $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link); |
| 1324 | - } |
|
| 1325 | - else |
|
| 1388 | + } else |
|
| 1326 | 1389 | {
|
| 1327 | 1390 | $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',false,$link); |
| 1328 | 1391 | $i = $sep+1; |
@@ -1337,13 +1400,14 @@ discard block |
||
| 1337 | 1400 | $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; |
| 1338 | 1401 | } |
| 1339 | 1402 | $nl++; |
| 1403 | + } else {
|
|
| 1404 | + $i++; |
|
| 1340 | 1405 | } |
| 1341 | - else |
|
| 1342 | - $i++; |
|
| 1343 | 1406 | } |
| 1344 | 1407 | // Last chunk |
| 1345 | - if($i!=$j) |
|
| 1346 | - $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link); |
|
| 1408 | + if($i!=$j) {
|
|
| 1409 | + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link); |
|
| 1410 | + } |
|
| 1347 | 1411 | } |
| 1348 | 1412 | |
| 1349 | 1413 | /** |
@@ -1357,10 +1421,11 @@ discard block |
||
| 1357 | 1421 | {
|
| 1358 | 1422 | // Line feed; default value is the last cell height |
| 1359 | 1423 | $this->x = $this->lMargin; |
| 1360 | - if($h===null) |
|
| 1361 | - $this->y += $this->lasth; |
|
| 1362 | - else |
|
| 1363 | - $this->y += $h; |
|
| 1424 | + if($h===null) {
|
|
| 1425 | + $this->y += $this->lasth; |
|
| 1426 | + } else {
|
|
| 1427 | + $this->y += $h; |
|
| 1428 | + } |
|
| 1364 | 1429 | } |
| 1365 | 1430 | |
| 1366 | 1431 | /** |
@@ -1412,30 +1477,34 @@ discard block |
||
| 1412 | 1477 | public function Image(string $file, ?float $x=null, ?float $y=null, float $w=0, float $h=0, string $type='', $link='') : void |
| 1413 | 1478 | {
|
| 1414 | 1479 | // Put an image on the page |
| 1415 | - if($file=='') |
|
| 1416 | - $this->Error('Image file name is empty');
|
|
| 1480 | + if($file=='') {
|
|
| 1481 | + $this->Error('Image file name is empty');
|
|
| 1482 | + } |
|
| 1417 | 1483 | if(!isset($this->images[$file])) |
| 1418 | 1484 | {
|
| 1419 | 1485 | // First use of this image, get info |
| 1420 | 1486 | if($type=='') |
| 1421 | 1487 | {
|
| 1422 | 1488 | $pos = strrpos($file,'.'); |
| 1423 | - if(!$pos) |
|
| 1424 | - $this->Error('Image file has no extension and no type was specified: '.$file);
|
|
| 1489 | + if(!$pos) {
|
|
| 1490 | + $this->Error('Image file has no extension and no type was specified: '.$file);
|
|
| 1491 | + } |
|
| 1425 | 1492 | $type = substr($file,$pos+1); |
| 1426 | 1493 | } |
| 1427 | 1494 | $type = strtolower($type); |
| 1428 | - if($type=='jpeg') |
|
| 1429 | - $type = 'jpg'; |
|
| 1495 | + if($type=='jpeg') {
|
|
| 1496 | + $type = 'jpg'; |
|
| 1497 | + } |
|
| 1430 | 1498 | $mtd = '_parse'.$type; |
| 1431 | - if(!method_exists($this,$mtd)) |
|
| 1432 | - $this->Error('Unsupported image type: '.$type);
|
|
| 1499 | + if(!method_exists($this,$mtd)) {
|
|
| 1500 | + $this->Error('Unsupported image type: '.$type);
|
|
| 1501 | + } |
|
| 1433 | 1502 | $info = $this->$mtd($file); |
| 1434 | 1503 | $info['i'] = count($this->images)+1; |
| 1435 | 1504 | $this->images[$file] = $info; |
| 1505 | + } else {
|
|
| 1506 | + $info = $this->images[$file]; |
|
| 1436 | 1507 | } |
| 1437 | - else |
|
| 1438 | - $info = $this->images[$file]; |
|
| 1439 | 1508 | |
| 1440 | 1509 | // Automatic width and height calculation if needed |
| 1441 | 1510 | if($w==0 && $h==0) |
@@ -1444,14 +1513,18 @@ discard block |
||
| 1444 | 1513 | $w = -96; |
| 1445 | 1514 | $h = -96; |
| 1446 | 1515 | } |
| 1447 | - if($w<0) |
|
| 1448 | - $w = -$info['w']*72/$w/$this->k; |
|
| 1449 | - if($h<0) |
|
| 1450 | - $h = -$info['h']*72/$h/$this->k; |
|
| 1451 | - if($w==0) |
|
| 1452 | - $w = $h*$info['w']/$info['h']; |
|
| 1453 | - if($h==0) |
|
| 1454 | - $h = $w*$info['h']/$info['w']; |
|
| 1516 | + if($w<0) {
|
|
| 1517 | + $w = -$info['w']*72/$w/$this->k; |
|
| 1518 | + } |
|
| 1519 | + if($h<0) {
|
|
| 1520 | + $h = -$info['h']*72/$h/$this->k; |
|
| 1521 | + } |
|
| 1522 | + if($w==0) {
|
|
| 1523 | + $w = $h*$info['w']/$info['h']; |
|
| 1524 | + } |
|
| 1525 | + if($h==0) {
|
|
| 1526 | + $h = $w*$info['h']/$info['w']; |
|
| 1527 | + } |
|
| 1455 | 1528 | |
| 1456 | 1529 | // Flowing mode |
| 1457 | 1530 | if($y===null) |
@@ -1467,11 +1540,13 @@ discard block |
||
| 1467 | 1540 | $this->y += $h; |
| 1468 | 1541 | } |
| 1469 | 1542 | |
| 1470 | - if($x===null) |
|
| 1471 | - $x = $this->x; |
|
| 1543 | + if($x===null) {
|
|
| 1544 | + $x = $this->x; |
|
| 1545 | + } |
|
| 1472 | 1546 | $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
|
| 1473 | - if($link) |
|
| 1474 | - $this->Link($x,$y,$w,$h,$link); |
|
| 1547 | + if($link) {
|
|
| 1548 | + $this->Link($x,$y,$w,$h,$link); |
|
| 1549 | + } |
|
| 1475 | 1550 | } |
| 1476 | 1551 | |
| 1477 | 1552 | /** |
@@ -1512,10 +1587,11 @@ discard block |
||
| 1512 | 1587 | public function SetX(float $x) : void |
| 1513 | 1588 | {
|
| 1514 | 1589 | // Set x position |
| 1515 | - if($x>=0) |
|
| 1516 | - $this->x = $x; |
|
| 1517 | - else |
|
| 1518 | - $this->x = $this->w+$x; |
|
| 1590 | + if($x>=0) {
|
|
| 1591 | + $this->x = $x; |
|
| 1592 | + } else {
|
|
| 1593 | + $this->x = $this->w+$x; |
|
| 1594 | + } |
|
| 1519 | 1595 | } |
| 1520 | 1596 | |
| 1521 | 1597 | /** |
@@ -1537,12 +1613,14 @@ discard block |
||
| 1537 | 1613 | public function SetY(float $y, bool $resetX=true) : void |
| 1538 | 1614 | {
|
| 1539 | 1615 | // Set y position and optionally reset x |
| 1540 | - if($y>=0) |
|
| 1541 | - $this->y = $y; |
|
| 1542 | - else |
|
| 1543 | - $this->y = $this->h+$y; |
|
| 1544 | - if($resetX) |
|
| 1545 | - $this->x = $this->lMargin; |
|
| 1616 | + if($y>=0) {
|
|
| 1617 | + $this->y = $y; |
|
| 1618 | + } else {
|
|
| 1619 | + $this->y = $this->h+$y; |
|
| 1620 | + } |
|
| 1621 | + if($resetX) {
|
|
| 1622 | + $this->x = $this->lMargin; |
|
| 1623 | + } |
|
| 1546 | 1624 | } |
| 1547 | 1625 | |
| 1548 | 1626 | /** |
@@ -1587,10 +1665,12 @@ discard block |
||
| 1587 | 1665 | $dest = $name; |
| 1588 | 1666 | $name = $tmp; |
| 1589 | 1667 | } |
| 1590 | - if($dest=='') |
|
| 1591 | - $dest = 'I'; |
|
| 1592 | - if($name=='') |
|
| 1593 | - $name = 'doc.pdf'; |
|
| 1668 | + if($dest=='') {
|
|
| 1669 | + $dest = 'I'; |
|
| 1670 | + } |
|
| 1671 | + if($name=='') {
|
|
| 1672 | + $name = 'doc.pdf'; |
|
| 1673 | + } |
|
| 1594 | 1674 | switch(strtoupper($dest)) |
| 1595 | 1675 | {
|
| 1596 | 1676 | case 'I': |
@@ -1617,8 +1697,9 @@ discard block |
||
| 1617 | 1697 | break; |
| 1618 | 1698 | case 'F': |
| 1619 | 1699 | // Save to local file |
| 1620 | - if(!file_put_contents($name,$this->buffer)) |
|
| 1621 | - $this->Error('Unable to create output file: '.$name);
|
|
| 1700 | + if(!file_put_contents($name,$this->buffer)) {
|
|
| 1701 | + $this->Error('Unable to create output file: '.$name);
|
|
| 1702 | + } |
|
| 1622 | 1703 | break; |
| 1623 | 1704 | case 'S': |
| 1624 | 1705 | // Return as a string |
@@ -1635,8 +1716,9 @@ discard block |
||
| 1635 | 1716 | protected function _dochecks() : void |
| 1636 | 1717 | {
|
| 1637 | 1718 | // Check mbstring overloading |
| 1638 | - if(ini_get('mbstring.func_overload') & 2)
|
|
| 1639 | - $this->Error('mbstring overloading must be disabled');
|
|
| 1719 | + if(ini_get('mbstring.func_overload') & 2) {
|
|
| 1720 | + $this->Error('mbstring overloading must be disabled');
|
|
| 1721 | + } |
|
| 1640 | 1722 | } |
| 1641 | 1723 | |
| 1642 | 1724 | /** |
@@ -1648,8 +1730,9 @@ discard block |
||
| 1648 | 1730 | {
|
| 1649 | 1731 | $file = ''; |
| 1650 | 1732 | $line = 0; |
| 1651 | - if(headers_sent($file,$line)) |
|
| 1652 | - $this->Error("Some data has already been output, can't send PDF file (output started at $file:$line)");
|
|
| 1733 | + if(headers_sent($file,$line)) {
|
|
| 1734 | + $this->Error("Some data has already been output, can't send PDF file (output started at $file:$line)");
|
|
| 1735 | + } |
|
| 1653 | 1736 | } |
| 1654 | 1737 | if(ob_get_length()) |
| 1655 | 1738 | {
|
@@ -1658,9 +1741,9 @@ discard block |
||
| 1658 | 1741 | {
|
| 1659 | 1742 | // It contains only a UTF-8 BOM and/or whitespace, let's clean it |
| 1660 | 1743 | ob_clean(); |
| 1744 | + } else {
|
|
| 1745 | + $this->Error("Some data has already been output, can't send PDF file");
|
|
| 1661 | 1746 | } |
| 1662 | - else |
|
| 1663 | - $this->Error("Some data has already been output, can't send PDF file");
|
|
| 1664 | 1747 | } |
| 1665 | 1748 | } |
| 1666 | 1749 | |
@@ -1674,17 +1757,18 @@ discard block |
||
| 1674 | 1757 | if(is_string($size)) |
| 1675 | 1758 | {
|
| 1676 | 1759 | $size = strtolower($size); |
| 1677 | - if(!isset($this->StdPageSizes[$size])) |
|
| 1678 | - $this->Error('Unknown page size: '.$size);
|
|
| 1760 | + if(!isset($this->StdPageSizes[$size])) {
|
|
| 1761 | + $this->Error('Unknown page size: '.$size);
|
|
| 1762 | + } |
|
| 1679 | 1763 | $a = $this->StdPageSizes[$size]; |
| 1680 | 1764 | return array($a[0]/$this->k, $a[1]/$this->k); |
| 1681 | - } |
|
| 1682 | - else |
|
| 1765 | + } else |
|
| 1683 | 1766 | {
|
| 1684 | - if($size[0]>$size[1]) |
|
| 1685 | - return array($size[1], $size[0]); |
|
| 1686 | - else |
|
| 1687 | - return $size; |
|
| 1767 | + if($size[0]>$size[1]) {
|
|
| 1768 | + return array($size[1], $size[0]); |
|
| 1769 | + } else {
|
|
| 1770 | + return $size; |
|
| 1771 | + } |
|
| 1688 | 1772 | } |
| 1689 | 1773 | } |
| 1690 | 1774 | |
@@ -1703,14 +1787,16 @@ discard block |
||
| 1703 | 1787 | $this->y = $this->tMargin; |
| 1704 | 1788 | $this->FontFamily = ''; |
| 1705 | 1789 | // Check page size and orientation |
| 1706 | - if($orientation=='') |
|
| 1707 | - $orientation = $this->DefOrientation; |
|
| 1708 | - else |
|
| 1709 | - $orientation = strtoupper($orientation[0]); |
|
| 1710 | - if($size=='') |
|
| 1711 | - $size = $this->DefPageSize; |
|
| 1712 | - else |
|
| 1713 | - $size = $this->_getpagesize($size); |
|
| 1790 | + if($orientation=='') {
|
|
| 1791 | + $orientation = $this->DefOrientation; |
|
| 1792 | + } else {
|
|
| 1793 | + $orientation = strtoupper($orientation[0]); |
|
| 1794 | + } |
|
| 1795 | + if($size=='') {
|
|
| 1796 | + $size = $this->DefPageSize; |
|
| 1797 | + } else {
|
|
| 1798 | + $size = $this->_getpagesize($size); |
|
| 1799 | + } |
|
| 1714 | 1800 | if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1]) |
| 1715 | 1801 | {
|
| 1716 | 1802 | // New size or orientation |
@@ -1718,8 +1804,7 @@ discard block |
||
| 1718 | 1804 | {
|
| 1719 | 1805 | $this->w = $size[0]; |
| 1720 | 1806 | $this->h = $size[1]; |
| 1721 | - } |
|
| 1722 | - else |
|
| 1807 | + } else |
|
| 1723 | 1808 | {
|
| 1724 | 1809 | $this->w = $size[1]; |
| 1725 | 1810 | $this->h = $size[0]; |
@@ -1730,12 +1815,14 @@ discard block |
||
| 1730 | 1815 | $this->CurOrientation = $orientation; |
| 1731 | 1816 | $this->CurPageSize = $size; |
| 1732 | 1817 | } |
| 1733 | - if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) |
|
| 1734 | - $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt); |
|
| 1818 | + if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1]) {
|
|
| 1819 | + $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt); |
|
| 1820 | + } |
|
| 1735 | 1821 | if($rotation!=0) |
| 1736 | 1822 | {
|
| 1737 | - if($rotation%90!=0) |
|
| 1738 | - $this->Error('Incorrect rotation value: '.$rotation);
|
|
| 1823 | + if($rotation%90!=0) {
|
|
| 1824 | + $this->Error('Incorrect rotation value: '.$rotation);
|
|
| 1825 | + } |
|
| 1739 | 1826 | $this->CurRotation = $rotation; |
| 1740 | 1827 | $this->PageInfo[$this->page]['rotation'] = $rotation; |
| 1741 | 1828 | } |
@@ -1790,8 +1877,9 @@ discard block |
||
| 1790 | 1877 | $nb = strlen($s); |
| 1791 | 1878 | for($i=0;$i<$nb;$i++) |
| 1792 | 1879 | {
|
| 1793 | - if(ord($s[$i])>127) |
|
| 1794 | - return false; |
|
| 1880 | + if(ord($s[$i])>127) {
|
|
| 1881 | + return false; |
|
| 1882 | + } |
|
| 1795 | 1883 | } |
| 1796 | 1884 | return true; |
| 1797 | 1885 | } |
@@ -1805,14 +1893,17 @@ discard block |
||
| 1805 | 1893 | protected function _httpencode(string $param, string $value, bool $isUTF8) : string |
| 1806 | 1894 | {
|
| 1807 | 1895 | // Encode HTTP header field parameter |
| 1808 | - if($this->_isascii($value)) |
|
| 1809 | - return $param.'="'.$value.'"'; |
|
| 1810 | - if(!$isUTF8) |
|
| 1811 | - $value = utf8_encode($value); |
|
| 1812 | - if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')!==false) |
|
| 1813 | - return $param.'="'.rawurlencode($value).'"'; |
|
| 1814 | - else |
|
| 1815 | - return $param."*=UTF-8''".rawurlencode($value); |
|
| 1896 | + if($this->_isascii($value)) {
|
|
| 1897 | + return $param.'="'.$value.'"'; |
|
| 1898 | + } |
|
| 1899 | + if(!$isUTF8) {
|
|
| 1900 | + $value = utf8_encode($value); |
|
| 1901 | + } |
|
| 1902 | + if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')!==false) {
|
|
| 1903 | + return $param.'="'.rawurlencode($value).'"'; |
|
| 1904 | + } else {
|
|
| 1905 | + return $param."*=UTF-8''".rawurlencode($value); |
|
| 1906 | + } |
|
| 1816 | 1907 | } |
| 1817 | 1908 | |
| 1818 | 1909 | /** |
@@ -1836,15 +1927,13 @@ discard block |
||
| 1836 | 1927 | $c3 = ord($s[$i++]); |
| 1837 | 1928 | $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); |
| 1838 | 1929 | $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); |
| 1839 | - } |
|
| 1840 | - elseif($c1>=192) |
|
| 1930 | + } elseif($c1>=192) |
|
| 1841 | 1931 | {
|
| 1842 | 1932 | // 2-byte character |
| 1843 | 1933 | $c2 = ord($s[$i++]); |
| 1844 | 1934 | $res .= chr(($c1 & 0x1C)>>2); |
| 1845 | 1935 | $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); |
| 1846 | - } |
|
| 1847 | - else |
|
| 1936 | + } else |
|
| 1848 | 1937 | {
|
| 1849 | 1938 | // Single-byte character |
| 1850 | 1939 | $res .= "\0".chr($c1); |
@@ -1861,10 +1950,11 @@ discard block |
||
| 1861 | 1950 | protected function _escape(string $s) : string |
| 1862 | 1951 | {
|
| 1863 | 1952 | // Escape special characters |
| 1864 | - if(strpos($s,'(')!==false || strpos($s,')')!==false || strpos($s,'\\')!==false || strpos($s,"\r")!==false)
|
|
| 1865 | - return str_replace(array('\\','(',')',"\r"), array('\\\\','\\(','\\)','\\r'), $s);
|
|
| 1866 | - else |
|
| 1867 | - return $s; |
|
| 1953 | + if(strpos($s,'(')!==false || strpos($s,')')!==false || strpos($s,'\\')!==false || strpos($s,"\r")!==false) {
|
|
| 1954 | + return str_replace(array('\\','(',')',"\r"), array('\\\\','\\(','\\)','\\r'), $s);
|
|
| 1955 | + } else {
|
|
| 1956 | + return $s; |
|
| 1957 | + } |
|
| 1868 | 1958 | } |
| 1869 | 1959 | |
| 1870 | 1960 | /** |
@@ -1875,8 +1965,9 @@ discard block |
||
| 1875 | 1965 | protected function _textstring(string $s) : string |
| 1876 | 1966 | {
|
| 1877 | 1967 | // Format a text string |
| 1878 | - if(!$this->_isascii($s)) |
|
| 1879 | - $s = $this->_UTF8toUTF16($s); |
|
| 1968 | + if(!$this->_isascii($s)) {
|
|
| 1969 | + $s = $this->_UTF8toUTF16($s); |
|
| 1970 | + } |
|
| 1880 | 1971 | return '('.$this->_escape($s).')';
|
| 1881 | 1972 | } |
| 1882 | 1973 | |
@@ -1905,16 +1996,19 @@ discard block |
||
| 1905 | 1996 | {
|
| 1906 | 1997 | // Extract info from a JPEG file |
| 1907 | 1998 | $a = getimagesize($file); |
| 1908 | - if(!$a) |
|
| 1909 | - $this->Error('Missing or incorrect image file: '.$file);
|
|
| 1910 | - if($a[2]!=2) |
|
| 1911 | - $this->Error('Not a JPEG file: '.$file);
|
|
| 1912 | - if(!isset($a['channels']) || $a['channels']==3) |
|
| 1913 | - $colspace = 'DeviceRGB'; |
|
| 1914 | - elseif($a['channels']==4) |
|
| 1915 | - $colspace = 'DeviceCMYK'; |
|
| 1916 | - else |
|
| 1917 | - $colspace = 'DeviceGray'; |
|
| 1999 | + if(!$a) {
|
|
| 2000 | + $this->Error('Missing or incorrect image file: '.$file);
|
|
| 2001 | + } |
|
| 2002 | + if($a[2]!=2) {
|
|
| 2003 | + $this->Error('Not a JPEG file: '.$file);
|
|
| 2004 | + } |
|
| 2005 | + if(!isset($a['channels']) || $a['channels']==3) {
|
|
| 2006 | + $colspace = 'DeviceRGB'; |
|
| 2007 | + } elseif($a['channels']==4) {
|
|
| 2008 | + $colspace = 'DeviceCMYK'; |
|
| 2009 | + } else {
|
|
| 2010 | + $colspace = 'DeviceGray'; |
|
| 2011 | + } |
|
| 1918 | 2012 | $bpc = isset($a['bits']) ? $a['bits'] : 8; |
| 1919 | 2013 | $data = file_get_contents($file); |
| 1920 | 2014 | return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data);
|
@@ -1929,8 +2023,9 @@ discard block |
||
| 1929 | 2023 | {
|
| 1930 | 2024 | // Extract info from a PNG file |
| 1931 | 2025 | $f = fopen($file,'rb'); |
| 1932 | - if(!$f) |
|
| 1933 | - $this->Error('Can\'t open image file: '.$file);
|
|
| 2026 | + if(!$f) {
|
|
| 2027 | + $this->Error('Can\'t open image file: '.$file);
|
|
| 2028 | + } |
|
| 1934 | 2029 | $info = $this->_parsepngstream($f,$file); |
| 1935 | 2030 | fclose($f); |
| 1936 | 2031 | return $info; |
@@ -1945,34 +2040,41 @@ discard block |
||
| 1945 | 2040 | protected function _parsepngstream($f, string $file) : array |
| 1946 | 2041 | {
|
| 1947 | 2042 | // Check signature |
| 1948 | - if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) |
|
| 1949 | - $this->Error('Not a PNG file: '.$file);
|
|
| 2043 | + if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) {
|
|
| 2044 | + $this->Error('Not a PNG file: '.$file);
|
|
| 2045 | + } |
|
| 1950 | 2046 | |
| 1951 | 2047 | // Read header chunk |
| 1952 | 2048 | $this->_readstream($f,4); |
| 1953 | - if($this->_readstream($f,4)!='IHDR') |
|
| 1954 | - $this->Error('Incorrect PNG file: '.$file);
|
|
| 2049 | + if($this->_readstream($f,4)!='IHDR') {
|
|
| 2050 | + $this->Error('Incorrect PNG file: '.$file);
|
|
| 2051 | + } |
|
| 1955 | 2052 | $w = $this->_readint($f); |
| 1956 | 2053 | $h = $this->_readint($f); |
| 1957 | 2054 | $bpc = ord($this->_readstream($f,1)); |
| 1958 | - if($bpc>8) |
|
| 1959 | - $this->Error('16-bit depth not supported: '.$file);
|
|
| 2055 | + if($bpc>8) {
|
|
| 2056 | + $this->Error('16-bit depth not supported: '.$file);
|
|
| 2057 | + } |
|
| 1960 | 2058 | $ct = ord($this->_readstream($f,1)); |
| 1961 | 2059 | $colspace = ''; |
| 1962 | - if($ct==0 || $ct==4) |
|
| 1963 | - $colspace = 'DeviceGray'; |
|
| 1964 | - elseif($ct==2 || $ct==6) |
|
| 1965 | - $colspace = 'DeviceRGB'; |
|
| 1966 | - elseif($ct==3) |
|
| 1967 | - $colspace = 'Indexed'; |
|
| 1968 | - else |
|
| 1969 | - $this->Error('Unknown color type: '.$file);
|
|
| 1970 | - if(ord($this->_readstream($f,1))!=0) |
|
| 1971 | - $this->Error('Unknown compression method: '.$file);
|
|
| 1972 | - if(ord($this->_readstream($f,1))!=0) |
|
| 1973 | - $this->Error('Unknown filter method: '.$file);
|
|
| 1974 | - if(ord($this->_readstream($f,1))!=0) |
|
| 1975 | - $this->Error('Interlacing not supported: '.$file);
|
|
| 2060 | + if($ct==0 || $ct==4) {
|
|
| 2061 | + $colspace = 'DeviceGray'; |
|
| 2062 | + } elseif($ct==2 || $ct==6) {
|
|
| 2063 | + $colspace = 'DeviceRGB'; |
|
| 2064 | + } elseif($ct==3) {
|
|
| 2065 | + $colspace = 'Indexed'; |
|
| 2066 | + } else {
|
|
| 2067 | + $this->Error('Unknown color type: '.$file);
|
|
| 2068 | + } |
|
| 2069 | + if(ord($this->_readstream($f,1))!=0) {
|
|
| 2070 | + $this->Error('Unknown compression method: '.$file);
|
|
| 2071 | + } |
|
| 2072 | + if(ord($this->_readstream($f,1))!=0) {
|
|
| 2073 | + $this->Error('Unknown filter method: '.$file);
|
|
| 2074 | + } |
|
| 2075 | + if(ord($this->_readstream($f,1))!=0) {
|
|
| 2076 | + $this->Error('Interlacing not supported: '.$file);
|
|
| 2077 | + } |
|
| 1976 | 2078 | $this->_readstream($f,4); |
| 1977 | 2079 | $dp = '/Predictor 15 /Colors '.($colspace=='DeviceRGB' ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w; |
| 1978 | 2080 | |
@@ -1989,44 +2091,45 @@ discard block |
||
| 1989 | 2091 | // Read palette |
| 1990 | 2092 | $pal = $this->_readstream($f,$n); |
| 1991 | 2093 | $this->_readstream($f,4); |
| 1992 | - } |
|
| 1993 | - elseif($type=='tRNS') |
|
| 2094 | + } elseif($type=='tRNS') |
|
| 1994 | 2095 | {
|
| 1995 | 2096 | // Read transparency info |
| 1996 | 2097 | $t = $this->_readstream($f,$n); |
| 1997 | - if($ct==0) |
|
| 1998 | - $trns = array(ord(substr($t,1,1))); |
|
| 1999 | - elseif($ct==2) |
|
| 2000 | - $trns = array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); |
|
| 2001 | - else |
|
| 2098 | + if($ct==0) {
|
|
| 2099 | + $trns = array(ord(substr($t,1,1))); |
|
| 2100 | + } elseif($ct==2) {
|
|
| 2101 | + $trns = array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); |
|
| 2102 | + } else |
|
| 2002 | 2103 | {
|
| 2003 | 2104 | $pos = strpos($t,chr(0)); |
| 2004 | - if($pos!==false) |
|
| 2005 | - $trns = array($pos); |
|
| 2105 | + if($pos!==false) {
|
|
| 2106 | + $trns = array($pos); |
|
| 2107 | + } |
|
| 2006 | 2108 | } |
| 2007 | 2109 | $this->_readstream($f,4); |
| 2008 | - } |
|
| 2009 | - elseif($type=='IDAT') |
|
| 2110 | + } elseif($type=='IDAT') |
|
| 2010 | 2111 | {
|
| 2011 | 2112 | // Read image data block |
| 2012 | 2113 | $data .= $this->_readstream($f,$n); |
| 2013 | 2114 | $this->_readstream($f,4); |
| 2115 | + } elseif($type=='IEND') {
|
|
| 2116 | + break; |
|
| 2117 | + } else {
|
|
| 2118 | + $this->_readstream($f,$n+4); |
|
| 2014 | 2119 | } |
| 2015 | - elseif($type=='IEND') |
|
| 2016 | - break; |
|
| 2017 | - else |
|
| 2018 | - $this->_readstream($f,$n+4); |
|
| 2019 | 2120 | } |
| 2020 | 2121 | while($n); |
| 2021 | 2122 | |
| 2022 | - if($colspace=='Indexed' && empty($pal)) |
|
| 2023 | - $this->Error('Missing palette in '.$file);
|
|
| 2123 | + if($colspace=='Indexed' && empty($pal)) {
|
|
| 2124 | + $this->Error('Missing palette in '.$file);
|
|
| 2125 | + } |
|
| 2024 | 2126 | $info = array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'dp'=>$dp, 'pal'=>$pal, 'trns'=>$trns);
|
| 2025 | 2127 | if($ct>=4) |
| 2026 | 2128 | {
|
| 2027 | 2129 | // Extract alpha channel |
| 2028 | - if(!function_exists('gzuncompress'))
|
|
| 2029 | - $this->Error('Zlib not available, can\'t handle alpha channel: '.$file);
|
|
| 2130 | + if(!function_exists('gzuncompress')) {
|
|
| 2131 | + $this->Error('Zlib not available, can\'t handle alpha channel: '.$file);
|
|
| 2132 | + } |
|
| 2030 | 2133 | $data = gzuncompress($data); |
| 2031 | 2134 | $color = ''; |
| 2032 | 2135 | $alpha = ''; |
@@ -2043,8 +2146,7 @@ discard block |
||
| 2043 | 2146 | $color .= preg_replace('/(.)./s','$1',$line);
|
| 2044 | 2147 | $alpha .= preg_replace('/.(.)/s','$1',$line);
|
| 2045 | 2148 | } |
| 2046 | - } |
|
| 2047 | - else |
|
| 2149 | + } else |
|
| 2048 | 2150 | {
|
| 2049 | 2151 | // RGB image |
| 2050 | 2152 | $len = 4*$w; |
@@ -2062,8 +2164,9 @@ discard block |
||
| 2062 | 2164 | $data = gzcompress($color); |
| 2063 | 2165 | $info['smask'] = gzcompress($alpha); |
| 2064 | 2166 | $this->WithAlpha = true; |
| 2065 | - if($this->PDFVersion<'1.4') |
|
| 2066 | - $this->PDFVersion = '1.4'; |
|
| 2167 | + if($this->PDFVersion<'1.4') {
|
|
| 2168 | + $this->PDFVersion = '1.4'; |
|
| 2169 | + } |
|
| 2067 | 2170 | } |
| 2068 | 2171 | $info['data'] = $data; |
| 2069 | 2172 | return $info; |
@@ -2082,13 +2185,15 @@ discard block |
||
| 2082 | 2185 | while($n>0 && !feof($f)) |
| 2083 | 2186 | {
|
| 2084 | 2187 | $s = fread($f,$n); |
| 2085 | - if($s===false) |
|
| 2086 | - $this->Error('Error while reading stream');
|
|
| 2188 | + if($s===false) {
|
|
| 2189 | + $this->Error('Error while reading stream');
|
|
| 2190 | + } |
|
| 2087 | 2191 | $n -= strlen($s); |
| 2088 | 2192 | $res .= $s; |
| 2089 | 2193 | } |
| 2090 | - if($n>0) |
|
| 2091 | - $this->Error('Unexpected end of stream');
|
|
| 2194 | + if($n>0) {
|
|
| 2195 | + $this->Error('Unexpected end of stream');
|
|
| 2196 | + } |
|
| 2092 | 2197 | return $res; |
| 2093 | 2198 | } |
| 2094 | 2199 | |
@@ -2112,21 +2217,25 @@ discard block |
||
| 2112 | 2217 | protected function _parsegif(string $file) : array |
| 2113 | 2218 | {
|
| 2114 | 2219 | // Extract info from a GIF file (via PNG conversion) |
| 2115 | - if(!function_exists('imagepng'))
|
|
| 2116 | - $this->Error('GD extension is required for GIF support');
|
|
| 2117 | - if(!function_exists('imagecreatefromgif'))
|
|
| 2118 | - $this->Error('GD has no GIF read support');
|
|
| 2220 | + if(!function_exists('imagepng')) {
|
|
| 2221 | + $this->Error('GD extension is required for GIF support');
|
|
| 2222 | + } |
|
| 2223 | + if(!function_exists('imagecreatefromgif')) {
|
|
| 2224 | + $this->Error('GD has no GIF read support');
|
|
| 2225 | + } |
|
| 2119 | 2226 | $im = imagecreatefromgif($file); |
| 2120 | - if(!$im) |
|
| 2121 | - $this->Error('Missing or incorrect image file: '.$file);
|
|
| 2227 | + if(!$im) {
|
|
| 2228 | + $this->Error('Missing or incorrect image file: '.$file);
|
|
| 2229 | + } |
|
| 2122 | 2230 | imageinterlace($im,0); |
| 2123 | 2231 | ob_start(); |
| 2124 | 2232 | imagepng($im); |
| 2125 | 2233 | $data = ob_get_clean(); |
| 2126 | 2234 | imagedestroy($im); |
| 2127 | 2235 | $f = fopen('php://temp','rb+');
|
| 2128 | - if(!$f) |
|
| 2129 | - $this->Error('Unable to create memory stream');
|
|
| 2236 | + if(!$f) {
|
|
| 2237 | + $this->Error('Unable to create memory stream');
|
|
| 2238 | + } |
|
| 2130 | 2239 | fwrite($f,$data); |
| 2131 | 2240 | rewind($f); |
| 2132 | 2241 | $info = $this->_parsepngstream($f,$file); |
@@ -2141,14 +2250,15 @@ discard block |
||
| 2141 | 2250 | protected function _out(string $s) : void |
| 2142 | 2251 | {
|
| 2143 | 2252 | // Add a line to the document |
| 2144 | - if($this->state==2) |
|
| 2145 | - $this->pages[$this->page] .= $s."\n"; |
|
| 2146 | - elseif($this->state==1) |
|
| 2147 | - $this->_put($s); |
|
| 2148 | - elseif($this->state==0) |
|
| 2149 | - $this->Error('No page has been added yet');
|
|
| 2150 | - elseif($this->state==3) |
|
| 2151 | - $this->Error('The document is closed');
|
|
| 2253 | + if($this->state==2) {
|
|
| 2254 | + $this->pages[$this->page] .= $s."\n"; |
|
| 2255 | + } elseif($this->state==1) {
|
|
| 2256 | + $this->_put($s); |
|
| 2257 | + } elseif($this->state==0) {
|
|
| 2258 | + $this->Error('No page has been added yet');
|
|
| 2259 | + } elseif($this->state==3) {
|
|
| 2260 | + $this->Error('The document is closed');
|
|
| 2261 | + } |
|
| 2152 | 2262 | } |
| 2153 | 2263 | |
| 2154 | 2264 | /** |
@@ -2176,8 +2286,9 @@ discard block |
||
| 2176 | 2286 | protected function _newobj(?int $n=null) : void |
| 2177 | 2287 | {
|
| 2178 | 2288 | // Begin a new object |
| 2179 | - if($n===null) |
|
| 2180 | - $n = ++$this->n; |
|
| 2289 | + if($n===null) {
|
|
| 2290 | + $n = ++$this->n; |
|
| 2291 | + } |
|
| 2181 | 2292 | $this->offsets[$n] = $this->_getoffset(); |
| 2182 | 2293 | $this->_put($n.' 0 obj'); |
| 2183 | 2294 | } |
@@ -2203,9 +2314,9 @@ discard block |
||
| 2203 | 2314 | {
|
| 2204 | 2315 | $entries = '/Filter /FlateDecode '; |
| 2205 | 2316 | $data = gzcompress($data); |
| 2317 | + } else {
|
|
| 2318 | + $entries = ''; |
|
| 2206 | 2319 | } |
| 2207 | - else |
|
| 2208 | - $entries = ''; |
|
| 2209 | 2320 | $entries .= '/Length '.strlen($data); |
| 2210 | 2321 | $this->_newobj(); |
| 2211 | 2322 | $this->_put('<<'.$entries.'>>');
|
@@ -2222,10 +2333,12 @@ discard block |
||
| 2222 | 2333 | $this->_newobj(); |
| 2223 | 2334 | $this->_put('<</Type /Page');
|
| 2224 | 2335 | $this->_put('/Parent 1 0 R');
|
| 2225 | - if(isset($this->PageInfo[$n]['size'])) |
|
| 2226 | - $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageInfo[$n]['size'][0],$this->PageInfo[$n]['size'][1]));
|
|
| 2227 | - if(isset($this->PageInfo[$n]['rotation'])) |
|
| 2228 | - $this->_put('/Rotate '.$this->PageInfo[$n]['rotation']);
|
|
| 2336 | + if(isset($this->PageInfo[$n]['size'])) {
|
|
| 2337 | + $this->_put(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageInfo[$n]['size'][0],$this->PageInfo[$n]['size'][1]));
|
|
| 2338 | + } |
|
| 2339 | + if(isset($this->PageInfo[$n]['rotation'])) {
|
|
| 2340 | + $this->_put('/Rotate '.$this->PageInfo[$n]['rotation']);
|
|
| 2341 | + } |
|
| 2229 | 2342 | $this->_put('/Resources 2 0 R');
|
| 2230 | 2343 | if(isset($this->PageLinks[$n])) |
| 2231 | 2344 | {
|
@@ -2235,27 +2348,30 @@ discard block |
||
| 2235 | 2348 | {
|
| 2236 | 2349 | $rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
|
| 2237 | 2350 | $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; |
| 2238 | - if(is_string($pl[4])) |
|
| 2239 | - $annots .= '/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; |
|
| 2240 | - else |
|
| 2351 | + if(is_string($pl[4])) {
|
|
| 2352 | + $annots .= '/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; |
|
| 2353 | + } else |
|
| 2241 | 2354 | {
|
| 2242 | 2355 | $l = $this->links[$pl[4]]; |
| 2243 | - if(isset($this->PageInfo[$l[0]]['size'])) |
|
| 2244 | - $h = $this->PageInfo[$l[0]]['size'][1]; |
|
| 2245 | - else |
|
| 2246 | - $h = ($this->DefOrientation=='P') ? $this->DefPageSize[1]*$this->k : $this->DefPageSize[0]*$this->k; |
|
| 2356 | + if(isset($this->PageInfo[$l[0]]['size'])) {
|
|
| 2357 | + $h = $this->PageInfo[$l[0]]['size'][1]; |
|
| 2358 | + } else {
|
|
| 2359 | + $h = ($this->DefOrientation=='P') ? $this->DefPageSize[1]*$this->k : $this->DefPageSize[0]*$this->k; |
|
| 2360 | + } |
|
| 2247 | 2361 | $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',$this->PageInfo[$l[0]]['n'],$h-$l[1]*$this->k);
|
| 2248 | 2362 | } |
| 2249 | 2363 | } |
| 2250 | 2364 | $this->_put($annots.']'); |
| 2251 | 2365 | } |
| 2252 | - if($this->WithAlpha) |
|
| 2253 | - $this->_put('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
|
|
| 2366 | + if($this->WithAlpha) {
|
|
| 2367 | + $this->_put('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
|
|
| 2368 | + } |
|
| 2254 | 2369 | $this->_put('/Contents '.($this->n+1).' 0 R>>');
|
| 2255 | 2370 | $this->_put('endobj');
|
| 2256 | 2371 | // Page content |
| 2257 | - if(!empty($this->AliasNbPages)) |
|
| 2258 | - $this->pages[$n] = str_replace($this->AliasNbPages, strval($this->page), $this->pages[$n]); |
|
| 2372 | + if(!empty($this->AliasNbPages)) {
|
|
| 2373 | + $this->pages[$n] = str_replace($this->AliasNbPages, strval($this->page), $this->pages[$n]); |
|
| 2374 | + } |
|
| 2259 | 2375 | $this->_putstreamobject($this->pages[$n]); |
| 2260 | 2376 | } |
| 2261 | 2377 | |
@@ -2265,24 +2381,26 @@ discard block |
||
| 2265 | 2381 | protected function _putpages() : void |
| 2266 | 2382 | {
|
| 2267 | 2383 | $nb = $this->page; |
| 2268 | - for($n=1;$n<=$nb;$n++) |
|
| 2269 | - $this->PageInfo[$n]['n'] = $this->n+1+2*($n-1); |
|
| 2270 | - for($n=1;$n<=$nb;$n++) |
|
| 2271 | - $this->_putpage($n); |
|
| 2384 | + for($n=1;$n<=$nb;$n++) {
|
|
| 2385 | + $this->PageInfo[$n]['n'] = $this->n+1+2*($n-1); |
|
| 2386 | + } |
|
| 2387 | + for($n=1;$n<=$nb;$n++) {
|
|
| 2388 | + $this->_putpage($n); |
|
| 2389 | + } |
|
| 2272 | 2390 | // Pages root |
| 2273 | 2391 | $this->_newobj(1); |
| 2274 | 2392 | $this->_put('<</Type /Pages');
|
| 2275 | 2393 | $kids = '/Kids ['; |
| 2276 | - for($n=1;$n<=$nb;$n++) |
|
| 2277 | - $kids .= $this->PageInfo[$n]['n'].' 0 R '; |
|
| 2394 | + for($n=1;$n<=$nb;$n++) {
|
|
| 2395 | + $kids .= $this->PageInfo[$n]['n'].' 0 R '; |
|
| 2396 | + } |
|
| 2278 | 2397 | $this->_put($kids.']'); |
| 2279 | 2398 | $this->_put('/Count '.$nb);
|
| 2280 | 2399 | if($this->DefOrientation=='P') |
| 2281 | 2400 | {
|
| 2282 | 2401 | $w = $this->DefPageSize[0]; |
| 2283 | 2402 | $h = $this->DefPageSize[1]; |
| 2284 | - } |
|
| 2285 | - else |
|
| 2403 | + } else |
|
| 2286 | 2404 | {
|
| 2287 | 2405 | $w = $this->DefPageSize[1]; |
| 2288 | 2406 | $h = $this->DefPageSize[0]; |
@@ -2303,17 +2421,21 @@ discard block |
||
| 2303 | 2421 | $this->_newobj(); |
| 2304 | 2422 | $this->FontFiles[$file]['n'] = $this->n; |
| 2305 | 2423 | $font = file_get_contents($this->fontpath.$file,true); |
| 2306 | - if(!$font) |
|
| 2307 | - $this->Error('Font file not found: '.$file);
|
|
| 2424 | + if(!$font) {
|
|
| 2425 | + $this->Error('Font file not found: '.$file);
|
|
| 2426 | + } |
|
| 2308 | 2427 | $compressed = (substr($file,-2)=='.z'); |
| 2309 | - if(!$compressed && isset($info['length2'])) |
|
| 2310 | - $font = substr($font,6,$info['length1']).substr($font,6+$info['length1']+6,$info['length2']); |
|
| 2428 | + if(!$compressed && isset($info['length2'])) {
|
|
| 2429 | + $font = substr($font,6,$info['length1']).substr($font,6+$info['length1']+6,$info['length2']); |
|
| 2430 | + } |
|
| 2311 | 2431 | $this->_put('<</Length '.strlen($font));
|
| 2312 | - if($compressed) |
|
| 2313 | - $this->_put('/Filter /FlateDecode');
|
|
| 2432 | + if($compressed) {
|
|
| 2433 | + $this->_put('/Filter /FlateDecode');
|
|
| 2434 | + } |
|
| 2314 | 2435 | $this->_put('/Length1 '.$info['length1']);
|
| 2315 | - if(isset($info['length2'])) |
|
| 2316 | - $this->_put('/Length2 '.$info['length2'].' /Length3 0');
|
|
| 2436 | + if(isset($info['length2'])) {
|
|
| 2437 | + $this->_put('/Length2 '.$info['length2'].' /Length3 0');
|
|
| 2438 | + } |
|
| 2317 | 2439 | $this->_put('>>');
|
| 2318 | 2440 | $this->_putstream($font); |
| 2319 | 2441 | $this->_put('endobj');
|
@@ -2335,10 +2457,11 @@ discard block |
||
| 2335 | 2457 | $cmapkey = ''; |
| 2336 | 2458 | if(isset($font['uv'])) |
| 2337 | 2459 | {
|
| 2338 | - if(isset($font['enc'])) |
|
| 2339 | - $cmapkey = $font['enc']; |
|
| 2340 | - else |
|
| 2341 | - $cmapkey = $font['name']; |
|
| 2460 | + if(isset($font['enc'])) {
|
|
| 2461 | + $cmapkey = $font['enc']; |
|
| 2462 | + } else {
|
|
| 2463 | + $cmapkey = $font['name']; |
|
| 2464 | + } |
|
| 2342 | 2465 | if(!isset($this->cmaps[$cmapkey])) |
| 2343 | 2466 | {
|
| 2344 | 2467 | $cmap = $this->_tounicodecmap($font['uv']); |
@@ -2350,8 +2473,9 @@ discard block |
||
| 2350 | 2473 | $this->fonts[$k]['n'] = $this->n+1; |
| 2351 | 2474 | $type = $font['type']; |
| 2352 | 2475 | $name = $font['name']; |
| 2353 | - if($font['subsetted']) |
|
| 2354 | - $name = 'AAAAAA+'.$name; |
|
| 2476 | + if($font['subsetted']) {
|
|
| 2477 | + $name = 'AAAAAA+'.$name; |
|
| 2478 | + } |
|
| 2355 | 2479 | if($type=='Core') |
| 2356 | 2480 | {
|
| 2357 | 2481 | // Core font |
@@ -2359,14 +2483,15 @@ discard block |
||
| 2359 | 2483 | $this->_put('<</Type /Font');
|
| 2360 | 2484 | $this->_put('/BaseFont /'.$name);
|
| 2361 | 2485 | $this->_put('/Subtype /Type1');
|
| 2362 | - if($name!='Symbol' && $name!='ZapfDingbats') |
|
| 2363 | - $this->_put('/Encoding /WinAnsiEncoding');
|
|
| 2364 | - if(isset($font['uv'])) |
|
| 2365 | - $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
|
|
| 2486 | + if($name!='Symbol' && $name!='ZapfDingbats') {
|
|
| 2487 | + $this->_put('/Encoding /WinAnsiEncoding');
|
|
| 2488 | + } |
|
| 2489 | + if(isset($font['uv'])) {
|
|
| 2490 | + $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
|
|
| 2491 | + } |
|
| 2366 | 2492 | $this->_put('>>');
|
| 2367 | 2493 | $this->_put('endobj');
|
| 2368 | - } |
|
| 2369 | - elseif($type=='Type1' || $type=='TrueType') |
|
| 2494 | + } elseif($type=='Type1' || $type=='TrueType') |
|
| 2370 | 2495 | {
|
| 2371 | 2496 | // Additional Type1 or TrueType/OpenType font |
| 2372 | 2497 | $this->_newobj(); |
@@ -2376,38 +2501,43 @@ discard block |
||
| 2376 | 2501 | $this->_put('/FirstChar 32 /LastChar 255');
|
| 2377 | 2502 | $this->_put('/Widths '.($this->n+1).' 0 R');
|
| 2378 | 2503 | $this->_put('/FontDescriptor '.($this->n+2).' 0 R');
|
| 2379 | - if(isset($font['diff'])) |
|
| 2380 | - $this->_put('/Encoding '.$this->encodings[$font['enc']].' 0 R');
|
|
| 2381 | - else |
|
| 2382 | - $this->_put('/Encoding /WinAnsiEncoding');
|
|
| 2383 | - if(isset($font['uv'])) |
|
| 2384 | - $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
|
|
| 2504 | + if(isset($font['diff'])) {
|
|
| 2505 | + $this->_put('/Encoding '.$this->encodings[$font['enc']].' 0 R');
|
|
| 2506 | + } else {
|
|
| 2507 | + $this->_put('/Encoding /WinAnsiEncoding');
|
|
| 2508 | + } |
|
| 2509 | + if(isset($font['uv'])) {
|
|
| 2510 | + $this->_put('/ToUnicode '.$this->cmaps[$cmapkey].' 0 R');
|
|
| 2511 | + } |
|
| 2385 | 2512 | $this->_put('>>');
|
| 2386 | 2513 | $this->_put('endobj');
|
| 2387 | 2514 | // Widths |
| 2388 | 2515 | $this->_newobj(); |
| 2389 | 2516 | $cw = &$font['cw']; |
| 2390 | 2517 | $s = '['; |
| 2391 | - for($i=32;$i<=255;$i++) |
|
| 2392 | - $s .= $cw[chr($i)].' '; |
|
| 2518 | + for($i=32;$i<=255;$i++) {
|
|
| 2519 | + $s .= $cw[chr($i)].' '; |
|
| 2520 | + } |
|
| 2393 | 2521 | $this->_put($s.']'); |
| 2394 | 2522 | $this->_put('endobj');
|
| 2395 | 2523 | // Descriptor |
| 2396 | 2524 | $this->_newobj(); |
| 2397 | 2525 | $s = '<</Type /FontDescriptor /FontName /'.$name; |
| 2398 | - foreach($font['desc'] as $k=>$v) |
|
| 2399 | - $s .= ' /'.$k.' '.$v; |
|
| 2400 | - if(!empty($font['file'])) |
|
| 2401 | - $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R'; |
|
| 2526 | + foreach($font['desc'] as $k=>$v) {
|
|
| 2527 | + $s .= ' /'.$k.' '.$v; |
|
| 2528 | + } |
|
| 2529 | + if(!empty($font['file'])) {
|
|
| 2530 | + $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R'; |
|
| 2531 | + } |
|
| 2402 | 2532 | $this->_put($s.'>>'); |
| 2403 | 2533 | $this->_put('endobj');
|
| 2404 | - } |
|
| 2405 | - else |
|
| 2534 | + } else |
|
| 2406 | 2535 | {
|
| 2407 | 2536 | // Allow for additional types |
| 2408 | 2537 | $mtd = '_put'.strtolower($type); |
| 2409 | - if(!method_exists($this,$mtd)) |
|
| 2410 | - $this->Error('Unsupported font type: '.$type);
|
|
| 2538 | + if(!method_exists($this,$mtd)) {
|
|
| 2539 | + $this->Error('Unsupported font type: '.$type);
|
|
| 2540 | + } |
|
| 2411 | 2541 | $this->$mtd($font); |
| 2412 | 2542 | } |
| 2413 | 2543 | } |
@@ -2429,8 +2559,7 @@ discard block |
||
| 2429 | 2559 | {
|
| 2430 | 2560 | $ranges .= sprintf("<%02X> <%02X> <%04X>\n",$c,$c+$v[1]-1,$v[0]);
|
| 2431 | 2561 | $nbr++; |
| 2432 | - } |
|
| 2433 | - else |
|
| 2562 | + } else |
|
| 2434 | 2563 | {
|
| 2435 | 2564 | $chars .= sprintf("<%02X> <%04X>\n",$c,$v);
|
| 2436 | 2565 | $nbc++; |
@@ -2493,28 +2622,33 @@ discard block |
||
| 2493 | 2622 | $this->_put('/Subtype /Image');
|
| 2494 | 2623 | $this->_put('/Width '.$info['w']);
|
| 2495 | 2624 | $this->_put('/Height '.$info['h']);
|
| 2496 | - if($info['cs']=='Indexed') |
|
| 2497 | - $this->_put('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
|
|
| 2498 | - else |
|
| 2625 | + if($info['cs']=='Indexed') {
|
|
| 2626 | + $this->_put('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
|
|
| 2627 | + } else |
|
| 2499 | 2628 | {
|
| 2500 | 2629 | $this->_put('/ColorSpace /'.$info['cs']);
|
| 2501 | - if($info['cs']=='DeviceCMYK') |
|
| 2502 | - $this->_put('/Decode [1 0 1 0 1 0 1 0]');
|
|
| 2630 | + if($info['cs']=='DeviceCMYK') {
|
|
| 2631 | + $this->_put('/Decode [1 0 1 0 1 0 1 0]');
|
|
| 2632 | + } |
|
| 2503 | 2633 | } |
| 2504 | 2634 | $this->_put('/BitsPerComponent '.$info['bpc']);
|
| 2505 | - if(isset($info['f'])) |
|
| 2506 | - $this->_put('/Filter /'.$info['f']);
|
|
| 2507 | - if(isset($info['dp'])) |
|
| 2508 | - $this->_put('/DecodeParms <<'.$info['dp'].'>>');
|
|
| 2635 | + if(isset($info['f'])) {
|
|
| 2636 | + $this->_put('/Filter /'.$info['f']);
|
|
| 2637 | + } |
|
| 2638 | + if(isset($info['dp'])) {
|
|
| 2639 | + $this->_put('/DecodeParms <<'.$info['dp'].'>>');
|
|
| 2640 | + } |
|
| 2509 | 2641 | if(isset($info['trns']) && is_array($info['trns'])) |
| 2510 | 2642 | {
|
| 2511 | 2643 | $trns = ''; |
| 2512 | - for($i=0;$i<count($info['trns']);$i++) |
|
| 2513 | - $trns .= $info['trns'][$i].' '.$info['trns'][$i].' '; |
|
| 2644 | + for($i=0;$i<count($info['trns']);$i++) {
|
|
| 2645 | + $trns .= $info['trns'][$i].' '.$info['trns'][$i].' '; |
|
| 2646 | + } |
|
| 2514 | 2647 | $this->_put('/Mask ['.$trns.']');
|
| 2515 | 2648 | } |
| 2516 | - if(isset($info['smask'])) |
|
| 2517 | - $this->_put('/SMask '.($this->n+1).' 0 R');
|
|
| 2649 | + if(isset($info['smask'])) {
|
|
| 2650 | + $this->_put('/SMask '.($this->n+1).' 0 R');
|
|
| 2651 | + } |
|
| 2518 | 2652 | $this->_put('/Length '.strlen($info['data']).'>>');
|
| 2519 | 2653 | $this->_putstream($info['data']); |
| 2520 | 2654 | $this->_put('endobj');
|
@@ -2526,8 +2660,9 @@ discard block |
||
| 2526 | 2660 | $this->_putimage($smask); |
| 2527 | 2661 | } |
| 2528 | 2662 | // Palette |
| 2529 | - if($info['cs']=='Indexed') |
|
| 2530 | - $this->_putstreamobject($info['pal']); |
|
| 2663 | + if($info['cs']=='Indexed') {
|
|
| 2664 | + $this->_putstreamobject($info['pal']); |
|
| 2665 | + } |
|
| 2531 | 2666 | } |
| 2532 | 2667 | |
| 2533 | 2668 | /** |
@@ -2535,8 +2670,9 @@ discard block |
||
| 2535 | 2670 | */ |
| 2536 | 2671 | protected function _putxobjectdict() : void |
| 2537 | 2672 | {
|
| 2538 | - foreach($this->images as $image) |
|
| 2539 | - $this->_put('/I'.$image['i'].' '.$image['n'].' 0 R');
|
|
| 2673 | + foreach($this->images as $image) {
|
|
| 2674 | + $this->_put('/I'.$image['i'].' '.$image['n'].' 0 R');
|
|
| 2675 | + } |
|
| 2540 | 2676 | } |
| 2541 | 2677 | |
| 2542 | 2678 | /** |
@@ -2546,8 +2682,9 @@ discard block |
||
| 2546 | 2682 | {
|
| 2547 | 2683 | $this->_put('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
|
| 2548 | 2684 | $this->_put('/Font <<');
|
| 2549 | - foreach($this->fonts as $font) |
|
| 2550 | - $this->_put('/F'.$font['i'].' '.$font['n'].' 0 R');
|
|
| 2685 | + foreach($this->fonts as $font) {
|
|
| 2686 | + $this->_put('/F'.$font['i'].' '.$font['n'].' 0 R');
|
|
| 2687 | + } |
|
| 2551 | 2688 | $this->_put('>>');
|
| 2552 | 2689 | $this->_put('/XObject <<');
|
| 2553 | 2690 | $this->_putxobjectdict(); |
@@ -2576,8 +2713,9 @@ discard block |
||
| 2576 | 2713 | {
|
| 2577 | 2714 | $this->metadata['Producer'] = 'FPDF '.FPDF_VERSION; |
| 2578 | 2715 | $this->metadata['CreationDate'] = 'D:'.@date('YmdHis');
|
| 2579 | - foreach($this->metadata as $key=>$value) |
|
| 2580 | - $this->_put('/'.$key.' '.$this->_textstring($value));
|
|
| 2716 | + foreach($this->metadata as $key=>$value) {
|
|
| 2717 | + $this->_put('/'.$key.' '.$this->_textstring($value));
|
|
| 2718 | + } |
|
| 2581 | 2719 | } |
| 2582 | 2720 | |
| 2583 | 2721 | /** |
@@ -2588,20 +2726,22 @@ discard block |
||
| 2588 | 2726 | $n = $this->PageInfo[1]['n']; |
| 2589 | 2727 | $this->_put('/Type /Catalog');
|
| 2590 | 2728 | $this->_put('/Pages 1 0 R');
|
| 2591 | - if($this->ZoomMode=='fullpage') |
|
| 2592 | - $this->_put('/OpenAction ['.$n.' 0 R /Fit]');
|
|
| 2593 | - elseif($this->ZoomMode=='fullwidth') |
|
| 2594 | - $this->_put('/OpenAction ['.$n.' 0 R /FitH null]');
|
|
| 2595 | - elseif($this->ZoomMode=='real') |
|
| 2596 | - $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null 1]');
|
|
| 2597 | - elseif(!is_string($this->ZoomMode)) |
|
| 2598 | - $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']');
|
|
| 2599 | - if($this->LayoutMode=='single') |
|
| 2600 | - $this->_put('/PageLayout /SinglePage');
|
|
| 2601 | - elseif($this->LayoutMode=='continuous') |
|
| 2602 | - $this->_put('/PageLayout /OneColumn');
|
|
| 2603 | - elseif($this->LayoutMode=='two') |
|
| 2604 | - $this->_put('/PageLayout /TwoColumnLeft');
|
|
| 2729 | + if($this->ZoomMode=='fullpage') {
|
|
| 2730 | + $this->_put('/OpenAction ['.$n.' 0 R /Fit]');
|
|
| 2731 | + } elseif($this->ZoomMode=='fullwidth') {
|
|
| 2732 | + $this->_put('/OpenAction ['.$n.' 0 R /FitH null]');
|
|
| 2733 | + } elseif($this->ZoomMode=='real') {
|
|
| 2734 | + $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null 1]');
|
|
| 2735 | + } elseif(!is_string($this->ZoomMode)) {
|
|
| 2736 | + $this->_put('/OpenAction ['.$n.' 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']');
|
|
| 2737 | + } |
|
| 2738 | + if($this->LayoutMode=='single') {
|
|
| 2739 | + $this->_put('/PageLayout /SinglePage');
|
|
| 2740 | + } elseif($this->LayoutMode=='continuous') {
|
|
| 2741 | + $this->_put('/PageLayout /OneColumn');
|
|
| 2742 | + } elseif($this->LayoutMode=='two') {
|
|
| 2743 | + $this->_put('/PageLayout /TwoColumnLeft');
|
|
| 2744 | + } |
|
| 2605 | 2745 | } |
| 2606 | 2746 | |
| 2607 | 2747 | /** |
@@ -2647,8 +2787,9 @@ discard block |
||
| 2647 | 2787 | $this->_put('xref');
|
| 2648 | 2788 | $this->_put('0 '.($this->n+1));
|
| 2649 | 2789 | $this->_put('0000000000 65535 f ');
|
| 2650 | - for($i=1;$i<=$this->n;$i++) |
|
| 2651 | - $this->_put(sprintf('%010d 00000 n ',$this->offsets[$i]));
|
|
| 2790 | + for($i=1;$i<=$this->n;$i++) {
|
|
| 2791 | + $this->_put(sprintf('%010d 00000 n ',$this->offsets[$i]));
|
|
| 2792 | + } |
|
| 2652 | 2793 | // Trailer |
| 2653 | 2794 | $this->_put('trailer');
|
| 2654 | 2795 | $this->_put('<<');
|