DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2378
Version: 1.3.0





Link: http://www.fltk.org/str.php?L2378
Version: 1.3.0
Index: src/Fl_PostScript.cxx
===================================================================
--- src/Fl_PostScript.cxx       (revision 7653)
+++ src/Fl_PostScript.cxx       (working copy)
@@ -351,23 +351,59 @@
 "end\n"
 "IDD image GR} bind def\n"
 
-// procedure to modify a font to use ISOLatin1 encoding (iso-8859-1)
-// and to keep its name unchanged
-"/ToLatin1 { dup findfont dup length dict "
-"begin {def} forall /Encoding ISOLatin1Encoding def currentdict end definefont 
pop } def\n"
-// modify all fonts to use ISOLatin1 encoding
-"/Helvetica ToLatin1 "
-"/Helvetica-Bold ToLatin1 "
-"/Helvetica-Oblique ToLatin1 "
-"/Helvetica-BoldOblique ToLatin1 \n"
-"/Courier ToLatin1 "
-"/Courier-Bold ToLatin1 "
-"/Courier-Oblique ToLatin1 "
-"/Courier-BoldOblique ToLatin1 \n"
-"/Times ToLatin1 "
-"/Times-Bold ToLatin1 "
-"/Times-Italic ToLatin1 "
-"/Times-BoldItalic ToLatin1 \n"
+// define LatinExtA, the encoding of Latin-extended-A + Euro at 0x80
+"ISOLatin1Encoding 16#180 array dup /LatinExtA exch def copy pop\n"
+// set default code values to questiondown
+"16#100 1 16#17F {LatinExtA exch /questiondown put} for \n"
+"[\n"
+" [16#80 /Euro] "
+" [16#100 /Amacron] [16#101 /amacron] [16#102 /Abreve] [16#103 /abreve] 
[16#104 /Aogonek] [16#105 /aogonek] \n"
+" [16#106 /Cacute] [16#107 /cacute] [16#10C /Ccaron] [16#10D /ccaron] \n"
+" [16#10E /Dcaron] [16#10F /dcaron]  [16#110 /Dcroat] [16#111 /dcroat]\n"
+" [16#112 /Emacron] [16#113 /emacron] [16#116 /Edotaccent]"
+" [16#117 /edotaccent] [16#118 /Eogonek] [16#119 /eogonek] [16#11A /Ecaron] 
[16#11B /ecaron]\n"
+" [16#11E /Gbreve] [16#11F /gbreve] [16#122 /Gcommaaccent] [16#123 
/gcommaaccent] "
+" [16#12A /Imacron] [16#12B /imacron] [16#12E /Iogonek] [16#12F /iogonek] 
[16#130 /Idotaccent] [16#136 /Kcommaaccent]\n"
+" [16#136 /Kcommaaccent] [16#137 /kcommaaccent]"
+" [16#139 /Lacute] [16#13A /lacute] [16#13B /Lcommaaccent] [16#13C 
/lcommaaccent] "
+" [16#13D /Lcaron] [16#13E /lcaron] [16#141 /Lslash] [16#142 /lslash] \n"
+" [16#143 /Nacute] [16#144 /nacute] [16#145 /Ncommaaccent] [16#146 
/ncommaaccent] [16#147 /Ncaron] [16#148 /ncaron]"
+" [16#14C /Omacron] [16#14D /omacron] [16#150 /Ohungarumlaut] [16#151 
/ohungarumlaut] [16#152 /OE] [16#153 /oe] \n"
+" [16#154 /Racute] [16#155 /racute] [16#156 /Rcommaaccent] [16#157 
/rcommaaccent] [16#158 /Rcaron] [16#159 /rcaron]"
+" [16#15A /Sacute] [16#15B /sacute] [16#15E /Scedilla] [16#15F /scedilla] \n"
+" [16#160 /Scaron] [16#161 /scaron] \n"
+" [16#162 /Tcommaaccent] [16#163 /tcommaaccent] [16#164 /Tcaron] [16#165 
/tcaron] \n"
+" [16#16A /Umacron] [16#16B /umacron] [16#16E /Uring] [16#16F /uring] "
+" [16#170 /Uhungarumlaut] [16#171 /uhungarumlaut] [16#172 /Uogonek] [16#173 
/uogonek]"
+" [16#178 /Ydieresis]\n"
+" [16#179 /Zacute] [16#17A /zacute] [16#17B /Zdotaccent] [16#17C /zdotaccent] 
[16#17D /Zcaron] [16#17E /zcaron] \n"
+"]  {LatinExtA exch aload pop put} forall\n"
+// proc that gives LatinExtA encoding to a font
+"/ToLatinExtA { dup findfont dup length dict copy begin /Encoding LatinExtA 
def currentdict end definefont pop } def\n"
+// modify standard fonts in place so they use LatinExtA encoding\n"
+"/Helvetica ToLatinExtA /Helvetica-Bold ToLatinExtA /Helvetica-Oblique 
ToLatinExtA /Helvetica-BoldOblique ToLatinExtA \n"
+"/Courier ToLatinExtA /Courier-Bold ToLatinExtA /Courier-Oblique ToLatinExtA 
/Courier-BoldOblique ToLatinExtA \n"
+"/Times-Roman ToLatinExtA /Times-Bold ToLatinExtA /Times-Italic ToLatinExtA 
/Times-BoldItalic ToLatinExtA\n"
+// proc to create a Type 0 font with 2-byte encoding and LatinExtA encoding
+"/To2byte { 6 dict begin /FontType 0 def \n"
+"/FDepVector exch findfont 1 array astore def \n"
+"/FontMatrix [1  0  0  1  0  0] def /FMapType 6 def /Encoding [ 0 0 ] def\n"
+"/SubsVector < 01 0180 > def\n"
+"currentdict end definefont pop } def\n"
+// create 2-byte versions of standard fonts
+"/Helvetica2B /Helvetica To2byte\n"
+"/Helvetica-Bold2B /Helvetica-Bold To2byte\n"
+"/Helvetica-Oblique2B /Helvetica-Oblique To2byte\n"
+"/Helvetica-BoldOblique2B /Helvetica-BoldOblique To2byte\n"
+"/Times-Roman2B /Times-Roman To2byte\n"
+"/Times-Italic2B /Times-Italic To2byte\n"
+"/Times-BoldItalic2B /Times-BoldItalic To2byte\n"
+"/Times-Bold2B /Times-Bold To2byte\n"
+"/Courier2B /Courier To2byte\n"
+"/Courier-Oblique2B /Courier-Oblique To2byte\n"
+"/Courier-Bold2B /Courier-Bold To2byte\n"
+"/Courier-BoldOblique2B /Courier-BoldOblique To2byte\n"
+
 ;
 
 static const char * prolog_2_pixmap =  // prolog relevant only if lang_level 
