Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Zend_Pdf_Resource_Font_Simple_Standard_ZapfDingbats Class Reference
Inheritance diagram for Zend_Pdf_Resource_Font_Simple_Standard_ZapfDingbats:
Zend_Pdf_Resource_Font_Simple_Standard Zend_Pdf_Resource_Font_Simple Zend_Pdf_Resource_Font Zend_Pdf_Resource

Public Member Functions

 __construct ()
 
 encodeString ($string, $charEncoding)
 
 decodeString ($string, $charEncoding)
 
 toUnicode ($string, $charEncoding='')
 
- Public Member Functions inherited from Zend_Pdf_Resource_Font_Simple_Standard
 __construct ()
 
- Public Member Functions inherited from Zend_Pdf_Resource_Font_Simple
 __construct ()
 
 glyphNumbersForCharacters ($characterCodes)
 
 glyphNumberForCharacter ($characterCode)
 
 getCoveredPercentage ($string, $charEncoding='')
 
 widthsForGlyphs ($glyphNumbers)
 
 widthForGlyph ($glyphNumber)
 
 encodeString ($string, $charEncoding)
 
 decodeString ($string, $charEncoding)
 
- Public Member Functions inherited from Zend_Pdf_Resource_Font
 __construct ()
 
 __toString ()
 
 getFontType ()
 
 getFontName ($nameType, $language, $characterSet=null)
 
 getFontNames ()
 
 isBold ()
 
 isItalic ()
 
 isMonospace ()
 
 getUnderlinePosition ()
 
 getUnderlineThickness ()
 
 getStrikePosition ()
 
 getStrikeThickness ()
 
 getUnitsPerEm ()
 
 getAscent ()
 
 getDescent ()
 
 getLineGap ()
 
 getLineHeight ()
 
 glyphNumbersForCharacters ($characterCodes)
 
 glyphNumberForCharacter ($characterCode)
 
 getCoveredPercentage ($string, $charEncoding='')
 
 widthsForGlyphs ($glyphNumbers)
 
 widthForGlyph ($glyphNumber)
 
 encodeString ($string, $charEncoding)
 
 decodeString ($string, $charEncoding)
 
 toEmSpace ($value)
 
- Public Member Functions inherited from Zend_Pdf_Resource
 __construct ($resource)
 
 __clone ()
 
 cloneResource ($factory, &$processed)
 
 getResource ()
 
 getFactory ()
 

Protected Attributes

 $_toFontEncoding
 
 $_fromFontEncoding
 
- Protected Attributes inherited from Zend_Pdf_Resource_Font_Simple
 $_cmap = null
 
 $_glyphWidths = null
 
 $_missingGlyphWidth = 0
 
- Protected Attributes inherited from Zend_Pdf_Resource_Font
 $_fontType = Zend_Pdf_Font::TYPE_UNKNOWN
 
 $_fontNames = array()
 
 $_isBold = false
 
 $_isItalic = false
 
 $_isMonospace = false
 
 $_underlinePosition = 0
 
 $_underlineThickness = 0
 
 $_strikePosition = 0
 
 $_strikeThickness = 0
 
 $_unitsPerEm = 0
 
 $_ascent = 0
 
 $_descent = 0
 
 $_lineGap = 0
 
- Protected Attributes inherited from Zend_Pdf_Resource
 $_objectFactory
 
 $_resource
 

Detailed Description

Definition at line 49 of file ZapfDingbats.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Object constructor

Definition at line 197 of file ZapfDingbats.php.

