[gs-commits] rev 12278 - in trunk/ghostpdl: pcl pl

henrys at ghostscript.com henrys at ghostscript.com
Fri Mar 11 07:10:56 UTC 2011


Author: henrys
Date: 2011-03-11 07:10:56 +0000 (Fri, 11 Mar 2011)
New Revision: 12278

Modified:
   trunk/ghostpdl/pcl/pcparse.c
   trunk/ghostpdl/pcl/pcstate.h
   trunk/ghostpdl/pcl/pctext.c
   trunk/ghostpdl/pcl/pctpm.h
   trunk/ghostpdl/pl/pllfont.c
   trunk/ghostpdl/pl/plsymbol.c
Log:
Code to support Cyrillic, Greek, Arabic, Baltic symbol sets, see the
reference bug #690706 for details.  Thanks to Josef Hinteregger for
writing and testing the code to support the new sets.



Modified: trunk/ghostpdl/pcl/pcparse.c
===================================================================
--- trunk/ghostpdl/pcl/pcparse.c	2011-03-11 05:45:19 UTC (rev 12277)
+++ trunk/ghostpdl/pcl/pcparse.c	2011-03-11 07:10:56 UTC (rev 12278)
@@ -234,6 +234,7 @@
 {	const byte *p = pr->ptr;
 	const byte *rlimit = pr->limit;
 	int code = 0;
+	int bytelen = 0;
 	bool in_macro = pcs->defining_macro;
 	/* Record how much of the input we've copied into a macro */
 	/* in the process of being defined. */
@@ -427,18 +428,22 @@
 			      goto x;
 			  }
 			chr = *++p;
