1/*
2 * Copyright (c) 2005, 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
26/*
27 *
28 * (C) Copyright IBM Corp. 2005 - All Rights Reserved
29 *
30 * The original version of this source code and documentation is
31 * copyrighted and owned by IBM. These materials are provided
32 * under terms of a License Agreement between IBM and Sun.
33 * This technology is protected by multiple US and International
34 * patents. This notice and attribution to IBM may not be removed.
35 */
36
37package sun.font;
38
39import java.awt.font.TextAttribute;
40import java.text.AttributedCharacterIterator.Attribute;
41
42import static java.awt.font.TextAttribute.*;
43
44public enum EAttribute {
45    EFAMILY(FAMILY),
46    EWEIGHT(WEIGHT),
47    EWIDTH(WIDTH),
48    EPOSTURE(POSTURE),
49    ESIZE(SIZE),
50    ETRANSFORM(TRANSFORM),
51    ESUPERSCRIPT(SUPERSCRIPT),
52    EFONT(FONT),
53    ECHAR_REPLACEMENT(CHAR_REPLACEMENT),
54    EFOREGROUND(FOREGROUND),
55    EBACKGROUND(BACKGROUND),
56    EUNDERLINE(UNDERLINE),
57    ESTRIKETHROUGH(STRIKETHROUGH),
58    ERUN_DIRECTION(RUN_DIRECTION),
59    EBIDI_EMBEDDING(BIDI_EMBEDDING),
60    EJUSTIFICATION(JUSTIFICATION),
61    EINPUT_METHOD_HIGHLIGHT(INPUT_METHOD_HIGHLIGHT),
62    EINPUT_METHOD_UNDERLINE(INPUT_METHOD_UNDERLINE),
63    ESWAP_COLORS(SWAP_COLORS),
64    ENUMERIC_SHAPING(NUMERIC_SHAPING),
65    EKERNING(KERNING),
66    ELIGATURES(LIGATURES),
67    ETRACKING(TRACKING),
68    EBASELINE_TRANSFORM(null);
69
70    /* package */ final int mask;
71    /* package */ final TextAttribute att;
72
73    EAttribute(TextAttribute ta) {
74        mask = 1 << ordinal();
75        att = ta;
76    }
77
78    /* package */ static final EAttribute[] atts = EAttribute.class.getEnumConstants();
79
80    public static EAttribute forAttribute(Attribute ta) {
81        for (EAttribute ea: atts) {
82            if (ea.att == ta) {
83                return ea;
84            }
85        }
86        return null;
87    }
88
89    public String toString() {
90        return name().substring(1).toLowerCase();
91    }
92}
93