Path: blob/master/src/java.desktop/share/classes/sun/font/EAttribute.java
41154 views
/*1* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425/*26*27* (C) Copyright IBM Corp. 2005 - All Rights Reserved28*29* The original version of this source code and documentation is30* copyrighted and owned by IBM. These materials are provided31* under terms of a License Agreement between IBM and Sun.32* This technology is protected by multiple US and International33* patents. This notice and attribution to IBM may not be removed.34*/3536package sun.font;3738import java.awt.font.TextAttribute;39import java.text.AttributedCharacterIterator.Attribute;4041import static java.awt.font.TextAttribute.*;4243public enum EAttribute {44EFAMILY(FAMILY),45EWEIGHT(WEIGHT),46EWIDTH(WIDTH),47EPOSTURE(POSTURE),48ESIZE(SIZE),49ETRANSFORM(TRANSFORM),50ESUPERSCRIPT(SUPERSCRIPT),51EFONT(FONT),52ECHAR_REPLACEMENT(CHAR_REPLACEMENT),53EFOREGROUND(FOREGROUND),54EBACKGROUND(BACKGROUND),55EUNDERLINE(UNDERLINE),56ESTRIKETHROUGH(STRIKETHROUGH),57ERUN_DIRECTION(RUN_DIRECTION),58EBIDI_EMBEDDING(BIDI_EMBEDDING),59EJUSTIFICATION(JUSTIFICATION),60EINPUT_METHOD_HIGHLIGHT(INPUT_METHOD_HIGHLIGHT),61EINPUT_METHOD_UNDERLINE(INPUT_METHOD_UNDERLINE),62ESWAP_COLORS(SWAP_COLORS),63ENUMERIC_SHAPING(NUMERIC_SHAPING),64EKERNING(KERNING),65ELIGATURES(LIGATURES),66ETRACKING(TRACKING),67EBASELINE_TRANSFORM(null);6869/* package */ final int mask;70/* package */ final TextAttribute att;7172EAttribute(TextAttribute ta) {73mask = 1 << ordinal();74att = ta;75}7677/* package */ static final EAttribute[] atts = EAttribute.class.getEnumConstants();7879public static EAttribute forAttribute(Attribute ta) {80for (EAttribute ea: atts) {81if (ea.att == ta) {82return ea;83}84}85return null;86}8788public String toString() {89return name().substring(1).toLowerCase();90}91}929394