198  {
199  parent::__construct();
200 
201 
202  /* Object properties */
203 
204  /* The font names are stored internally as Unicode UTF-16BE-encoded
205  * strings. Since this information is static, save unnecessary trips
206  * through iconv() and just use pre-encoded hexidecimal strings.
207  */
208  $this->_fontNames[Zend_Pdf_Font::NAME_COPYRIGHT]['en'] =
209  "\x00\x43\x00\x6f\x00\x70\x00\x79\x00\x72\x00\x69\x00\x67\x00\x68\x00"
210  . "\x74\x00\x20\x00\x28\x00\x63\x00\x29\x00\x20\x00\x31\x00\x39\x00"
211  . "\x38\x00\x35\x00\x2c\x00\x20\x00\x31\x00\x39\x00\x38\x00\x37\x00"
212  . "\x2c\x00\x20\x00\x31\x00\x39\x00\x38\x00\x38\x00\x2c\x00\x20\x00"
213  . "\x31\x00\x39\x00\x38\x00\x39\x00\x2c\x00\x20\x00\x31\x00\x39\x00"
214  . "\x39\x00\x37\x00\x20\x00\x41\x00\x64\x00\x6f\x00\x62\x00\x65\x00"
215  . "\x20\x00\x53\x00\x79\x00\x73\x00\x74\x00\x65\x00\x6d\x00\x73\x00"
216  . "\x20\x00\x49\x00\x6e\x00\x63\x00\x6f\x00\x72\x00\x70\x00\x6f\x00"
217  . "\x72\x00\x61\x00\x74\x00\x65\x00\x64\x00\x2e\x00\x20\x00\x41\x00"
218  . "\x6c\x00\x6c\x00\x20\x00\x52\x00\x69\x00\x67\x00\x68\x00\x74\x00"
219  . "\x73\x00\x20\x00\x52\x00\x65\x00\x73\x00\x65\x00\x72\x00\x76\x00"
220  . "\x65\x00\x64\x00\x2e\x00\x49\x00\x54\x00\x43\x00\x20\x00\x5a\x00"
221  . "\x61\x00\x70\x00\x66\x00\x20\x00\x44\x00\x69\x00\x6e\x00\x67\x00"
222  . "\x62\x00\x61\x00\x74\x00\x73\x00\x20\x00\x69\x00\x73\x00\x20\x00"
223  . "\x61\x00\x20\x00\x72\x00\x65\x00\x67\x00\x69\x00\x73\x00\x74\x00"
224  . "\x65\x00\x72\x00\x65\x00\x64\x00\x20\x00\x74\x00\x72\x00\x61\x00"
225  . "\x64\x00\x65\x00\x6d\x00\x61\x00\x72\x00\x6b\x00\x20\x00\x6f\x00"
226  . "\x66\x00\x20\x00\x49\x00\x6e\x00\x74\x00\x65\x00\x72\x00\x6e\x00"
227  . "\x61\x00\x74\x00\x69\x00\x6f\x00\x6e\x00\x61\x00\x6c\x00\x20\x00"
228  . "\x54\x00\x79\x00\x70\x00\x65\x00\x66\x00\x61\x00\x63\x00\x65\x00"
229  . "\x20\x00\x43\x00\x6f\x00\x72\x00\x70\x00\x6f\x00\x72\x00\x61\x00"
230  . "\x74\x00\x69\x00\x6f\x00\x6e\x00\x2e";
231  $this->_fontNames[Zend_Pdf_Font::NAME_FAMILY]['en'] =
232  "\x00\x5a\x00\x61\x00\x70\x00\x66\x00\x44\x00\x69\x00\x6e\x00\x67\x00"
233  . "\x62\x00\x61\x00\x74\x00\x73";
234  $this->_fontNames[Zend_Pdf_Font::NAME_STYLE]['en'] =
235  "\x00\x4d\x00\x65\x00\x64\x00\x69\x00\x75\x00\x6d";
236  $this->_fontNames[Zend_Pdf_Font::NAME_ID]['en'] =
237  "\x00\x34\x00\x33\x00\x30\x00\x38\x00\x32";
238  $this->_fontNames[Zend_Pdf_Font::NAME_FULL]['en'] =
239  "\x00\x5a\x00\x61\x00\x70\x00\x66\x00\x44\x00\x69\x00\x6e\x00\x67\x00"
240  . "\x62\x00\x61\x00\x74\x00\x73\x00\x20\x00\x4d\x00\x65\x00\x64\x00"
241  . "\x69\x00\x75\x00\x6d";
242  $this->_fontNames[Zend_Pdf_Font::NAME_VERSION]['en'] =
243  "\x00\x30\x00\x30\x00\x32\x00\x2e\x00\x30\x00\x30\x00\x30";
244  $this->_fontNames[Zend_Pdf_Font::NAME_POSTSCRIPT]['en'] =
245  "\x00\x5a\x00\x61\x00\x70\x00\x66\x00\x44\x00\x69\x00\x6e\x00\x67\x00"
246  . "\x62\x00\x61\x00\x74\x00\x73";
247 
248  $this->_isBold = false;
249  $this->_isItalic = false;
250  $this->_isMonospaced = false;
251 
252  $this->_underlinePosition = -100;
253  $this->_underlineThickness = 50;
254  $this->_strikePosition = 225;
255  $this->_strikeThickness = 50;
256 
257  $this->_unitsPerEm = 1000;
258 
259  $this->_ascent = 1000;
260  $this->_descent = 0;
261  $this->_lineGap = 200;
262 
263  /* The glyph numbers assigned here are synthetic; they do not match the
264  * actual glyph numbers used by the font. This is not a big deal though
265  * since this data never makes it to the PDF file. It is only used
266  * internally for layout calculations.
267  */
268  $this->_glyphWidths = array(
269  0x00 => 0x01f4, 0x01 => 0x0116, 0x02 => 0x03ce, 0x03 => 0x03c1,
270  0x04 => 0x03ce, 0x05 => 0x03d4, 0x06 => 0x02cf, 0x07 => 0x0315,
271  0x08 => 0x0316, 0x09 => 0x0317, 0x0a => 0x02b2, 0x0b => 0x03c0,
272  0x0c => 0x03ab, 0x0d => 0x0225, 0x0e => 0x0357, 0x0f => 0x038f,
273  0x10 => 0x03a5, 0x11 => 0x038f, 0x12 => 0x03b1, 0x13 => 0x03ce,
274  0x14 => 0x02f3, 0x15 => 0x034e, 0x16 => 0x02fa, 0x17 => 0x02f9,
275  0x18 => 0x023b, 0x19 => 0x02a5, 0x1a => 0x02fb, 0x1b => 0x02f8,
276  0x1c => 0x02f7, 0x1d => 0x02f2, 0x1e => 0x01ee, 0x1f => 0x0228,
277  0x20 => 0x0219, 0x21 => 0x0241, 0x22 => 0x02b4, 0x23 => 0x0312,
278  0x24 => 0x0314, 0x25 => 0x0314, 0x26 => 0x0316, 0x27 => 0x0319,
279  0x28 => 0x031a, 0x29 => 0x0330, 0x2a => 0x0337, 0x2b => 0x0315,
280  0x2c => 0x0349, 0x2d => 0x0337, 0x2e => 0x0341, 0x2f => 0x0330,
281  0x30 => 0x033f, 0x31 => 0x039b, 0x32 => 0x02e8, 0x33 => 0x02d3,
282  0x34 => 0x02ed, 0x35 => 0x0316, 0x36 => 0x0318, 0x37 => 0x02b7,
283  0x38 => 0x0308, 0x39 => 0x0300, 0x3a => 0x0318, 0x3b => 0x02f7,
284  0x3c => 0x02c3, 0x3d => 0x02c4, 0x3e => 0x02aa, 0x3f => 0x02bd,
285  0x40 => 0x033a, 0x41 => 0x032f, 0x42 => 0x0315, 0x43 => 0x0315,
286  0x44 => 0x02c3, 0x45 => 0x02af, 0x46 => 0x02b8, 0x47 => 0x02b1,
287  0x48 => 0x0312, 0x49 => 0x0313, 0x4a => 0x02c9, 0x4b => 0x0317,
288  0x4c => 0x0311, 0x4d => 0x0317, 0x4e => 0x0369, 0x4f => 0x02f9,
289  0x50 => 0x02fa, 0x51 => 0x02fa, 0x52 => 0x02f7, 0x53 => 0x02f7,
290  0x54 => 0x037c, 0x55 => 0x037c, 0x56 => 0x0314, 0x57 => 0x0310,
291  0x58 => 0x01b6, 0x59 => 0x8a, 0x5a => 0x0115, 0x5b => 0x019f,
292  0x5c => 0x0188, 0x5d => 0x0188, 0x5e => 0x029c, 0x5f => 0x029c,
293  0x60 => 0x0186, 0x61 => 0x0186, 0x62 => 0x013d, 0x63 => 0x013d,
294  0x64 => 0x0114, 0x65 => 0x0114, 0x66 => 0x01fd, 0x67 => 0x01fd,
295  0x68 => 0x019a, 0x69 => 0x019a, 0x6a => 0xea, 0x6b => 0xea,
296  0x6c => 0x014e, 0x6d => 0x014e, 0x6e => 0x02dc, 0x6f => 0x0220,
297  0x70 => 0x0220, 0x71 => 0x038e, 0x72 => 0x029b, 0x73 => 0x02f8,
298  0x74 => 0x02f8, 0x75 => 0x0308, 0x76 => 0x0253, 0x77 => 0x02b6,
299  0x78 => 0x0272, 0x79 => 0x0314, 0x7a => 0x0314, 0x7b => 0x0314,
300  0x7c => 0x0314, 0x7d => 0x0314, 0x7e => 0x0314, 0x7f => 0x0314,
301  0x80 => 0x0314, 0x81 => 0x0314, 0x82 => 0x0314, 0x83 => 0x0314,
302  0x84 => 0x0314, 0x85 => 0x0314, 0x86 => 0x0314, 0x87 => 0x0314,
303  0x88 => 0x0314, 0x89 => 0x0314, 0x8a => 0x0314, 0x8b => 0x0314,
304  0x8c => 0x0314, 0x8d => 0x0314, 0x8e => 0x0314, 0x8f => 0x0314,
305  0x90 => 0x0314, 0x91 => 0x0314, 0x92 => 0x0314, 0x93 => 0x0314,
306  0x94 => 0x0314, 0x95 => 0x0314, 0x96 => 0x0314, 0x97 => 0x0314,
307  0x98 => 0x0314, 0x99 => 0x0314, 0x9a => 0x0314, 0x9b => 0x0314,
308  0x9c => 0x0314, 0x9d => 0x0314, 0x9e => 0x0314, 0x9f => 0x0314,
309  0xa0 => 0x0314, 0xa1 => 0x037e, 0xa2 => 0x0346, 0xa3 => 0x03f8,
310  0xa4 => 0x01ca, 0xa5 => 0x02ec, 0xa6 => 0x039c, 0xa7 => 0x02ec,
311  0xa8 => 0x0396, 0xa9 => 0x039f, 0xaa => 0x03a0, 0xab => 0x03a0,
312  0xac => 0x0342, 0xad => 0x0369, 0xae => 0x033c, 0xaf => 0x039c,
313  0xb0 => 0x039c, 0xb1 => 0x0395, 0xb2 => 0x03a2, 0xb3 => 0x03a3,
314  0xb4 => 0x01cf, 0xb5 => 0x0373, 0xb6 => 0x0344, 0xb7 => 0x0344,
315  0xb8 => 0x0363, 0xb9 => 0x0363, 0xba => 0x02b8, 0xbb => 0x02b8,
316  0xbc => 0x036a, 0xbd => 0x036a, 0xbe => 0x02f8, 0xbf => 0x03b2,
317  0xc0 => 0x0303, 0xc1 => 0x0361, 0xc2 => 0x0303, 0xc3 => 0x0378,
318  0xc4 => 0x03c7, 0xc5 => 0x0378, 0xc6 => 0x033f, 0xc7 => 0x0369,
319  0xc8 => 0x039f, 0xc9 => 0x03ca, 0xca => 0x0396);
320 
321  /* The cmap table is similarly synthesized.
322  */
323  $cmapData = array(
324  0x20 => 0x01, 0x2701 => 0x02, 0x2702 => 0x03, 0x2703 => 0x04,
325  0x2704 => 0x05, 0x260e => 0x06, 0x2706 => 0x07, 0x2707 => 0x08,
326  0x2708 => 0x09, 0x2709 => 0x0a, 0x261b => 0x0b, 0x261e => 0x0c,
327  0x270c => 0x0d, 0x270d => 0x0e, 0x270e => 0x0f, 0x270f => 0x10,
328  0x2710 => 0x11, 0x2711 => 0x12, 0x2712 => 0x13, 0x2713 => 0x14,
329  0x2714 => 0x15, 0x2715 => 0x16, 0x2716 => 0x17, 0x2717 => 0x18,
330  0x2718 => 0x19, 0x2719 => 0x1a, 0x271a => 0x1b, 0x271b => 0x1c,
331  0x271c => 0x1d, 0x271d => 0x1e, 0x271e => 0x1f, 0x271f => 0x20,
332  0x2720 => 0x21, 0x2721 => 0x22, 0x2722 => 0x23, 0x2723 => 0x24,
333  0x2724 => 0x25, 0x2725 => 0x26, 0x2726 => 0x27, 0x2727 => 0x28,
334  0x2605 => 0x29, 0x2729 => 0x2a, 0x272a => 0x2b, 0x272b => 0x2c,
335  0x272c => 0x2d, 0x272d => 0x2e, 0x272e => 0x2f, 0x272f => 0x30,
336  0x2730 => 0x31, 0x2731 => 0x32, 0x2732 => 0x33, 0x2733 => 0x34,
337  0x2734 => 0x35, 0x2735 => 0x36, 0x2736 => 0x37, 0x2737 => 0x38,
338  0x2738 => 0x39, 0x2739 => 0x3a, 0x273a => 0x3b, 0x273b => 0x3c,
339  0x273c => 0x3d, 0x273d => 0x3e, 0x273e => 0x3f, 0x273f => 0x40,
340  0x2740 => 0x41, 0x2741 => 0x42, 0x2742 => 0x43, 0x2743 => 0x44,
341  0x2744 => 0x45, 0x2745 => 0x46, 0x2746 => 0x47, 0x2747 => 0x48,
342  0x2748 => 0x49, 0x2749 => 0x4a, 0x274a => 0x4b, 0x274b => 0x4c,
343  0x25cf => 0x4d, 0x274d => 0x4e, 0x25a0 => 0x4f, 0x274f => 0x50,
344  0x2750 => 0x51, 0x2751 => 0x52, 0x2752 => 0x53, 0x25b2 => 0x54,
345  0x25bc => 0x55, 0x25c6 => 0x56, 0x2756 => 0x57, 0x25d7 => 0x58,
346  0x2758 => 0x59, 0x2759 => 0x5a, 0x275a => 0x5b, 0x275b => 0x5c,
347  0x275c => 0x5d, 0x275d => 0x5e, 0x275e => 0x5f, 0x2768 => 0x60,
348  0x2769 => 0x61, 0x276a => 0x62, 0x276b => 0x63, 0x276c => 0x64,
349  0x276d => 0x65, 0x276e => 0x66, 0x276f => 0x67, 0x2770 => 0x68,
350  0x2771 => 0x69, 0x2772 => 0x6a, 0x2773 => 0x6b, 0x2774 => 0x6c,
351  0x2775 => 0x6d, 0x2761 => 0x6e, 0x2762 => 0x6f, 0x2763 => 0x70,
352  0x2764 => 0x71, 0x2765 => 0x72, 0x2766 => 0x73, 0x2767 => 0x74,
353  0x2663 => 0x75, 0x2666 => 0x76, 0x2665 => 0x77, 0x2660 => 0x78,
354  0x2460 => 0x79, 0x2461 => 0x7a, 0x2462 => 0x7b, 0x2463 => 0x7c,
355  0x2464 => 0x7d, 0x2465 => 0x7e, 0x2466 => 0x7f, 0x2467 => 0x80,
356  0x2468 => 0x81, 0x2469 => 0x82, 0x2776 => 0x83, 0x2777 => 0x84,
357  0x2778 => 0x85, 0x2779 => 0x86, 0x277a => 0x87, 0x277b => 0x88,
358  0x277c => 0x89, 0x277d => 0x8a, 0x277e => 0x8b, 0x277f => 0x8c,
359  0x2780 => 0x8d, 0x2781 => 0x8e, 0x2782 => 0x8f, 0x2783 => 0x90,
360  0x2784 => 0x91, 0x2785 => 0x92, 0x2786 => 0x93, 0x2787 => 0x94,
361  0x2788 => 0x95, 0x2789 => 0x96, 0x278a => 0x97, 0x278b => 0x98,
362  0x278c => 0x99, 0x278d => 0x9a, 0x278e => 0x9b, 0x278f => 0x9c,
363  0x2790 => 0x9d, 0x2791 => 0x9e, 0x2792 => 0x9f, 0x2793 => 0xa0,
364  0x2794 => 0xa1, 0x2192 => 0xa2, 0x2194 => 0xa3, 0x2195 => 0xa4,
365  0x2798 => 0xa5, 0x2799 => 0xa6, 0x279a => 0xa7, 0x279b => 0xa8,
366  0x279c => 0xa9, 0x279d => 0xaa, 0x279e => 0xab, 0x279f => 0xac,
367  0x27a0 => 0xad, 0x27a1 => 0xae, 0x27a2 => 0xaf, 0x27a3 => 0xb0,
368  0x27a4 => 0xb1, 0x27a5 => 0xb2, 0x27a6 => 0xb3, 0x27a7 => 0xb4,
369  0x27a8 => 0xb5, 0x27a9 => 0xb6, 0x27aa => 0xb7, 0x27ab => 0xb8,
370  0x27ac => 0xb9, 0x27ad => 0xba, 0x27ae => 0xbb, 0x27af => 0xbc,
371  0x27b1 => 0xbd, 0x27b2 => 0xbe, 0x27b3 => 0xbf, 0x27b4 => 0xc0,
372  0x27b5 => 0xc1, 0x27b6 => 0xc2, 0x27b7 => 0xc3, 0x27b8 => 0xc4,
373  0x27b9 => 0xc5, 0x27ba => 0xc6, 0x27bb => 0xc7, 0x27bc => 0xc8,
374  0x27bd => 0xc9, 0x27be => 0xca);
375  #require_once 'Zend/Pdf/Cmap.php';
376  $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
378 
379 
380  /* Resource dictionary */
381 
382  /* The resource dictionary for the standard fonts is sparse because PDF
383  * viewers already have all of the metrics data. We only need to provide
384  * the font name and encoding method.
385  */
386  $this->_resource->BaseFont = new Zend_Pdf_Element_Name('ZapfDingbats');
387 
388  /* This font has a built-in custom character encoding method. Don't
389  * override with WinAnsi like the other built-in fonts or else it will
390  * not work as expected.
391  */
392  $this->_resource->Encoding = null;
393  }
const NAME_FULL
Definition: Font.php:213
const NAME_VERSION
Definition: Font.php:218
const TYPE_BYTE_ENCODING_STATIC
Definition: Cmap.php:99
const NAME_COPYRIGHT
Definition: Font.php:192
const NAME_STYLE
Definition: Font.php:202
static cmapWithTypeData($cmapType, $cmapData)
Definition: Cmap.php:145
const NAME_POSTSCRIPT
Definition: Font.php:224
const NAME_ID
Definition: Font.php:207
const NAME_FAMILY
Definition: Font.php:197

