< prev index next >
src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 23,54 ****
* questions.
*/
package java.awt.font;
- import java.lang.reflect.Field;
import jdk.internal.misc.JavaAWTFontAccess;
class JavaAWTFontAccessImpl implements JavaAWTFontAccess {
// java.awt.font.TextAttribute constants
public Object getTextAttributeConstant(String name) {
switch (name) {
case "RUN_DIRECTION":
case "NUMERIC_SHAPING":
case "BIDI_EMBEDDING":
case "RUN_DIRECTION_LTR":
! try {
! Field f = TextAttribute.class.getField(name);
! return f.get(null);
! } catch (NoSuchFieldException | IllegalAccessException x) {
! throw new AssertionError(x);
! }
! }
!
throw new AssertionError("Constant name is not recognized");
}
// java.awt.font.NumericShaper
public void shape(Object shaper, char[] text, int start, int count) {
assert shaper instanceof NumericShaper;
((NumericShaper)shaper).shape(text, start,count);
--- 23,51 ----
* questions.
*/
package java.awt.font;
import jdk.internal.misc.JavaAWTFontAccess;
class JavaAWTFontAccessImpl implements JavaAWTFontAccess {
// java.awt.font.TextAttribute constants
public Object getTextAttributeConstant(String name) {
switch (name) {
case "RUN_DIRECTION":
+ return TextAttribute.RUN_DIRECTION;
case "NUMERIC_SHAPING":
+ return TextAttribute.NUMERIC_SHAPING;
case "BIDI_EMBEDDING":
+ return TextAttribute.BIDI_EMBEDDING;
case "RUN_DIRECTION_LTR":
! return TextAttribute.RUN_DIRECTION_LTR;
! default:
throw new AssertionError("Constant name is not recognized");
}
+ }
// java.awt.font.NumericShaper
public void shape(Object shaper, char[] text, int start, int count) {
assert shaper instanceof NumericShaper;
((NumericShaper)shaper).shape(text, start,count);
< prev index next >