aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/pdf/PDFCIDSystemInfo.java
blob: bd42fc8be4b02e9f12c888e881950b139dce4427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * $Id$
 * 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.
 */

package org.apache.fop.pdf;

// based on work by Takayuki Takeuchi

/**
 * class representing system information for "character identifier" fonts.
 *
 * this small object is used in the CID fonts and in the CMaps.
 */
public class PDFCIDSystemInfo extends PDFObject {
    protected String registry;
    protected String ordering;
    protected int supplement;

    public PDFCIDSystemInfo(String registry, String ordering,
                            int supplement) {
        this.registry = registry;
        this.ordering = ordering;
        this.supplement = supplement;
    }

    /**
     * produce the PDF representation for the object.
     *
     * unlike the other objects, the CIDSystemInfo is written directly inside
     * the referencing object
     *
     * @return the PDF
     */
    public byte[] toPDF() {
        return toPDFString().getBytes();
    }

    public String toPDFString() {
        StringBuffer p = new StringBuffer();
        p.setLength(0);
        p.append("/CIDSystemInfo << /Registry (");
        p.append(registry);
        p.append(")/Ordering (");
        p.append(ordering);
        p.append(")/Supplement ");
        p.append(supplement);
        p.append(" >>");
        return p.toString();
    }

}