aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org')
-rw-r--r--src/java/org/apache/fop/pdf/PDFName.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFName.java b/src/java/org/apache/fop/pdf/PDFName.java
index 8628a90a7..8214cda76 100644
--- a/src/java/org/apache/fop/pdf/PDFName.java
+++ b/src/java/org/apache/fop/pdf/PDFName.java
@@ -49,10 +49,12 @@ public class PDFName extends PDFObject {
*/
static String escapeName(String name) {
StringBuffer sb = new StringBuffer(Math.min(16, name.length() + 4));
- if (!name.startsWith("/")) {
- sb.append('/');
+ boolean skipFirst = false;
+ sb.append('/');
+ if (name.startsWith("/")) {
+ skipFirst = true;
}
- for (int i = 0, c = name.length(); i < c; i++) {
+ for (int i = (skipFirst ? 1 : 0), c = name.length(); i < c; i++) {
char ch = name.charAt(i);
if (ch < 33 || ch > 126 || ch == 0x2F) {
sb.append('#');