Sfoglia il codice sorgente

[GENERIC] Zend_Barcode:
- fix incorrect width of UPC-E objects
- fix width of figures in documentation

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20091 44c647ce-9c0f-0410-b52a-842ac1e357ba

mikaelkael 16 anni fa
parent
commit
e456bf056c

BIN
documentation/manual/en/figures/zend.barcode.objects.details.upce.png


+ 10 - 10
documentation/manual/en/module_specs/Zend_Barcode-Objects_Details.xml

@@ -149,7 +149,7 @@
         <title>Zend_Barcode_Object_Ean2</title>
 
         <para>
-            <inlinegraphic width="101" align="center" valign="middle"
+            <inlinegraphic width="41" align="center" valign="middle"
                 fileref="figures/zend.barcode.objects.details.ean2.png" format="PNG"/>
         </para>
 
@@ -202,7 +202,7 @@
         <title>Zend_Barcode_Object_Ean5</title>
 
         <para>
-            <inlinegraphic width="101" align="center" valign="middle"
+            <inlinegraphic width="68" align="center" valign="middle"
                 fileref="figures/zend.barcode.objects.details.ean5.png" format="PNG"/>
         </para>
 
@@ -255,7 +255,7 @@
         <title>Zend_Barcode_Object_Ean8</title>
 
         <para>
-            <inlinegraphic width="101" align="center" valign="middle"
+            <inlinegraphic width="82" align="center" valign="middle"
                 fileref="figures/zend.barcode.objects.details.ean8.png" format="PNG"/>
         </para>
 
@@ -308,7 +308,7 @@
         <title>Zend_Barcode_Object_Ean13</title>
 
         <para>
-            <inlinegraphic width="101" align="center" valign="middle"
+            <inlinegraphic width="113" align="center" valign="middle"
                 fileref="figures/zend.barcode.objects.details.ean13.png" format="PNG"/>
         </para>
 
@@ -402,7 +402,7 @@
         <title>Zend_Barcode_Object_Identcode</title>
 
         <para>
-            <inlinegraphic width="155" align="center" valign="middle"
+            <inlinegraphic width="137" align="center" valign="middle"
                 fileref="figures/zend.barcode.objects.details.identcode.png" format="PNG"/>
         </para>
 
@@ -561,7 +561,7 @@
         <title>Zend_Barcode_Object_Planet</title>
 
         <para>
-            <inlinegraphic width="155" align="center" valign="middle"
+            <inlinegraphic width="286" align="center" valign="middle"
                 fileref="figures/zend.barcode.objects.details.planet.png" format="PNG"/>
         </para>
 
@@ -600,7 +600,7 @@
         <title>Zend_Barcode_Object_Postnet</title>
 
         <para>
-            <inlinegraphic width="155" align="center" valign="middle"
+            <inlinegraphic width="286" align="center" valign="middle"
                 fileref="figures/zend.barcode.objects.details.postnet.png" format="PNG"/>
         </para>
 
@@ -639,7 +639,7 @@
         <title>Zend_Barcode_Object_Royalmail</title>
 
         <para>
-            <inlinegraphic width="155" align="center" valign="middle"
+            <inlinegraphic width="158" align="center" valign="middle"
                 fileref="figures/zend.barcode.objects.details.royalmail.png" format="PNG"/>
         </para>
 
@@ -679,7 +679,7 @@
         <title>Zend_Barcode_Object_Upca</title>
 
         <para>
-            <inlinegraphic width="155" align="center" valign="middle"
+            <inlinegraphic width="115" align="center" valign="middle"
                 fileref="figures/zend.barcode.objects.details.upca.png" format="PNG"/>
         </para>
 
@@ -732,7 +732,7 @@
         <title>Zend_Barcode_Object_Upce</title>
 
         <para>
-            <inlinegraphic width="155" align="center" valign="middle"
+            <inlinegraphic width="71" align="center" valign="middle"
                 fileref="figures/zend.barcode.objects.details.upce.png" format="PNG"/>
         </para>
 

+ 3 - 4
library/Zend/Barcode/Object/Upce.php

