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.svggen;
20:
21: import java.awt.Color;
22: import java.awt.Font;
23: import java.awt.Graphics2D;
24: import java.awt.RenderingHints;
25:
26: /**
27: * This test validates the convertion of Java 2D GlyphVectors
28: * SVG Shapes.
29: *
30: * @author <a href="mailto:cjolif@ilog.fr">Christophe Jolif</a>
31: * @author <a href="mailto:vhardy@eng.sun.com">Vincent Hardy</a>
32: * @version $Id: GVector.java 475477 2006-11-15 22:44:28Z cam $
33: */
34: public class GVector implements Painter {
35: public void paint(Graphics2D g) {
36: g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
37: RenderingHints.VALUE_ANTIALIAS_ON);
38:
39: // Set default font
40: Font font = new Font("Arial", Font.BOLD, 15);
41: g.setFont(font);
42:
43: // Colors used for labels and test output
44: Color labelColor = new Color(0x666699);
45: g.setPaint(labelColor);
46:
47: // Simple String
48: String text = "This is a GlyphVector";
49:
50: // Get GlyphVector from from
51: java.awt.font.GlyphVector gv = font.createGlyphVector(g
52: .getFontRenderContext(), text);
53:
54: g.drawGlyphVector(gv, 30, 30);
55: }
56: }
|