1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /* $Id$ */
19 
20 package org.apache.fop.render.pcl.fonts;
21 
22 public class PCLFontSegment {
23     private SegmentID identifier;
24     private byte[] data;
25 
PCLFontSegment(SegmentID identifier, byte[] data)26     public PCLFontSegment(SegmentID identifier, byte[] data) {
27         this.identifier = identifier;
28         this.data = data;
29     }
30 
getData()31     public byte[] getData() {
32         return data;
33     }
34 
getIdentifier()35     public SegmentID getIdentifier() {
36         return identifier;
37     }
38 
getSize()39     public int getSize() {
40         return (identifier == SegmentID.NULL) ? 0 : data.length;
41     }
42 
43     public enum SegmentID {
44         CC(17219), // Character Complement
45         CP(17232), // Copyright
46         GT(18260), // Global TrueType Data
47         IF(18758), // Intellifont Face Data
48         PA(20545), // PANOSE Description
49         XW(22619), // XWindows Font Name
50         NULL(65535); // Null Segment
51 
52         private int complementID;
53 
SegmentID(int complementID)54         SegmentID(int complementID) {
55             this.complementID = complementID;
56         }
57 
getValue()58         public int getValue() {
59             return complementID;
60         }
61     }
62 }
63