@@ -97,10 +97,9 @@ class Zend_Barcode_Object_Upce extends Zend_Barcode_Object_Ean13
     {
         $quietZone       = $this->getQuietZone();
         $startCharacter  = (3 * $this->_barThinWidth) * $this->_factor;
-        $middleCharacter = (5 * $this->_barThinWidth) * $this->_factor;
-        $stopCharacter   = (3 * $this->_barThinWidth) * $this->_factor;
-        $encodedData     = (7 * $this->_barThinWidth) * $this->_factor * 12;
-        return $quietZone + $startCharacter + $middleCharacter + $encodedData + $stopCharacter + $quietZone;
+        $stopCharacter   = (6 * $this->_barThinWidth) * $this->_factor;
+        $encodedData     = (7 * $this->_barThinWidth) * $this->_factor * 6;
+        return $quietZone + $startCharacter + $encodedData + $stopCharacter + $quietZone;
     }
 
     /**

+ 1 - 1
tests/Zend/Barcode/Object/UpceTest.php

@@ -122,7 +122,7 @@ class Zend_Barcode_Object_UpceTest extends Zend_Barcode_Object_TestCommon
     public function testGetKnownWidthWithoutOrientation()
     {
         $this->_object->setText('1234567');
-        $this->assertEquals(115, $this->_object->getWidth());
+        $this->assertEquals(71, $this->_object->getWidth());
     }
 
     public function testCompleteGeneration()

+ 12 - 12
tests/Zend/Barcode/Object/_files/Upce_1234567_border_instructions.php

@@ -18,12 +18,12 @@ array (
       ),
       2 => 
       array (
-        0 => 116,
+        0 => 72,
         1 => 65,
       ),
       3 => 
       array (
-        0 => 116,
+        0 => 72,
         1 => 0,
       ),
     ),
@@ -738,12 +738,12 @@ array (
       ),
       1 => 
       array (
-        0 => 116,
+        0 => 72,
         1 => 0,
       ),
       2 => 
       array (
-        0 => 116,
+        0 => 72,
         1 => 65,
       ),
       3 => 
@@ -770,7 +770,7 @@ array (
       0 => 3,
       1 => 61,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -785,7 +785,7 @@ array (
       0 => 13,
       1 => 63,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -800,7 +800,7 @@ array (
       0 => 20,
       1 => 63,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -815,7 +815,7 @@ array (
       0 => 27,
       1 => 63,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -830,7 +830,7 @@ array (
       0 => 34,
       1 => 63,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -845,7 +845,7 @@ array (
       0 => 41,
       1 => 63,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -860,7 +860,7 @@ array (
       0 => 48,
       1 => 63,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -875,7 +875,7 @@ array (
       0 => 60,
       1 => 61,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,

+ 16 - 16
tests/Zend/Barcode/Object/_files/Upce_1234567_border_oriented_instructions.php

@@ -18,13 +18,13 @@ array (
       ),
       2 => 
       array (
-        0 => 55,
-        1 => 132,
+        0 => 33,
+        1 => 94,
       ),
       3 => 
       array (
-        0 => 111,
-        1 => 100,
+        0 => 89,
+        1 => 62,
       ),
     ),
     'color' => 16777215,
@@ -738,13 +738,13 @@ array (
       ),
       1 => 
       array (
-        0 => 111,
-        1 => 100,
+        0 => 89,
+        1 => 62,
       ),
       2 => 
       array (
-        0 => 55,
-        1 => 132,
+        0 => 33,
+        1 => 94,
       ),
       3 => 
       array (
@@ -770,7 +770,7 @@ array (
       0 => 2,
       1 => 33,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -785,7 +785,7 @@ array (
       0 => 5,
       1 => 42,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -800,7 +800,7 @@ array (
       0 => 9,
       1 => 48,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -815,7 +815,7 @@ array (
       0 => 12,
       1 => 54,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -830,7 +830,7 @@ array (
       0 => 16,
       1 => 60,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -845,7 +845,7 @@ array (
       0 => 19,
       1 => 67,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -860,7 +860,7 @@ array (
       0 => 23,
       1 => 73,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -875,7 +875,7 @@ array (
       0 => 30,
       1 => 82,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,

+ 10 - 10
tests/Zend/Barcode/Object/_files/Upce_1234567_instructions.php

@@ -18,12 +18,12 @@ array (
       ),
       2 => 
       array (
-        0 => 114,
+        0 => 70,
         1 => 61,
       ),
       3 => 
       array (
-        0 => 114,
+        0 => 70,
         1 => 0,
       ),
     ),
@@ -736,7 +736,7 @@ array (
       0 => 3,
       1 => 59,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -751,7 +751,7 @@ array (
       0 => 13,
       1 => 61,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -766,7 +766,7 @@ array (
       0 => 20,
       1 => 61,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -781,7 +781,7 @@ array (
       0 => 27,
       1 => 61,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -796,7 +796,7 @@ array (
       0 => 34,
       1 => 61,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -811,7 +811,7 @@ array (
       0 => 41,
       1 => 61,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -826,7 +826,7 @@ array (
       0 => 48,
       1 => 61,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,
@@ -841,7 +841,7 @@ array (
       0 => 60,
       1 => 59,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => 0,

+ 12 - 12
tests/Zend/Barcode/Object/_files/Upce_1234567_oriented_instructions.php

@@ -18,13 +18,13 @@ array (
       ),
       2 => 
       array (
-        0 => 57,
-        1 => 129,
+        0 => 35,
+        1 => 91,
       ),
       3 => 
       array (
-        0 => 110,
-        1 => 98,
+        0 => 88,
+        1 => 60,
       ),
     ),
     'color' => 16777215,
@@ -736,7 +736,7 @@ array (
       0 => 4,
       1 => 32,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -751,7 +751,7 @@ array (
       0 => 7,
       1 => 41,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -766,7 +766,7 @@ array (
       0 => 10,
       1 => 47,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -781,7 +781,7 @@ array (
       0 => 14,
       1 => 53,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -796,7 +796,7 @@ array (
       0 => 17,
       1 => 59,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -811,7 +811,7 @@ array (
       0 => 21,
       1 => 66,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -826,7 +826,7 @@ array (
       0 => 24,
       1 => 72,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,
@@ -841,7 +841,7 @@ array (
       0 => 32,
       1 => 81,
     ),
-    'font' => NULL,
+    'font' => '',
     'color' => 0,
     'alignment' => 'left',
     'orientation' => -60,