01: /*
02:
03: Licensed to the Apache Software Foundation (ASF) under one or more
04: contributor license agreements. See the NOTICE file distributed with
05: this work for additional information regarding copyright ownership.
06: The ASF licenses this file to You under the Apache License, Version 2.0
07: (the "License"); you may not use this file except in compliance with
08: the License. You may obtain a copy of the License at
09:
10: http://www.apache.org/licenses/LICENSE-2.0
11:
12: Unless required by applicable law or agreed to in writing, software
13: distributed under the License is distributed on an "AS IS" BASIS,
14: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: See the License for the specific language governing permissions and
16: limitations under the License.
17:
18: */
19: package org.apache.batik.css.engine;
20:
21: import org.apache.batik.util.ParsedURL;
22:
23: /**
24: * This class represents a @font-face CSS rule.
25: *
26: * This mostly exists to give us a place to store the
27: * URI to be used for 'src' URI resolution.
28: *
29: * @author <a href="mailto:deweese@apache.org">l449433</a>
30: * @version $Id: FontFaceRule.java 478160 2006-11-22 13:35:06Z dvholten $
31: */
32: public class FontFaceRule implements Rule {
33: /**
34: * The type constant.
35: */
36: public static final short TYPE = (short) 3;
37:
38: StyleMap sm;
39: ParsedURL purl;
40:
41: public FontFaceRule(StyleMap sm, ParsedURL purl) {
42: this .sm = sm;
43: this .purl = purl;
44: }
45:
46: /**
47: * Returns a constant identifying the rule type.
48: */
49: public short getType() {
50: return TYPE;
51: }
52:
53: /**
54: * Returns the URI of the @font-face rule.
55: */
56: public ParsedURL getURL() {
57: return purl;
58: }
59:
60: /**
61: * Returns the StyleMap from the @font-face rule.
62: */
63: public StyleMap getStyleMap() {
64: return sm;
65: }
66:
67: /**
68: * Returns a printable representation of this rule.
69: */
70: public String toString(CSSEngine eng) {
71: StringBuffer sb = new StringBuffer();
72: sb.append("@font-face { ");
73: sb.append(sm.toString(eng));
74: sb.append(" }\n");
75: return sb.toString();
76: }
77: }
|