-			/* check for double byte scanning */
-			if ( pcl_char_is_2_byte(chr, pcs->text_parsing_method ) ) {
-			    /* we need to have at least 2 bytes - check if we need more data */
-			    if ( p >= rlimit ) {
+			/* check for multi-byte scanning */
+			bytelen = pcl_char_bytelen( chr, pcs->text_parsing_method );
+			if ( bytelen == 0 ) {
+			    bytelen = 1;	/* invalid utf-8 leading char */
+			}
+			if ( bytelen > 1 ) {
+			    /* check if we need more data */
+			    if ( (p + bytelen - 1) > rlimit ) {
 				--p;
 				goto x;
 			    }
 			    if_debug2('i', "%x%x\n", p[0], p[1]);
-			    code = pcl_text(p, 2, pcs, false);
+			    code = pcl_text(p, bytelen, pcs, false);
 			    if ( code < 0 ) goto x;
-			    /* now pass over the second byte */
-			    p++;
+			    /* now pass over the remaining bytes */
+			    p += (bytelen - 1);
 			    cdefn = NULL;
 			} else if ( chr != ESC )
 			  {	if_debug1('i',

Modified: trunk/ghostpdl/pcl/pcstate.h
===================================================================
--- trunk/ghostpdl/pcl/pcstate.h	2011-03-11 05:45:19 UTC (rev 12277)
+++ trunk/ghostpdl/pcl/pcstate.h	2011-03-11 07:10:56 UTC (rev 12278)
@@ -177,7 +177,7 @@
     bool            underline_floating;
     float           underline_position;	/* distance from baseline */
 
-    const pcl_text_parsing_method_t *   text_parsing_method;
+    pcl_text_parsing_method_t    text_parsing_method;
 
     int             text_path;		/* 0, 1, -1 */
 

Modified: trunk/ghostpdl/pcl/pctext.c
===================================================================
--- trunk/ghostpdl/pcl/pctext.c	2011-03-11 05:45:19 UTC (rev 12277)
+++ trunk/ghostpdl/pcl/pctext.c	2011-03-11 07:10:56 UTC (rev 12278)
@@ -37,12 +37,6 @@
 #include "gxfont.h"             /* for setting next_char proc */
 #include "gxstate.h"
 
-/* Define the text parsing methods. */
-static const pcl_text_parsing_method_t pcl_tpm_0 = pcl_tpm_0_data,
-                                        pcl_tpm_21 = pcl_tpm_21_data,
-                                        pcl_tpm_31 = pcl_tpm_31_data,
-                                        pcl_tpm_38 = pcl_tpm_38_data;
-
 /* pseudo-"dots" (actually 1/300" units) used in underline only */
 #define dots(n)     ((float)(7200 / 300 * n))
 
@@ -226,12 +220,12 @@
         return 2;
     *pis_space = false;
     *unstyled_substitution = false;
-    chr = *pb++;
-    len--;
-    if (pcl_char_is_2_byte(chr, pcs->text_parsing_method) && (len > 0)) {
-        chr = (chr << 8) + *pb++;
-        len--;
+    chr = pcl_char_get_char(pcs->text_parsing_method, &pb, len);
+    /* invalid char: pb has not been incremented */
+    if (pb == *ppb) {
+        pb++;
     }
+    len -= (pb - *ppb);
     *ppb = pb;
     *plen = len;
     *porig_char = chr;
@@ -318,8 +312,164 @@
     *pchr = 0xffff;
     return 0;
 }
+/* 
+ * return length of multibyte sequence from starting byte 
+ * replacement of macro pcl_char_is_2_byte, UTF-8 sequence length may be up to 6 bytes
+ *
+ * Returns 0 for invalid byte, byte length > 0 of multibyte character sequence 
+ */
+int
+pcl_char_bytelen(byte ch, pcl_text_parsing_method_t tpm)
+{
 
+    int bytelen = 1;
+
+	switch(tpm) {
+	default:
+		/* byte length defaults to 1 */
+		break;
+
+	case tpm_21_DBCS7:
+		/* 0x21-0xff are double-byte */
+		bytelen = (ch < 0x21) ? 1 : 2;
+		break;
+
+	case tpm_31_sjis:
+		/* 0x81-0x9f, 0xe0-0xfc are double-byte */
+		bytelen = (ch < 0x81 || (ch > 0x9f && ch < 0xe0) || ch > 0xfc) ? 1 : 2;
+		break;
+
+	case tpm_38_DBCS8:
+		/* 0x80-0xff are double-byte */
+		bytelen = (ch < 0x80) ? 1 : 2;
+		break;
+        case tpm_83_utf8:
+        case tpm_1008_utf8:
+	    if (ch < 0x80) {
+		/* 0xxxxxxx */
+	        bytelen = 1;
+		break;
+	    }
+	    if (ch < 0xc2) {
+	        bytelen = 0;	/* illegal */
+		break;
+	    }
+	    if (ch < 0xe0) {
+		/* 110XXXXx 10xxxxxx */
+	        bytelen = 2;
+		break;
+	    }
+	    if (ch < 0xf0) {
+	        /* 1110XXXX 10Xxxxxx 10xxxxxx */
+	        bytelen = 3;
+		break;
+	    }
+	    if (ch < 0xf8) {
+		/* 11110XXX 10XXxxxx 10xxxxxx 10xxxxxx */
+	        bytelen = 4;
+		break;
+	    }
+	    if (ch < 0xfc) {
+		/* 111110XX 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
+	        bytelen = 5;
+		break;
+	    }
+	    if (ch < 0xfe) {
+		/* 1111110X 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
+	        bytelen = 6;
+		break;
+	    }
+	    bytelen = 0;	/* illegal */
+	    break;
+	}
+	return bytelen;
+}
 /*
+ * convert multibyte sequence to unicode (16-bit)
+ * Both the string pointer and the length are modified.
+ *
+ * Returns 0 for invalid byte, byte length > 0 of multibyte character sequence 
+ */
+gs_char
+pcl_char_get_char(pcl_text_parsing_method_t tpm, const byte ** psrc, int src_len)
+/* src_len minimum 1 */
+{
+    gs_char chr;
+    const byte * src = *psrc;
+    int bytelen = pcl_char_bytelen(src[0], tpm);
+    if (bytelen == 0 || bytelen > src_len)
+    {
+        return INVALID_UC;
+    }
+    switch(tpm) {
+    default:
+        chr = src[0];
+	break;
+
+    case tpm_21_DBCS7:
+	/* 0x21-0xff are double-byte */
+	chr = (src[0] < 0x21) ? src[0] : (src[0] << 8 | src[1]);
+	break;
+
+    case tpm_31_sjis:
+	/* 0x81-0x9f, 0xe0-0xfc are double-byte */
+	chr = (src[0] < 0x81 || (src[0] > 0x9f && src[0] < 0xe0) || src[0] > 0xfc) ? src[0] : (src[0] << 8 | src[1]);
+	break;
+
+    case tpm_38_DBCS8:
+	/* 0x80-0xff are double-byte */
+	chr = (src[0] < 0x80) ? src[0] : (src[0] << 8 | src[1]);
+	break;
+    case tpm_83_utf8:
+    case tpm_1008_utf8:
+	if (src[0] < 0x80) {
+	    /* 0xxxxxxx */
+	    chr = src[0];
+	    break;
+	}
+	if (src[0] < 0xc2) {
+            chr = INVALID_UC;
+	    break;
+	}
+	if (src[0] < 0xe0) {
+	    /* 110XXXXx 10xxxxxx */
+	    chr = (src[0] & 0x1f);
+	    chr = (chr << 6) | (src[1] & 0x3f);
+	    break;
+	}
+	if (src[0] < 0xf0) {
+	    /* 1110XXXX 10Xxxxxx 10xxxxxx */
+	    chr = (src[0] & 0x0f);
+	    chr = (chr << 6) | (src[1] & 0x3f);
+	    chr = (chr << 6) | (src[2] & 0x3f);
+	    break;
+	}
+	if (src[0] < 0xf8) {
+	    /* 11110XXX 10XXxxxx 10xxxxxx 10xxxxxx */
+	    /* chr is 16 bit: overflow */
+            chr = INVALID_UC;
+	    break;
+	}
+	if (src[0] < 0xfc) {
+	    /* 111110XX 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
+	    /* chr is 16 bit: overflow */
+            chr = INVALID_UC;
+	    break;
+	}
+	if (src[0] < 0xfe) {
+	    /* 1111110X 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
+	    /* chr is 16 bit: overflow */
+            chr = INVALID_UC;
+	    break;
+	}
+	chr = INVALID_UC;
+	break;
+    }
+    *psrc += bytelen;
+    return chr;
+}
+
+/*
  * Draw the foreground of a character. For transparent text this is the only
  * part that must be drawn.
  */
@@ -979,21 +1129,29 @@
     switch (int_arg(pargs)) {
 
       case 0: case 1:
-        pcs->text_parsing_method = &pcl_tpm_0;
+        pcs->text_parsing_method = tpm_0_SBCS;
         break;
 
       case 21:
-        pcs->text_parsing_method = &pcl_tpm_21;
+        pcs->text_parsing_method = tpm_21_DBCS7;
         break;
 
       case 31:
-        pcs->text_parsing_method = &pcl_tpm_31;
+        pcs->text_parsing_method = tpm_31_sjis;
         break;
 
       case 38:
-        pcs->text_parsing_method = &pcl_tpm_38;
+        pcs->text_parsing_method = tpm_38_DBCS8;
         break;
 
+      case 83:
+        pcs->text_parsing_method = tpm_83_utf8;
+        break;
+
+      case 1008:
+        pcs->text_parsing_method = tpm_1008_utf8;
+        break;
+
       default:
         return e_Range;
     }
@@ -1098,7 +1256,7 @@
         pcs->underline_enabled = false;
         pcs->last_was_BS = false;
         pcs->last_width = inch2coord(1.0 / 10.0);
-        pcs->text_parsing_method = &pcl_tpm_0;
+        pcs->text_parsing_method = tpm_0_SBCS;
         pcs->text_path = 0;
     }
 }

Modified: trunk/ghostpdl/pcl/pctpm.h
===================================================================
--- trunk/ghostpdl/pcl/pctpm.h	2011-03-11 05:45:19 UTC (rev 12277)
+++ trunk/ghostpdl/pcl/pctpm.h	2011-03-11 07:10:56 UTC (rev 12278)
@@ -18,28 +18,23 @@
 
 #include "gx.h"
 
-typedef struct pcl_text_parsing_method_s {
-    byte    min1, max1;
-    byte    min2, max2;
+typedef enum  {
+/* http://lprng.sourceforge.net/DISTRIB/RESOURCES/DOCS/pcl5comp.pdf */
+    tpm_0_SBCS    = 0,
+    tpm_21_DBCS7  = 21,   /* e.g. GB_2312-80 (China), JIS_X0208-1983 (Japan), KSC_5601 (Korea) */
+    tpm_31_sjis   = 31,
+    tpm_38_DBCS8  = 38,	  
+    tpm_83_utf8   = 83,	  /* http://docs.hp.com/en/5991-7956/5991-7956.pdf */
+                          /* HP-UX 11i v3 International Printing Features  */
+    tpm_1008_utf8 = 1008  /* http://www.lexmark.com/publications/pdfs/TRef_3Q01.pdf */
 } pcl_text_parsing_method_t;
 
-#define pcl_char_is_2_byte(ch, tpm)                     \
-    ( ((ch) >= (tpm)->min1) &&                          \
-      ((ch) <= (tpm)->max2) &&                          \
-      (((ch) <= (tpm)->max1) || ((ch) >= (tpm)->min2)) )
+int pcl_char_bytelen(byte ch, pcl_text_parsing_method_t tpm);
+gs_char pcl_char_get_char(pcl_text_parsing_method_t tpm, const byte ** psrc, int len);
 
-#define pcl_tpm_is_single_byte(tpm) ((tpm)->max1 == 0)
+/*
+ *  was 0xfffd  
+ */
+#define INVALID_UC 0xffff
 
-/* Single-byte only */
-#define pcl_tpm_0_data  { 0xff, 0, 0xff, 0 }
-
-/* 0x21-0xff are double-byte */
-#define pcl_tpm_21_data { 0x21, 0xff, 0x21, 0xff }
-
-/* 0x81-0x9f, 0xe0-0xfc are double-byte */
-#define pcl_tpm_31_data { 0x81, 0x9f, 0xe0, 0xfc }
-
-/* 0x80-0xff are double-byte */
-#define pcl_tpm_38_data { 0x80, 0xff, 0x80, 0xff }
-
 #endif			/* pctpm_INCLUDED */

Modified: trunk/ghostpdl/pl/pllfont.c
===================================================================
--- trunk/ghostpdl/pl/pllfont.c	2011-03-11 05:45:19 UTC (rev 12277)
+++ trunk/ghostpdl/pl/pllfont.c	2011-03-11 07:10:56 UTC (rev 12278)
@@ -169,7 +169,7 @@
             dprintf2("%s (entry %d) not found\n", resident_table[i].full_font_name, i);
             dprintf("pxl unicode name:");
             for (j = 0;
-                 j < sizeof(resident_table[i].unicode_fontname);
+                 j < countof(resident_table[i].unicode_fontname); 
                  j++)
                 dprintf1("'%c'", resident_table[i].unicode_fontname[j]);
             dprintf("\n");

Modified: trunk/ghostpdl/pl/plsymbol.c
===================================================================
--- trunk/ghostpdl/pl/plsymbol.c	2011-03-11 05:45:19 UTC (rev 12277)
+++ trunk/ghostpdl/pl/plsymbol.c	2011-03-11 07:10:56 UTC (rev 12278)
@@ -1437,7 +1437,8 @@
 };
 
 /********************************************
- * Windows 3.1 Latin 2 (WE) Unicode mapping *
+ * Windows 3.1 Latin 2 (EE) Unicode mapping *
+ * windows-1250                             *
  ********************************************/
 static const pl_symbol_map_t map_9E_unicode = {
     map_header(9, 'E', plgv_Unicode, 2, 0, 0, 0, 0, 0xe0, 0, 0, 0, PLGV_U2M_MAPPING),
@@ -1493,6 +1494,803 @@
     }
 };
 
+
+/* NB The following 3 symbols sets need to be formatted consistently
+   with the other symbol sets. */
+
+/********************************************
+ * windows-1251 Cyrillic                    *
+ ********************************************/
+static const pl_symbol_map_t map_9R_unicode = {
+  map_header(9, 'R', plgv_Unicode, 2, 0, 0, 0, 0, 0xc0, 0, 0, 0, PLGV_U2M_MAPPING),
+  {
+      0x0000,
+      0x0001,
+      0x0002,
+      0x0003,
+      0x0004,
+      0x0005,
+      0x0006,
+      0x0007,
+      0x0008,
+      0x0009,
+      0x000a,
+      0x000b,
+      0x000c,
+      0x000d,
+      0x000e,
+      0x000f,
+      0x0010,
+      0x0011,
+      0x0012,
+      0x0013,
+      0x0014,
+      0x0015,
+      0x0016,
+      0x0017,
+      0x0018,
+      0x0019,
+      0x001a,
+      0x001b,
+      0x001c,
+      0x001d,
+      0x001e,
+      0x001f,
+      0x0020,
+      0x0021,
+      0x0022,
+      0x0023,
+      0x0024,
+      0x0025,
+      0x0026,
+      0x0027,
+      0x0028,
+      0x0029,
+      0x002a,
+      0x002b,
+      0x002c,
+      0x002d,
+      0x002e,
+      0x002f,
+      0x0030,
+      0x0031,
+      0x0032,
+      0x0033,
+      0x0034,
+      0x0035,
+      0x0036,
+      0x0037,
+      0x0038,
+      0x0039,
+      0x003a,
+      0x003b,
+      0x003c,
+      0x003d,
+      0x003e,
+      0x003f,
+      0x0040,
+      0x0041,
+      0x0042,
+      0x0043,
+      0x0044,
+      0x0045,
+      0x0046,
+      0x0047,
+      0x0048,
+      0x0049,
+      0x004a,
+      0x004b,
+      0x004c,
+      0x004d,
+      0x004e,
+      0x004f,
+      0x0050,
+      0x0051,
+      0x0052,
+      0x0053,
+      0x0054,
+      0x0055,
+      0x0056,
+      0x0057,
+      0x0058,
+      0x0059,
+      0x005a,
+      0x005b,
+      0x005c,
+      0x005d,
+      0x005e,
+      0x005f,
+      0x0060,
+      0x0061,
+      0x0062,
+      0x0063,
+      0x0064,
+      0x0065,
+      0x0066,
+      0x0067,
+      0x0068,
+      0x0069,
+      0x006a,
+      0x006b,
+      0x006c,
+      0x006d,
+      0x006e,
+      0x006f,
+      0x0070,
+      0x0071,
+      0x0072,
+      0x0073,
+      0x0074,
+      0x0075,
+      0x0076,
+      0x0077,
+      0x0078,
+      0x0079,
+      0x007a,
+      0x007b,
+      0x007c,
+      0x007d,
+      0x007e,
+      0x007f,
+      0x0402,
+      0x0403,
+      0x201a,
+      0x0453,
+      0x201e,
+      0x2026,
+      0x2020,
+      0x2021,
+      0x20ac,
+      0x2030,
+      0x0409,
+      0x2039,
+      0x040a,
+      0x040c,
+      0x040b,
+      0x040f,
+      0x0452,
+      0x2018,
+      0x2019,
+      0x201c,
+      0x201d,
+      0x2022,
+      0x2013,
+      0x2014,
+      0xffff,
+      0x2122,
+      0x0459,
+      0x203a,
+      0x045a,
+      0x045c,
+      0x045b,
+      0x045f,
+      0x00a0,
+      0x040e,
+      0x045e,
+      0x0408,
+      0x00a4,
+      0x0490,
+      0x00a6,
+      0x00a7,
+      0x0401,
+      0x00a9,
+      0x0404,
+      0x00ab,
+      0x00ac,
+      0x00ad,
+      0x00ae,
+      0x0407,
+      0x00b0,
+      0x00b1,
+      0x0406,
+      0x0456,
+      0x0491,
+      0x00b5,
+      0x00b6,
+      0x00b7,
+      0x0451,
+      0x2116,
+      0x0454,
+      0x00bb,
+      0x0458,
+      0x0405,
+      0x0455,
+      0x0457,
+      0x0410,
+      0x0411,
+      0x0412,
+      0x0413,
+      0x0414,
+      0x0415,
+      0x0416,
+      0x0417,
+      0x0418,
+      0x0419,
+      0x041a,
+      0x041b,
+      0x041c,
+      0x041d,
+      0x041e,
+      0x041f,
+      0x0420,
+      0x0421,
+      0x0422,
+      0x0423,
+      0x0424,
+      0x0425,
+      0x0426,
+      0x0427,
+      0x0428,
+      0x0429,
+      0x042a,
+      0x042b,
+      0x042c,
+      0x042d,
+      0x042e,
+      0x042f,
+      0x0430,
+      0x0431,
+      0x0432,
+      0x0433,
+      0x0434,
+      0x0435,
+      0x0436,
+      0x0437,
+      0x0438,
+      0x0439,
+      0x043a,
+      0x043b,
+      0x043c,
+      0x043d,
+      0x043e,
+      0x043f,
+      0x0440,
+      0x0441,
+      0x0442,
+      0x0443,
+      0x0444,
+      0x0445,
+      0x0446,
+      0x0447,
+      0x0448,
+      0x0449,
+      0x044a,
+      0x044b,
+      0x044c,
+      0x044d,
+      0x044e,
+      0x044f
+  }
+};
+/********************************************
+ * windows-1253 Greek                       *
+ ********************************************/
+static const pl_symbol_map_t map_9G_unicode = {
+  map_header(9, 'G', plgv_Unicode, 2, 0, 0, 0, 0, 0xc0, 0, 0, 0, PLGV_U2M_MAPPING),
+  {
+      0x0000,
+      0x0001,
+      0x0002,
+      0x0003,
+      0x0004,
+      0x0005,
+      0x0006,
+      0x0007,
+      0x0008,
+      0x0009,
+      0x000a,
+      0x000b,
+      0x000c,
+      0x000d,
+      0x000e,
+      0x000f,
+      0x0010,
+      0x0011,
+      0x0012,
+      0x0013,
+      0x0014,
+      0x0015,
+      0x0016,
+      0x0017,
+      0x0018,
+      0x0019,
+      0x001a,
+      0x001b,
+      0x001c,
+      0x001d,
+      0x001e,
+      0x001f,
+      0x0020,
+      0x0021,
+      0x0022,
+      0x0023,
+      0x0024,
+      0x0025,
+      0x0026,
+      0x0027,
+      0x0028,
+      0x0029,
+      0x002a,
+      0x002b,
+      0x002c,
+      0x002d,
+      0x002e,
+      0x002f,
+      0x0030,
+      0x0031,
+      0x0032,
+      0x0033,
+      0x0034,
+      0x0035,
+      0x0036,
+      0x0037,
+      0x0038,
+      0x0039,
+      0x003a,
+      0x003b,
+      0x003c,
+      0x003d,
+      0x003e,
+      0x003f,
+      0x0040,
+      0x0041,
+      0x0042,
+      0x0043,
+      0x0044,
+      0x0045,
+      0x0046,
+      0x0047,
+      0x0048,
+      0x0049,
+      0x004a,
+      0x004b,
+      0x004c,
+      0x004d,
+      0x004e,
+      0x004f,
+      0x0050,
+      0x0051,
+      0x0052,
+      0x0053,
+      0x0054,
+      0x0055,
+      0x0056,
+      0x0057,
+      0x0058,
+      0x0059,
+      0x005a,
+      0x005b,
+      0x005c,
+      0x005d,
+      0x005e,
+      0x005f,
+      0x0060,
+      0x0061,
+      0x0062,
+      0x0063,
+      0x0064,
+      0x0065,
+      0x0066,
+      0x0067,
+      0x0068,
+      0x0069,
+      0x006a,
+      0x006b,
+      0x006c,
+      0x006d,
+      0x006e,
+      0x006f,
+      0x0070,
+      0x0071,
+      0x0072,
+      0x0073,
+      0x0074,
+      0x0075,
+      0x0076,
+      0x0077,
+      0x0078,
+      0x0079,
+      0x007a,
+      0x007b,
+      0x007c,
+      0x007d,
+      0x007e,
+      0x007f,
+      0x20ac,
+      0xffff,
+      0x201a,
+      0x0192,
+      0x201e,
+      0x2026,
+      0x2020,
+      0x2021,
+      0xffff,
+      0x2030,
+      0xffff,
+      0x2039,
+      0xffff,
+      0xffff,
+      0xffff,
+      0xffff,
+      0xffff,
+      0x2018,
+      0x2019,
+      0x201c,
+      0x201d,
+      0x2022,
+      0x2013,
+      0x2014,
+      0xffff,
+      0x2122,
+      0xffff,
+      0x203a,
+      0xffff,
+      0xffff,
+      0xffff,
+      0xffff,
+      0x00a0,
+      0x0385,
+      0x0386,
+      0x00a3,
+      0x00a4,
+      0x00a5,
+      0x00a6,
+      0x00a7,
+      0x00a8,
+      0x00a9,
+      0xffff,
+      0x00ab,
+      0x00ac,
+      0x00ad,
+      0x00ae,
+      0x2015,
+      0x00b0,
+      0x00b1,
+      0x00b2,
+      0x00b3,
+      0x0384,
+      0x00b5,
+      0x00b6,
+      0x00b7,
+      0x0388,
+      0x0389,
+      0x038a,
+      0x00bb,
+      0x038c,
+      0x00bd,
+      0x038e,
+      0x038f,
+      0x0390,
+      0x0391,
+      0x0392,
+      0x0393,
+      0x0394,
+      0x0395,
+      0x0396,
+      0x0397,
+      0x0398,
+      0x0399,
+      0x039a,
+      0x039b,
+      0x039c,
+      0x039d,
+      0x039e,
+      0x039f,
+      0x03a0,
+      0x03a1,
+      0xffff,
+      0x03a3,
+      0x03a4,
+      0x03a5,
+      0x03a6,
+      0x03a7,
+      0x03a8,
+      0x03a9,
+      0x03aa,
+      0x03ab,
+      0x03ac,
+      0x03ad,
+      0x03ae,
+      0x03af,
+      0x03b0,
+      0x03b1,
+      0x03b2,
+      0x03b3,
+      0x03b4,
+      0x03b5,
+      0x03b6,
+      0x03b7,
+      0x03b8,
+      0x03b9,
+      0x03ba,
+      0x03bb,
+      0x03bc,
+      0x03bd,
+      0x03be,
+      0x03bf,
+      0x03c0,
+      0x03c1,
+      0x03c2,
+      0x03c3,
+      0x03c4,
+      0x03c5,
+      0x03c6,
+      0x03c7,
+      0x03c8,
+      0x03c9,
+      0x03ca,
+      0x03cb,
+      0x03cc,
+      0x03cd,
+      0x03ce,
+      0xffff 
+  }
+};
+/********************************************
+ * windows-1256 Arabic                      *
+ ********************************************/
+static const pl_symbol_map_t map_9V_unicode = {
+  map_header(9, 'V', plgv_Unicode, 2, 0, 0, 0, 0, 0xc0, 0, 0, 0, PLGV_U2M_MAPPING),
+  {
+      0x0000, 
+      0x0001,
+      0x0002,
+      0x0003,
+      0x0004,
+      0x0005,
+      0x0006,
+      0x0007,
+      0x0008,
+      0x0009,
+      0x000a,
+      0x000b,
+      0x000c,
+      0x000d,
+      0x000e,
+      0x000f,
+      0x0010,
+      0x0011,
+      0x0012,
+      0x0013,
+      0x0014,
+      0x0015,
+      0x0016,
+      0x0017,
+      0x0018,
+      0x0019,
+      0x001a,
+      0x001b,
+      0x001c,
+      0x001d,
+      0x001e,
+      0x001f,
+      0x0020,
+      0x0021,
+      0x0022,
+      0x0023,
+      0x0024,
+      0x0025,
+      0x0026,
+      0x0027,
+      0x0028,
+      0x0029,
+      0x002a,
+      0x002b,
+      0x002c,
+      0x002d,
+      0x002e,
+      0x002f,
+      0x0030,
+      0x0031,
+      0x0032,
+      0x0033,
+      0x0034,
+      0x0035,
+      0x0036,
+      0x0037,
+      0x0038,
+      0x0039,
+      0x003a,
+      0x003b,
+      0x003c,
+      0x003d,
+      0x003e,
+      0x003f,
+      0x0040,
+      0x0041,
+      0x0042,
+      0x0043,
+      0x0044,
+      0x0045,
+      0x0046,
+      0x0047,
+      0x0048,
+      0x0049,
+      0x004a,
+      0x004b,
+      0x004c,
+      0x004d,
+      0x004e,
+      0x004f,
+      0x0050,
+      0x0051,
+      0x0052,
+      0x0053,
+      0x0054,
+      0x0055,
+      0x0056,
+      0x0057,
+      0x0058,
+      0x0059,
+      0x005a,
+      0x005b,
+      0x005c,
+      0x005d,
+      0x005e,
+      0x005f,
+      0x0060,
+      0x0061,
+      0x0062,
+      0x0063,
+      0x0064,
+      0x0065,
+      0x0066,
+      0x0067,
+      0x0068,
+      0x0069,
+      0x006a,
+      0x006b,
+      0x006c,
+      0x006d,
+      0x006e,
+      0x006f,
+      0x0070,
+      0x0071,
+      0x0072,
+      0x0073,
+      0x0074,
+      0x0075,
+      0x0076,
+      0x0077,
+      0x0078,
+      0x0079,
+      0x007a,
+      0x007b,
+      0x007c,
+      0x007d,
+      0x007e,
+      0x007f,
+      0x20ac,
+      0x067e,
+      0x201a,
+      0x0192,
+      0x201e,
+      0x2026,
+      0x2020,
+      0x2021,
+      0x02c6,
+      0x2030,
+      0x0679,
+      0x2039,
+      0x0152,
+      0x0686,
+      0x0698,
+      0x0688,
+      0x06af,
+      0x2018,
+      0x2019,
+      0x201c,
+      0x201d,
+      0x2022,
+      0x2013,
+      0x2014,
+      0x06a9,
+      0x2122,
+      0x0691,
+      0x203a,
+      0x0153,
+      0x200c,
+      0x200d,
+      0x06ba,
+      0x00a0,
+      0x060c,
+      0x00a2,
+      0x00a3,
+      0x00a4,
+      0x00a5,
+      0x00a6,
+      0x00a7,
+      0x00a8,
+      0x00a9,
+      0x06be,
+      0x00ab,
+      0x00ac,
+      0x00ad,
+      0x00ae,
+      0x00af,
+      0x00b0,
+      0x00b1,
+      0x00b2,
+      0x00b3,
+      0x00b4,
+      0x00b5,
+      0x00b6,
+      0x00b7,
+      0x00b8,
+      0x00b9,
+      0x061b,
+      0x00bb,
+      0x00bc,
+      0x00bd,
+      0x00be,
+      0x061f,
+      0x06c1,
+      0x0621,
+      0x0622,
+      0x0623,
+      0x0624,
+      0x0625,
+      0x0626,
+      0x0627,
+      0x0628,
+      0x0629,
+      0x062a,
+      0x062b,
+      0x062c,
+      0x062d,
+      0x062e,
+      0x062f,
+      0x0630,
+      0x0631,
+      0x0632,
+      0x0633,
+      0x0634,
+      0x0635,
+      0x0636,
+      0x00d7,
+      0x0637,
+      0x0638,
+      0x0639,
+      0x063a,
+      0x0640,
+      0x0641,
+      0x0642,
+      0x0643,
+      0x00e0,
+      0x0644,
+      0x00e2,
+      0x0645,
+      0x0646,
+      0x0647,
+      0x0648,
+      0x00e7,
+      0x00e8,
+      0x00e9,
+      0x00ea,
+      0x00eb,
+      0x0649,
+      0x064a,
+      0x00ee,
+      0x00ef,
+      0x064b,
+      0x064c,
+      0x064d,
+      0x064e,
+      0x00f4,
+      0x064f,
+      0x0650,
+      0x00f7,
+      0x0651,
+      0x00f9,
+      0x0652,
+      0x00fb,
+      0x00fc,
+      0x200e,
+      0x200f,
+      0x06d2 
+  }
+};
+
 /*******************************************
  * ISO 8859/9 Latin 5 (E5) Unicode mapping *
  *******************************************/
@@ -2702,6 +3500,11 @@
     }
 };
 
