< prev index next >

src/java.desktop/share/classes/sun/awt/PlatformFont.java

Print this page


   1 /*
   2  * Copyright (c) 1996, 2014, 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


 103     /**
 104      * make a array of CharsetString with given String.
 105      */
 106     public CharsetString[] makeMultiCharsetString(String str){
 107         return makeMultiCharsetString(str.toCharArray(), 0, str.length(), true);
 108     }
 109 
 110     /**
 111      * make a array of CharsetString with given String.
 112      */
 113     public CharsetString[] makeMultiCharsetString(String str, boolean allowdefault){
 114         return makeMultiCharsetString(str.toCharArray(), 0, str.length(), allowdefault);
 115     }
 116 
 117     /**
 118      * make a array of CharsetString with given char array.
 119      * @param str The char array to convert.
 120      * @param offset offset of first character of interest
 121      * @param len number of characters to convert
 122      */
 123     public CharsetString[] makeMultiCharsetString(char str[], int offset, int len) {
 124         return makeMultiCharsetString(str, offset, len, true);
 125     }
 126 
 127     /**
 128      * make a array of CharsetString with given char array.
 129      * @param str The char array to convert.
 130      * @param offset offset of first character of interest
 131      * @param len number of characters to convert
 132      * @param allowDefault whether to allow the default char.
 133      * Setting this to true overloads the meaning of this method to
 134      * return non-null only if all chars can be converted.
 135      * @return array of CharsetString or if allowDefault is false and any
 136      * of the returned chars would have been converted to a default char,
 137      * then return null.
 138      * This is used to choose alternative means of displaying the text.
 139      */
 140     public CharsetString[] makeMultiCharsetString(char str[], int offset, int len,
 141                                                   boolean allowDefault) {
 142 
 143         if (len < 1) {
 144             return new CharsetString[0];
 145         }
 146         Vector<CharsetString> mcs = null;
 147         char[] tmpStr = new char[len];
 148         char tmpChar = defaultChar;
 149         boolean encoded = false;
 150 
 151         FontDescriptor currentFont = defaultFont;
 152 
 153 
 154         for (int i = 0; i < componentFonts.length; i++) {
 155             if (componentFonts[i].isExcluded(str[offset])){
 156                 continue;
 157             }
 158 
 159             /* Need "encoded" variable to distinguish the case when
 160              * the default char is the same as the encoded char.


   1 /*
   2  * Copyright (c) 1996, 2018, 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


 103     /**
 104      * make a array of CharsetString with given String.
 105      */
 106     public CharsetString[] makeMultiCharsetString(String str){
 107         return makeMultiCharsetString(str.toCharArray(), 0, str.length(), true);
 108     }
 109 
 110     /**
 111      * make a array of CharsetString with given String.
 112      */
 113     public CharsetString[] makeMultiCharsetString(String str, boolean allowdefault){
 114         return makeMultiCharsetString(str.toCharArray(), 0, str.length(), allowdefault);
 115     }
 116 
 117     /**
 118      * make a array of CharsetString with given char array.
 119      * @param str The char array to convert.
 120      * @param offset offset of first character of interest
 121      * @param len number of characters to convert
 122      */
 123     public CharsetString[] makeMultiCharsetString(char[] str, int offset, int len) {
 124         return makeMultiCharsetString(str, offset, len, true);
 125     }
 126 
 127     /**
 128      * make a array of CharsetString with given char array.
 129      * @param str The char array to convert.
 130      * @param offset offset of first character of interest
 131      * @param len number of characters to convert
 132      * @param allowDefault whether to allow the default char.
 133      * Setting this to true overloads the meaning of this method to
 134      * return non-null only if all chars can be converted.
 135      * @return array of CharsetString or if allowDefault is false and any
 136      * of the returned chars would have been converted to a default char,
 137      * then return null.
 138      * This is used to choose alternative means of displaying the text.
 139      */
 140     public CharsetString[] makeMultiCharsetString(char[] str, int offset, int len,
 141                                                   boolean allowDefault) {
 142 
 143         if (len < 1) {
 144             return new CharsetString[0];
 145         }
 146         Vector<CharsetString> mcs = null;
 147         char[] tmpStr = new char[len];
 148         char tmpChar = defaultChar;
 149         boolean encoded = false;
 150 
 151         FontDescriptor currentFont = defaultFont;
 152 
 153 
 154         for (int i = 0; i < componentFonts.length; i++) {
 155             if (componentFonts[i].isExcluded(str[offset])){
 156                 continue;
 157             }
 158 
 159             /* Need "encoded" variable to distinguish the case when
 160              * the default char is the same as the encoded char.


< prev index next >