You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by to...@apache.org on 2001/08/02 21:40:56 UTC
cvs commit: xml-fop/src/org/apache/fop/pdf PDFOutline.java
tore 01/08/02 12:40:56
Modified: src/org/apache/fop/pdf PDFOutline.java
Log:
Submitted by: SASAKI Suguru (s-sasaki@hkg.odn.ne.jp)
Adds support for unicode characters in bookmarks.
Revision Changes Path
1.3 +11 -15 xml-fop/src/org/apache/fop/pdf/PDFOutline.java
Index: PDFOutline.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFOutline.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PDFOutline.java 2001/07/30 20:29:30 1.2
+++ PDFOutline.java 2001/08/02 19:40:56 1.3
@@ -1,5 +1,5 @@
/*
- * $Id: PDFOutline.java,v 1.2 2001/07/30 20:29:30 tore Exp $
+ * $Id: PDFOutline.java,v 1.3 2001/08/02 19:40:56 tore Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -147,28 +147,24 @@
}
/**
- * escape parens, and other special chars for PDF
+ * escape string (see 3.8.1 in PDF reference 2nd edition)
*/
private String escapeString(String s) {
StringBuffer result = new StringBuffer();
if (s != null) {
int l = s.length();
+ // byte order marker (0xfeff)
+ result.append("\\376\\377");
+
for (int i = 0; i < l; i++) {
char ch = s.charAt(i);
- if (ch > 127) {
- result.append("\\");
- result.append(Integer.toOctalString((int)ch));
- } else {
- switch (ch) {
- case '(':
- case ')':
- case '\\':
- result.append('\\');
- break;
- }
- result.append(ch);
- }
+ int high = (ch & 0xff00) >>> 8;
+ int low = ch & 0xff;
+ result.append("\\");
+ result.append(Integer.toOctalString(high));
+ result.append("\\");
+ result.append(Integer.toOctalString(low));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org