--- org/tigris/gef/persistence/PostscriptWriter.java.orig 2005-09-10 10:25:48.000000000 +0900 +++ org/tigris/gef/persistence/PostscriptWriter.java 2005-09-10 11:19:00.000000000 +0900 @@ -99,9 +99,9 @@ public PostscriptWriter(OutputStream stream, Rectangle bb) throws IOException { - fontmap.put("Dialog", "Helvetica"); - fontmap.put("SansSerif", "Helvetica"); - fontmap.put("DialogInput", "Monospaced"); + fontmap.put("Dialog", "GothicBBB-Medium-RKSJ-H"); + fontmap.put("SansSerif", "GothicBBB-Medium-RKSJ-H"); + fontmap.put("DialogInput", "GothicBBB-Medium-RKSJ-H"); p = new PrintWriter(new OutputStreamWriter(stream, "ISO8859-1")); if (bb == null) { p.println("%!PS-Adobe-3.0"); @@ -117,7 +117,7 @@ p.print(isolatin1encoding); p.println("%%EndSetup"); p.println("1 setlinewidth"); - setFont(new Font("Helvetica", Font.PLAIN, 12)); + setFont(new Font("GothicBBB-Medium-RKSJ-H", Font.PLAIN, 12)); setColor(Color.black); if (bb != null) { translate(0, bb.height + 2 * bb.y); @@ -189,8 +189,7 @@ name += "Oblique"; } - p.println("isolatin1encoding /_" + name + " /" + name + " RE"); - p.println("/_" + name + " findfont"); + p.println("/" + name + " findfont"); p.println(font.getSize() + " scalefont setfont"); } } @@ -484,18 +483,32 @@ } public void drawString(String text, int x, int y) { - StringBuffer buf = new StringBuffer(text); + StringBuffer buf = new StringBuffer(); + byte bytetext[]; int c; String code; - for (int i = 0; i < buf.length(); ++i) { - c = (int) buf.charAt(i); - if (c >= 192 && c < 256) { - buf.setCharAt(i, '\\'); + try{ + bytetext=text.getBytes("Shift_JIS"); + } + catch(UnsupportedEncodingException e){ + bytetext=text.getBytes(); + } + + for (int i = 0; i < bytetext.length; ++i) { + c = (int)bytetext[i]; + if (c < 32 || c >= 127) { + // + // non-ascii char + // + if(c<0) + c+=256; code = Integer.toOctalString(c); - buf.insert(i + 1, code); - i += code.length(); - } else if (c == '\\' || c == '(' || c == ')') { - buf.insert(i++, '\\'); + buf.append('\\').append(code); + } + else{ + if (c == '\\' || c == '(' || c == ')') + buf.append('\\'); + buf.append(new String(bytetext,i,1)); } } writeCoords(x, y);