KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > fo > properties > FontShorthandParser


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: FontShorthandParser.java 454018 2006-10-07 21:00:13Z pietsch $ */
19
20 package org.apache.fop.fo.properties;
21
22 import org.apache.fop.fo.Constants;
23 import org.apache.fop.fo.FObj;
24 import org.apache.fop.fo.FOPropertyMapping;
25 import org.apache.fop.fo.PropertyList;
26 import org.apache.fop.fo.expr.PropertyException;
27
28 /**
29  * A shorthand parser for the font shorthand property
30  */

31 public class FontShorthandParser extends GenericShorthandParser {
32
33     /**
34      * @see org.apache.fop.fo.properties.ShorthandParser#getValueForProperty(int, Property, PropertyMaker, PropertyList)
35      */

36     public Property getValueForProperty(int propId,
37                                                Property property,
38                                                PropertyMaker maker,
39                                                PropertyList propertyList)
40                     throws PropertyException {
41         
42         int index = -1;
43         Property newProp;
44         switch (propId) {
45         case Constants.PR_FONT_SIZE:
46             index = 0;
47             break;
48         case Constants.PR_FONT_FAMILY:
49             index = 1;
50             break;
51         case Constants.PR_LINE_HEIGHT:
52             index = 2;
53             break;
54         case Constants.PR_FONT_STYLE:
55             index = 3;
56             break;
57         case Constants.PR_FONT_VARIANT:
58             index = 4;
59             break;
60         case Constants.PR_FONT_WEIGHT:
61             index = 5;
62             break;
63         default:
64             //nop
65
}
66         newProp = (Property) property.getList().get(index);
67         return newProp;
68     }
69 }
70
Popular Tags