فهرست منبع

[ZF-9055]TYPO when throwing exception in Zend_Pdf_Resource_Font_Extracted methods encodeString() and decodeString()

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20866 44c647ce-9c0f-0410-b52a-842ac1e357ba
yoshida@zend.co.jp 16 سال پیش
والد
کامیت
3513a756ef
1فایلهای تغییر یافته به همراه17 افزوده شده و 10 حذف شده
  1. 17 10
      library/Zend/Pdf/Resource/Font/Extracted.php

+ 17 - 10
library/Zend/Pdf/Resource/Font/Extracted.php

@@ -21,7 +21,7 @@
  */
 
 
-/** Zend_Pdf_Resource_Font */
+/** @see Zend_Pdf_Resource_Font */
 require_once 'Zend/Pdf/Resource/Font.php';
 
 /**
@@ -38,6 +38,13 @@ require_once 'Zend/Pdf/Resource/Font.php';
 class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
 {
     /**
+     * Messages
+     */
+    const TYPE_NOT_SUPPORTED = 'Unsupported font type.';
+    const ENCODING_NOT_SUPPORTED  = 'Font encoding is not supported';
+    const OPERATION_NOT_SUPPORTED = 'Operation is not supported for extracted fonts';
+
+    /**
      * Extracted font encoding
      *
      * Only 'Identity-H' and 'WinAnsiEncoding' encodings are supported now
@@ -70,7 +77,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
                 if (count($fontDictionary->DescendantFonts->items) != 1) {
                     // Multiple descendant fonts are not supported
                     require_once 'Zend/Pdf/Exception.php';
-                    throw new Zend_Pdf_Exception('Unsupported font type.');
+                    throw new Zend_Pdf_Exception(self::TYPE_NOT_SUPPORTED);
                 }
 
                 $fontDictionaryIterator = $fontDictionary->DescendantFonts->items->getIterator();
@@ -109,7 +116,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
 
             default:
                 require_once 'Zend/Pdf/Exception.php';
-                throw new Zend_Pdf_Exception('Unsupported font type.');
+                throw new Zend_Pdf_Exception(self::TYPE_NOT_SUPPORTED);
         }
 
         $this->_fontNames[Zend_Pdf_Font::NAME_POSTSCRIPT]['en'] = iconv('UTF-8', 'UTF-16BE', $fontDictionary->BaseFont->value);
@@ -141,7 +148,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
     public function glyphNumbersForCharacters($characterCodes)
     {
         require_once 'Zend/Pdf/Exception.php';
-        throw new Zend_Pdf_Exception('Operation is not supported for extracted fonts');
+        throw new Zend_Pdf_Exception(self::OPERATION_NOT_SUPPORTED);
     }
 
     /**
@@ -159,7 +166,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
     public function glyphNumberForCharacter($characterCode)
     {
         require_once 'Zend/Pdf/Exception.php';
-        throw new Zend_Pdf_Exception('Operation is not supported for extracted fonts');
+        throw new Zend_Pdf_Exception(self::OPERATION_NOT_SUPPORTED);
     }
 
     /**
@@ -183,7 +190,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
     public function getCoveredPercentage($string, $charEncoding = '')
     {
         require_once 'Zend/Pdf/Exception.php';
-        throw new Zend_Pdf_Exception('Operation is not supported for extracted fonts');
+        throw new Zend_Pdf_Exception(self::OPERATION_NOT_SUPPORTED);
     }
 
     /**
@@ -201,7 +208,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
     public function widthsForGlyphs($glyphNumbers)
     {
         require_once 'Zend/Pdf/Exception.php';
-        throw new Zend_Pdf_Exception('Operation is not supported for extracted fonts');
+        throw new Zend_Pdf_Exception(self::OPERATION_NOT_SUPPORTED);
     }
 
     /**
@@ -216,7 +223,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
     public function widthForGlyph($glyphNumber)
     {
         require_once 'Zend/Pdf/Exception.php';
-        throw new Zend_Pdf_Exception('Operation is not supported for extracted fonts');
+        throw new Zend_Pdf_Exception(self::OPERATION_NOT_SUPPORTED);
     }
 
     /**
@@ -239,7 +246,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
         }
 
         require_once 'Zend/Pdf/Exception.php';
-        throw new Zend_Pdf_Exception('Fonf encoding is not supported');
+        throw new Zend_Pdf_Exception(self::ENCODING_NOT_SUPPORTED);
     }
 
     /**
@@ -262,6 +269,6 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
         }
 
         require_once 'Zend/Pdf/Exception.php';
-        throw new Zend_Pdf_Exception('Fonf encoding is not supported');
+        throw new Zend_Pdf_Exception(self::ENCODING_NOT_SUPPORTED);
     }
 }