Member Function Documentation

◆ decodeString()

decodeString (   $string,
  $charEncoding 
)

Convert string encoding from font encoding to local encoding. Overridden to defeat the conversion behavior for this ornamental font.

Parameters
string$string
string$charEncodingCharacter encoding of resulting text.
Returns
string

Definition at line 443 of file ZapfDingbats.php.

444  {
445  $decodedString = '';
446  for ($i = 0; $i < strlen($string); $i++) {
447  $characterCode = ord($string[$i]);
448  if (isset($this->_fromFontEncoding[$characterCode])) {
449  $decodedString .= $this->_fromFontEncoding[$characterCode];
450  } else {
451  /* For now, mimic the behavior in Zend_Pdf_Font::encodeString()
452  * where unknown characters are removed completely. This is not
453  * perfect, but we should be consistent. In a future revision,
454  * we will use the Unicode substitution character (U+FFFD).
455  */
456  }
457  }
458  if ($charEncoding != 'UTF-16BE') {
459  $decodedString = iconv('UTF-16BE', $charEncoding, $decodedString);
460  }
461  return $decodedString;
462  }
$i
Definition: gallery.phtml:31

◆ encodeString()

encodeString (   $string,
  $charEncoding 
)

Convert string encoding from local encoding to font encoding. Overridden to defeat the conversion behavior for this ornamental font.

