KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > css > engine > FontFaceRule


1 /*
2
3    Copyright 2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    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 package org.apache.batik.css.engine;
19
20 import org.apache.batik.util.ParsedURL;
21
22 /**
23  * This class represents a @font-face CSS rule.
24  *
25  * This mostly exists to give us a place to store the
26  * URI to be used for 'src' URI resolution.
27  *
28  * @author <a HREF="mailto:deweese@apache.org">l449433</a>
29  * @version $Id: FontFaceRule.java,v 1.5 2005/03/27 08:58:31 cam Exp $
30  */

31 public class FontFaceRule implements Rule {
32     /**
33      * The type constant.
34      */

35     public final static short TYPE = (short)3;
36
37     StyleMap sm;
38     ParsedURL purl;
39     public FontFaceRule(StyleMap sm, ParsedURL purl) {
40         this.sm = sm;
41         this.purl = purl;
42     }
43     
44     /**
45      * Returns a constant identifying the rule type.
46      */

47     public short getType() { return TYPE; }
48
49     /**
50      * Returns the URI of the @font-face rule.
51      */

52     public ParsedURL getURL() {
53         return purl;
54     }
55
56     /**
57      * Returns the StyleMap from the @font-face rule.
58      */

59     public StyleMap getStyleMap() {
60         return sm;
61     }
62
63     /**
64      * Returns a printable representation of this rule.
65      */

66     public String JavaDoc toString(CSSEngine eng) {
67         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
68         sb.append("@font-face { ");
69         sb.append(sm.toString(eng));
70         sb.append(" }\n");
71         return sb.toString();
72     }
73 }
74
Popular Tags