1/*
2 * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package sun.java2d.loops;
27
28import java.awt.Font;
29
30import sun.font.Font2D;
31import sun.font.FontStrike;
32
33/*
34 * A FontInfo object holds all calculated or derived data needed
35 * to handle rendering operations based on a particular set of
36 * Graphics2D rendering attributes.
37 * Note that this does not use a Font2DHandle, and also has a reference
38 * to the strike which also references the Font2D.
39 * So presently, until SG2D objects no longer reference this FontInfo,
40 * there is still some potential for a bad Font2D to be used for a short
41 * time. I am reluctant to add the overhead of that machinery here without
42 * a proven benefit.
43 */
44public class FontInfo implements Cloneable {
45    public Font font;
46    public Font2D font2D;
47    public FontStrike fontStrike;
48    public double[] devTx;
49    public double[] glyphTx;
50    public int pixelHeight;
51    public float originX;
52    public float originY;
53    public int aaHint;
54    public boolean lcdRGBOrder;
55    /* lcdSubPixPos is used if FM is ON for HRGB/HBGR LCD text mode */
56    public boolean lcdSubPixPos;
57
58    public String mtx(double[] matrix) {
59        return ("["+
60                matrix[0]+", "+
61                matrix[1]+", "+
62                matrix[2]+", "+
63                matrix[3]+
64                "]");
65    }
66
67    public Object clone() {
68        try {
69            return super.clone();
70        } catch (CloneNotSupportedException e) {
71            return null;
72        }
73    }
74
75    public String toString() {
76        return ("FontInfo["+
77                "font="+font+", "+
78                "devTx="+mtx(devTx)+", "+
79                "glyphTx="+mtx(glyphTx)+", "+
80                "pixelHeight="+pixelHeight+", "+
81                "origin=("+originX+","+originY+"), "+
82                "aaHint="+aaHint+", "+
83                "lcdRGBOrder="+(lcdRGBOrder ? "RGB" : "BGR")+
84                "lcdSubPixPos="+lcdSubPixPos+
85                "]");
86    }
87}
88