== 2 for pixmaps
@@ -887,21 +923,21 @@
 };
 
 static const char *_fontNames[] = {
-"Helvetica",
-"Helvetica-Bold",
-"Helvetica-Oblique",
-"Helvetica-BoldOblique",
-"Courier",
-"Courier-Bold",
-"Courier-Oblique",
-"Courier-BoldOblique",
-"Times",
-"Times-Bold",
-"Times-Italic",
-"Times-BoldItalic",
+"Helvetica2B",
+"Helvetica-Bold2B",
+"Helvetica-Oblique2B",
+"Helvetica-BoldOblique2B",
+"Courier2B",
+"Courier-Bold2B",
+"Courier-Oblique2B",
+"Courier-BoldOblique2B",
+"Times2B",
+"Times-Bold2B",
+"Times-Italic2B",
+"Times-BoldItalic2B",
 "Symbol",
-"Courier",
-"Courier-Bold",
+"Courier2B",
+"Courier-Bold2B",
 "ZapfDingbats"
 };
 
@@ -953,28 +989,27 @@
   fprintf(output, "GR\n");
 }
 
-// outputs in PostScript a UTF8 string replacing non-Latin1 characters by ?
+// outputs in PostScript a UTF8 string replacing non-Latin1-extended-A 
characters by questiondown
 // and using the same width in points as on display
 void Fl_PostScript_Graphics_Driver::transformed_draw(const char* str, int n, 
double x, double y) {
   int len;
   if (!n || !str || !*str) return;
   const char *last = str + n;
   // compute display width of string
-  fprintf(output,"%g (", fl_width(str, n));
+  fprintf(output,"%g <", fl_width(str, n));
   while (str < last) {
     // Extract each unicode character of string.
-    // Until 0xFF, UTF codes coincide with iso-Latin1 (iso-8859-1)
     unsigned utf = fl_utf8decode(str, last, &len);
     str += len;
-    if (utf > 0xFF) {
-      utf = '?'; // replace non Latin-1 unicodes by ?
-      }
-    else if (utf == '(' || utf == ')' || utf == '\\') {
-      putc('\\' , output); // these chars need be escaped
-     }
-    putc(utf, output); // output the latin character
+    if (utf == 0x20AC /* Euro */) {
+       utf = 0x80; // recode it within the font encoding range
+       }
+    else if (utf > 0x17F) {
+      utf = 0xBF; // replace non Latin-Extended-A unicodes by questiondown
+    }
+    fprintf(output, "%4.4X", utf);
   }
-  fprintf(output, ") %g %g show_pos_width\n", x, y);
+  fprintf(output, "> %g %g show_pos_width\n", x, y);
 }
 
 struct matrix {double a, b, c, d, x, y;};
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to