+static const pl_symbol_map_t map_18N_unicode = {
+  map_header(18, 'N', plgv_Unicode, 2, 0, 0, 0, 0, 0, 0, 0, 0, PLGV_U2M_MAPPING),
+  { 0 }
+};
+
 /*
  * Define the list of built-in symbol maps.
  */
@@ -2754,6 +3557,10 @@
     &map_4U_unicode,
     &map_26U_unicode,
     &map_14L_unicode,
+    &map_9R_unicode,
+    &map_9G_unicode,
+    &map_9V_unicode,
+    &map_18N_unicode,
     0                 /* end marker */
 };
 
@@ -2772,6 +3579,10 @@
      * If there is no symbol map we assume the the character
      * implicitly indexes the font.  The symbol set 590 is not
      * documented it appears to do implicit mapping as well.
+     *
+     * symbol set 590/18N is for UTF-8 according to
+     * http://docs.hp.com/en/5991-7956/5991-7956.pdf
+     *
      */
 
     if (psm == 0) {
@@ -2781,6 +3592,10 @@
             return chr;
     }
 
+    if (pl_get_uint16(psm->id) == 590)	{
+        return chr;
+    }
+
     first_code = pl_get_uint16(psm->first_code);
     last_code = pl_get_uint16(psm->last_code);
     if ((chr < first_code) || (chr > last_code))



More information about the gs-commits mailing list