Parameters
string$string
string$charEncodingCharacter encoding of source text.
Returns
string
Todo:
Properly handle characters encoded as surrogate pairs.

Definition at line 406 of file ZapfDingbats.php.

407  {
408  /* This isn't the optimal time to perform this conversion, but it must
409  * live here until the remainder of the layout code is completed. This,
410  * and the $charEncoding parameter, will go away soon...
411  */
412  if ($charEncoding != 'UTF-16BE') {
413  $string = iconv($charEncoding, 'UTF-16BE', $string);
414  }
418  $encodedString = '';
419  for ($i = 0; $i < strlen($string); $i++) {
420  $characterCode = (ord($string[$i++]) << 8) | ord($string[$i]);
421  if (isset($this->_toFontEncoding[$characterCode])) {
422  $encodedString .= $this->_toFontEncoding[$characterCode];
423  } else {
424  /* For now, mimic the behavior in Zend_Pdf_Font::encodeString()
425  * where unknown characters are removed completely. This is not
426  * perfect, but we should be consistent. In a future revision,
427  * we will use the well-known substitution character 0x1a
428  * (Control-Z).
429  */
430  }
431  }
432  return $encodedString;
433  }
$i
Definition: gallery.phtml:31

◆ toUnicode()

toUnicode (   $string,
  $charEncoding = '' 
)

Converts a Latin-encoded string that fakes the font's internal encoding to the proper Unicode characters, in UTF-16BE encoding.

Used to maintain backwards compatibility with the 20 year-old legacy method of using this font, which is still employed by recent versions of some popular word processors.

Note that using this method adds overhead due to the additional character conversion. Don't use this for new code; it is more efficient to use the appropriate Unicode characters directly.

Parameters
string$string
string$charEncoding(optional) Character encoding of source string. Defaults to current locale.
Returns
string

Definition at line 481 of file ZapfDingbats.php.

482  {
483  /* When using these faked strings, the closest match to the font's
484  * internal encoding is ISO-8859-1.
485  */
486  if ($charEncoding != 'ISO-8859-1') {
487  $string = iconv($charEncoding, 'ISO-8859-1', $string);
488  }
489  return $this->decodeString($string, 'UTF-16BE');
490  }

Field Documentation

◆ $_fromFontEncoding

$_fromFontEncoding
protected

Definition at line 117 of file ZapfDingbats.php.

◆ $_toFontEncoding

$_toFontEncoding
protected

Definition at line 59 of file ZapfDingbats.php.


The documentation for this class was generated from the following file: