jdk/src/java.desktop/share/classes/sun/font/FontStrikeDesc.java
author prr
Wed, 09 Nov 2016 11:28:13 -0800
changeset 42208 7c1017f0ade5
parent 25859 3317bb8137f4
permissions -rw-r--r--
8155874: Fix java.desktop deprecation warnings about Class.newInstance Reviewed-by: serb, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.font;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.Font;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.font.FontRenderContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.geom.AffineTransform;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import static sun.awt.SunHints.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * This class encapsulates every thing needed that distinguishes a strike.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * It can be used as a key to locate a FontStrike in a Hashmap/cache.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * It is not mutatable, but contains mutatable AffineTransform objects,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * which for performance reasons it does not keep private copies of.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Therefore code constructing these must pass in transforms it guarantees
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * not to mutate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
public class FontStrikeDesc {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    /* Values to use as a mask that is used for faster comparison of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
     * two strikes using just an int equality test.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
     * The ones we don't use are listed here but commented out.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     * ie style is already built and hint "OFF" values are zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * Note that this is used as a strike key and the same strike is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * for HRGB and HBGR, so only the orientation needed (H or V) is needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * to construct and distinguish a FontStrikeDesc. The rgb ordering
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * needed for rendering is stored in the graphics state.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
//     static final int STYLE_PLAIN       = Font.PLAIN;            // 0x0000
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
//     static final int STYLE_BOLD        = Font.BOLD;             // 0x0001
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
//     static final int STYLE_ITALIC      = Font.ITALIC;           // 0x0002
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
//     static final int STYLE_BOLDITALIC  = Font.BOLD|Font.ITALIC; // 0x0003
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
//     static final int AA_OFF            = 0x0000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    static final int AA_ON             = 0x0010;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    static final int AA_LCD_H          = 0x0020;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    static final int AA_LCD_V          = 0x0040;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
//     static final int FRAC_METRICS_OFF  = 0x0000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    static final int FRAC_METRICS_ON   = 0x0100;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    static final int FRAC_METRICS_SP   = 0x0200;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /* devTx is to get an inverse transform to get user space values
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * for metrics. Its not used otherwise, as the glyphTx is the important
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * one. But it does mean that a strike representing a 6pt font and identity
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * graphics transform is not equal to one for a 12 pt font and 2x scaled
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * graphics transform. Its likely to be very rare that this causes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * duplication.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    AffineTransform devTx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    AffineTransform glyphTx; // all of ptSize, Font tx and Graphics tx.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    int style;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    int aaHint;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    int fmHint;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    private int hashCode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    private int valuemask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        /* Can cache hashcode since a strike(desc) is immutable.*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        if (hashCode == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
            hashCode = glyphTx.hashCode() + devTx.hashCode() + valuemask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        return hashCode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    public boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            FontStrikeDesc desc = (FontStrikeDesc)obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            return (desc.valuemask == this.valuemask &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                    desc.glyphTx.equals(this.glyphTx) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                    desc.devTx.equals(this.devTx));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        } catch (Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            /* class cast or NP exceptions should not happen often, if ever,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
             * and I am hoping that this is faster than an instanceof check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    FontStrikeDesc() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        // used with init
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    /* This maps a public text AA hint value into one of the subset of values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * used to index strikes. For the purpose of the strike cache there are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * only 4 values : OFF, ON, LCD_HRGB, LCD_VRGB.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * Font and ptSize are needed to resolve the 'gasp' table. The ptSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * must therefore include device and font transforms.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    public static int getAAHintIntVal(Object aa, Font2D font2D, int ptSize) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        if (aa == VALUE_TEXT_ANTIALIAS_OFF ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            aa == VALUE_TEXT_ANTIALIAS_DEFAULT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            return INTVAL_TEXT_ANTIALIAS_OFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        } else if (aa == VALUE_TEXT_ANTIALIAS_ON) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            return INTVAL_TEXT_ANTIALIAS_ON;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        } else if (aa == VALUE_TEXT_ANTIALIAS_GASP) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            if (font2D.useAAForPtSize(ptSize)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                return INTVAL_TEXT_ANTIALIAS_ON;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                return INTVAL_TEXT_ANTIALIAS_OFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_HRGB ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                   aa == VALUE_TEXT_ANTIALIAS_LCD_HBGR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            return INTVAL_TEXT_ANTIALIAS_LCD_HRGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_VRGB ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                   aa == VALUE_TEXT_ANTIALIAS_LCD_VBGR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            return INTVAL_TEXT_ANTIALIAS_LCD_VRGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            return INTVAL_TEXT_ANTIALIAS_OFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    /* This maps a public text AA hint value into one of the subset of values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * used to index strikes. For the purpose of the strike cache there are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * only 4 values : OFF, ON, LCD_HRGB, LCD_VRGB.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * Font and FontRenderContext are needed to resolve the 'gasp' table.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * This is similar to the method above, but used by callers which have not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * already calculated the glyph device point size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    public static int getAAHintIntVal(Font2D font2D, Font font,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                                      FontRenderContext frc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        Object aa = frc.getAntiAliasingHint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        if (aa == VALUE_TEXT_ANTIALIAS_OFF ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            aa == VALUE_TEXT_ANTIALIAS_DEFAULT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            return INTVAL_TEXT_ANTIALIAS_OFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        } else if (aa == VALUE_TEXT_ANTIALIAS_ON) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            return INTVAL_TEXT_ANTIALIAS_ON;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        } else if (aa == VALUE_TEXT_ANTIALIAS_GASP) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            /* FRC.isIdentity() would have been useful */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            int ptSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            AffineTransform tx = frc.getTransform();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            if (tx.isIdentity() && !font.isTransformed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                ptSize = font.getSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                /* one or both transforms is not identity */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                float size = font.getSize2D();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                if (tx.isIdentity()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                    tx = font.getTransform();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                    tx.scale(size, size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                    tx.scale(size, size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                    if (font.isTransformed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                        tx.concatenate(font.getTransform());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                double shearx = tx.getShearX();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                double scaley = tx.getScaleY();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                if (shearx != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                    scaley = Math.sqrt(shearx * shearx + scaley * scaley);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                ptSize = (int)(Math.abs(scaley)+0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            if (font2D.useAAForPtSize(ptSize)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                return INTVAL_TEXT_ANTIALIAS_ON;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                return INTVAL_TEXT_ANTIALIAS_OFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_HRGB ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                   aa == VALUE_TEXT_ANTIALIAS_LCD_HBGR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
            return INTVAL_TEXT_ANTIALIAS_LCD_HRGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        } else if (aa == VALUE_TEXT_ANTIALIAS_LCD_VRGB ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                   aa == VALUE_TEXT_ANTIALIAS_LCD_VBGR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            return INTVAL_TEXT_ANTIALIAS_LCD_VRGB;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            return INTVAL_TEXT_ANTIALIAS_OFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    public static int getFMHintIntVal(Object fm) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        if (fm == VALUE_FRACTIONALMETRICS_OFF ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            fm == VALUE_FRACTIONALMETRICS_DEFAULT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            return INTVAL_FRACTIONALMETRICS_OFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            return INTVAL_FRACTIONALMETRICS_ON;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    public FontStrikeDesc(AffineTransform devAt, AffineTransform at,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                          int fStyle, int aa, int fm) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        devTx = devAt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        glyphTx = at; // not cloning glyphTx. Callers trusted to not mutate it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        style = fStyle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        aaHint = aa;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        fmHint = fm;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        valuemask = fStyle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        switch (aa) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
           case INTVAL_TEXT_ANTIALIAS_OFF :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
           case INTVAL_TEXT_ANTIALIAS_ON  :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                valuemask |= AA_ON;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
           case INTVAL_TEXT_ANTIALIAS_LCD_HRGB :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
           case INTVAL_TEXT_ANTIALIAS_LCD_HBGR :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                valuemask |= AA_LCD_H;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
           case INTVAL_TEXT_ANTIALIAS_LCD_VRGB :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
           case INTVAL_TEXT_ANTIALIAS_LCD_VBGR :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                valuemask |= AA_LCD_V;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
           default: break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        if (fm == INTVAL_FRACTIONALMETRICS_ON) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
           valuemask |= FRAC_METRICS_ON;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    FontStrikeDesc(FontStrikeDesc desc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        devTx = desc.devTx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        // Clone the TX in this case as this is called when its known
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        // that "desc" is being re-used by its creator.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        glyphTx = (AffineTransform)desc.glyphTx.clone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        style = desc.style;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        aaHint = desc.aaHint;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        fmHint = desc.fmHint;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        hashCode = desc.hashCode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        valuemask = desc.valuemask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        return "FontStrikeDesc: Style="+style+ " AA="+aaHint+ " FM="+fmHint+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            " devTx="+devTx+ " devTx.FontTx.ptSize="+glyphTx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
}