Skip to content

Commit 1c7930e

Browse files
committed
PDFBOX-6108: add Colorant and Font types
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1930227 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5826428 commit 1c7930e

File tree

4 files changed

+141
-3
lines changed

4 files changed

+141
-3
lines changed

xmpbox/src/main/java/org/apache/xmpbox/schema/XMPPageTextSchema.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ public class XMPPageTextSchema extends XMPSchema
4949
@PropertyType(type = Types.Text, card = Cardinality.Seq)
5050
public static final String PLATENAMES = "PlateNames"; // Ordered array of Text
5151

52-
// missing:
53-
// Colorants / Ordered array of Colorants / Cardinality.Seq
54-
// Fonts / Unordered array of Fonts / Cardinality.Bag
52+
// An ordered array of colorants (swatches) that are used in the document
53+
@PropertyType(type = Types.Colorant, card = Cardinality.Seq)
54+
public static final String COLORANTS = "Colorants"; // Ordered array of Colorants
55+
56+
// An unordered array of fonts that are used in the document
57+
@PropertyType(type = Types.Font, card = Cardinality.Bag)
58+
public static final String FONTS = "Fonts"; // Unordered array of Fonts
5559

5660
public XMPPageTextSchema(XMPMetadata metadata)
5761
{
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*****************************************************************************
2+
*
3+
* Licensed to the Apache Software Foundation (ASF) under one
4+
* or more contributor license agreements. See the NOTICE file
5+
* distributed with this work for additional information
6+
* regarding copyright ownership. The ASF licenses this file
7+
* to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance
9+
* with the License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing,
14+
* software distributed under the License is distributed on an
15+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
* KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations
18+
* under the License.
19+
*
20+
****************************************************************************/
21+
package org.apache.xmpbox.type;
22+
23+
import org.apache.xmpbox.XMPMetadata;
24+
25+
/**
26+
*/
27+
@StructuredType(preferedPrefix = "xmpG",namespace = "http://ns.adobe.com/xap/1.0/g/")
28+
public class ColorantType extends AbstractStructuredType
29+
{
30+
31+
@PropertyType(type = Types.Integer)
32+
public static final String A = "A";
33+
34+
@PropertyType(type = Types.Integer)
35+
public static final String B = "B";
36+
37+
@PropertyType(type = Types.Real)
38+
public static final String L = "L";
39+
40+
@PropertyType(type = Types.Real)
41+
public static final String BLACK = "black";
42+
43+
@PropertyType(type = Types.Real)
44+
public static final String CYAN = "cyan";
45+
46+
@PropertyType(type = Types.Real)
47+
public static final String MAGENTA = "magenta";
48+
49+
@PropertyType(type = Types.Real)
50+
public static final String YELLOW = "yellow";
51+
52+
@PropertyType(type = Types.Integer)
53+
public static final String BLUE = "blue";
54+
55+
@PropertyType(type = Types.Integer)
56+
public static final String GREEN = "green";
57+
58+
@PropertyType(type = Types.Integer)
59+
public static final String RED = "red";
60+
61+
@PropertyType(type = Types.Choice, card = Cardinality.Simple)
62+
public static final String MODE = "mode";
63+
64+
@PropertyType(type = Types.Text)
65+
public static final String SWATCH_NAME = "swatchName";
66+
67+
@PropertyType(type = Types.Choice, card = Cardinality.Simple)
68+
public static final String TYPE = "type";
69+
70+
public ColorantType(XMPMetadata metadata)
71+
{
72+
super(metadata);
73+
}
74+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*****************************************************************************
2+
*
3+
* Licensed to the Apache Software Foundation (ASF) under one
4+
* or more contributor license agreements. See the NOTICE file
5+
* distributed with this work for additional information
6+
* regarding copyright ownership. The ASF licenses this file
7+
* to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance
9+
* with the License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing,
14+
* software distributed under the License is distributed on an
15+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
* KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations
18+
* under the License.
19+
*
20+
****************************************************************************/
21+
package org.apache.xmpbox.type;
22+
23+
import org.apache.xmpbox.XMPMetadata;
24+
25+
/**
26+
*/
27+
@StructuredType(preferedPrefix = "stFnt",namespace = "http://ns.adobe.com/xap/1.0/sType/Font#")
28+
public class FontType extends AbstractStructuredType
29+
{
30+
31+
@PropertyType(type = Types.Text, card = Cardinality.Seq)
32+
public static final String CHILD_FONT_FILES = "childFontFiles";
33+
34+
@PropertyType(type = Types.Boolean)
35+
public static final String COMPOSITE = "composite";
36+
37+
@PropertyType(type = Types.Text)
38+
public static final String FONT_FACE = "fontFace";
39+
40+
@PropertyType(type = Types.Text)
41+
public static final String FONT_FAMILY = "fontFamily";
42+
43+
@PropertyType(type = Types.Text)
44+
public static final String FONT_FILE_NAME = "fontFileName";
45+
46+
@PropertyType(type = Types.Text)
47+
public static final String FONT_NAME = "fontName";
48+
49+
@PropertyType(type = Types.Choice, card = Cardinality.Simple)
50+
public static final String FONT_TYPE = "fontType";
51+
52+
@PropertyType(type = Types.Text)
53+
public static final String VERSION_STRING = "versionString";
54+
55+
public FontType(XMPMetadata metadata)
56+
{
57+
super(metadata);
58+
}
59+
}

xmpbox/src/main/java/org/apache/xmpbox/type/Types.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public enum Types
3535
Text, PartType.class), URL(true, Text, URLType.class), URI(true, Text, URIType.class), Choice(true, Text,
3636
ChoiceType.class), MIMEType(true, Text, MIMEType.class), LangAlt(true, Text, TextType.class), RenditionClass(
3737
true, Text, RenditionClassType.class), Rational(true,Text,RationalType.class),
38+
Colorant(false,Structured,ColorantType.class), Font(false,Structured,FontType.class),
3839

3940
Layer(false, Structured, LayerType.class), Thumbnail(false, Structured, ThumbnailType.class), ResourceEvent(false,
4041
Structured, ResourceEventType.class), ResourceRef(false, Structured, ResourceRefType.class), Version(false,

0 commit comments

Comments
 (0)