Java Code Examples for sun.font.Font2D#canDisplay()
The following examples show how to use
sun.font.Font2D#canDisplay() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Font.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display a * specified <code>String</code>. For strings with Unicode encoding, * it is important to know if a particular font can display the * string. This method returns an offset into the <code>String</code> * <code>str</code> which is the first character this * <code>Font</code> cannot display without using the missing glyph * code. If the <code>Font</code> can display all characters, -1 is * returned. * @param str a <code>String</code> object * @return an offset into <code>str</code> that points * to the first character in <code>str</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>str</code>. * @since 1.2 */ public int canDisplayUpTo(String str) { Font2D font2d = getFont2D(); int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } if (!font2d.canDisplay(str.codePointAt(i))) { return i; } i++; } return -1; }
Example 2
Source File: Font.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Indicates whether or not this {@code Font} can display the * text specified by the {@code iter} starting at * {@code start} and ending at {@code limit}. * * @param iter a {@link CharacterIterator} object * @param start the specified starting offset into the specified * {@code CharacterIterator}. * @param limit the specified ending offset into the specified * {@code CharacterIterator}. * @return an offset into {@code iter} that points * to the first character in {@code iter} that this * {@code Font} cannot display; or {@code -1} if * this {@code Font} can display all characters in * {@code iter}. * @since 1.2 */ public int canDisplayUpTo(CharacterIterator iter, int start, int limit) { Font2D font2d = getFont2D(); char c = iter.setIndex(start); for (int i = start; i < limit; i++, c = iter.next()) { if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } char c2 = iter.next(); // c2 could be CharacterIterator.DONE which is not a low surrogate. if (!Character.isLowSurrogate(c2)) { return i; } if (!font2d.canDisplay(Character.toCodePoint(c, c2))) { return i; } i++; } return -1; }
Example 3
Source File: Font.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display a * specified <code>String</code>. For strings with Unicode encoding, * it is important to know if a particular font can display the * string. This method returns an offset into the <code>String</code> * <code>str</code> which is the first character this * <code>Font</code> cannot display without using the missing glyph * code. If the <code>Font</code> can display all characters, -1 is * returned. * @param str a <code>String</code> object * @return an offset into <code>str</code> that points * to the first character in <code>str</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>str</code>. * @since 1.2 */ public int canDisplayUpTo(String str) { Font2D font2d = getFont2D(); int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } if (!font2d.canDisplay(str.codePointAt(i))) { return i; } i++; } return -1; }
Example 4
Source File: Font.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display the * text specified by the <code>iter</code> starting at * <code>start</code> and ending at <code>limit</code>. * * @param iter a {@link CharacterIterator} object * @param start the specified starting offset into the specified * <code>CharacterIterator</code>. * @param limit the specified ending offset into the specified * <code>CharacterIterator</code>. * @return an offset into <code>iter</code> that points * to the first character in <code>iter</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>iter</code>. * @since 1.2 */ public int canDisplayUpTo(CharacterIterator iter, int start, int limit) { Font2D font2d = getFont2D(); char c = iter.setIndex(start); for (int i = start; i < limit; i++, c = iter.next()) { if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } char c2 = iter.next(); // c2 could be CharacterIterator.DONE which is not a low surrogate. if (!Character.isLowSurrogate(c2)) { return i; } if (!font2d.canDisplay(Character.toCodePoint(c, c2))) { return i; } i++; } return -1; }
Example 5
Source File: Font.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display a * specified <code>String</code>. For strings with Unicode encoding, * it is important to know if a particular font can display the * string. This method returns an offset into the <code>String</code> * <code>str</code> which is the first character this * <code>Font</code> cannot display without using the missing glyph * code. If the <code>Font</code> can display all characters, -1 is * returned. * @param str a <code>String</code> object * @return an offset into <code>str</code> that points * to the first character in <code>str</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>str</code>. * @since 1.2 */ public int canDisplayUpTo(String str) { Font2D font2d = getFont2D(); int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } if (!font2d.canDisplay(str.codePointAt(i))) { return i; } i++; } return -1; }
Example 6
Source File: Font.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display the * text specified by the <code>iter</code> starting at * <code>start</code> and ending at <code>limit</code>. * * @param iter a {@link CharacterIterator} object * @param start the specified starting offset into the specified * <code>CharacterIterator</code>. * @param limit the specified ending offset into the specified * <code>CharacterIterator</code>. * @return an offset into <code>iter</code> that points * to the first character in <code>iter</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>iter</code>. * @since 1.2 */ public int canDisplayUpTo(CharacterIterator iter, int start, int limit) { Font2D font2d = getFont2D(); char c = iter.setIndex(start); for (int i = start; i < limit; i++, c = iter.next()) { if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } char c2 = iter.next(); // c2 could be CharacterIterator.DONE which is not a low surrogate. if (!Character.isLowSurrogate(c2)) { return i; } if (!font2d.canDisplay(Character.toCodePoint(c, c2))) { return i; } i++; } return -1; }
Example 7
Source File: Font.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display the * text specified by the <code>iter</code> starting at * <code>start</code> and ending at <code>limit</code>. * * @param iter a {@link CharacterIterator} object * @param start the specified starting offset into the specified * <code>CharacterIterator</code>. * @param limit the specified ending offset into the specified * <code>CharacterIterator</code>. * @return an offset into <code>iter</code> that points * to the first character in <code>iter</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>iter</code>. * @since 1.2 */ public int canDisplayUpTo(CharacterIterator iter, int start, int limit) { Font2D font2d = getFont2D(); char c = iter.setIndex(start); for (int i = start; i < limit; i++, c = iter.next()) { if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } char c2 = iter.next(); // c2 could be CharacterIterator.DONE which is not a low surrogate. if (!Character.isLowSurrogate(c2)) { return i; } if (!font2d.canDisplay(Character.toCodePoint(c, c2))) { return i; } i++; } return -1; }
Example 8
Source File: Font.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display the * text specified by the <code>iter</code> starting at * <code>start</code> and ending at <code>limit</code>. * * @param iter a {@link CharacterIterator} object * @param start the specified starting offset into the specified * <code>CharacterIterator</code>. * @param limit the specified ending offset into the specified * <code>CharacterIterator</code>. * @return an offset into <code>iter</code> that points * to the first character in <code>iter</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>iter</code>. * @since 1.2 */ public int canDisplayUpTo(CharacterIterator iter, int start, int limit) { Font2D font2d = getFont2D(); char c = iter.setIndex(start); for (int i = start; i < limit; i++, c = iter.next()) { if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } char c2 = iter.next(); // c2 could be CharacterIterator.DONE which is not a low surrogate. if (!Character.isLowSurrogate(c2)) { return i; } if (!font2d.canDisplay(Character.toCodePoint(c, c2))) { return i; } i++; } return -1; }
Example 9
Source File: Font.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this {@code Font} can display a * specified {@code String}. For strings with Unicode encoding, * it is important to know if a particular font can display the * string. This method returns an offset into the {@code String} * {@code str} which is the first character this * {@code Font} cannot display without using the missing glyph * code. If the {@code Font} can display all characters, -1 is * returned. * @param str a {@code String} object * @return an offset into {@code str} that points * to the first character in {@code str} that this * {@code Font} cannot display; or {@code -1} if * this {@code Font} can display all characters in * {@code str}. * @since 1.2 */ public int canDisplayUpTo(String str) { Font2D font2d = getFont2D(); int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } if (!font2d.canDisplay(str.codePointAt(i))) { return i; } i++; } return -1; }
Example 10
Source File: Font.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display the * text specified by the <code>iter</code> starting at * <code>start</code> and ending at <code>limit</code>. * * @param iter a {@link CharacterIterator} object * @param start the specified starting offset into the specified * <code>CharacterIterator</code>. * @param limit the specified ending offset into the specified * <code>CharacterIterator</code>. * @return an offset into <code>iter</code> that points * to the first character in <code>iter</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>iter</code>. * @since 1.2 */ public int canDisplayUpTo(CharacterIterator iter, int start, int limit) { Font2D font2d = getFont2D(); char c = iter.setIndex(start); for (int i = start; i < limit; i++, c = iter.next()) { if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } char c2 = iter.next(); // c2 could be CharacterIterator.DONE which is not a low surrogate. if (!Character.isLowSurrogate(c2)) { return i; } if (!font2d.canDisplay(Character.toCodePoint(c, c2))) { return i; } i++; } return -1; }
Example 11
Source File: Font.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display the * text specified by the <code>iter</code> starting at * <code>start</code> and ending at <code>limit</code>. * * @param iter a {@link CharacterIterator} object * @param start the specified starting offset into the specified * <code>CharacterIterator</code>. * @param limit the specified ending offset into the specified * <code>CharacterIterator</code>. * @return an offset into <code>iter</code> that points * to the first character in <code>iter</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>iter</code>. * @since 1.2 */ public int canDisplayUpTo(CharacterIterator iter, int start, int limit) { Font2D font2d = getFont2D(); char c = iter.setIndex(start); for (int i = start; i < limit; i++, c = iter.next()) { if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } char c2 = iter.next(); // c2 could be CharacterIterator.DONE which is not a low surrogate. if (!Character.isLowSurrogate(c2)) { return i; } if (!font2d.canDisplay(Character.toCodePoint(c, c2))) { return i; } i++; } return -1; }
Example 12
Source File: Font.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display a * specified <code>String</code>. For strings with Unicode encoding, * it is important to know if a particular font can display the * string. This method returns an offset into the <code>String</code> * <code>str</code> which is the first character this * <code>Font</code> cannot display without using the missing glyph * code. If the <code>Font</code> can display all characters, -1 is * returned. * @param str a <code>String</code> object * @return an offset into <code>str</code> that points * to the first character in <code>str</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>str</code>. * @since 1.2 */ public int canDisplayUpTo(String str) { Font2D font2d = getFont2D(); int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } if (!font2d.canDisplay(str.codePointAt(i))) { return i; } i++; } return -1; }
Example 13
Source File: Font.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display a * specified <code>String</code>. For strings with Unicode encoding, * it is important to know if a particular font can display the * string. This method returns an offset into the <code>String</code> * <code>str</code> which is the first character this * <code>Font</code> cannot display without using the missing glyph * code. If the <code>Font</code> can display all characters, -1 is * returned. * @param str a <code>String</code> object * @return an offset into <code>str</code> that points * to the first character in <code>str</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>str</code>. * @since 1.2 */ public int canDisplayUpTo(String str) { Font2D font2d = getFont2D(); int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } if (!font2d.canDisplay(str.codePointAt(i))) { return i; } i++; } return -1; }
Example 14
Source File: Font.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display the * text specified by the <code>iter</code> starting at * <code>start</code> and ending at <code>limit</code>. * * @param iter a {@link CharacterIterator} object * @param start the specified starting offset into the specified * <code>CharacterIterator</code>. * @param limit the specified ending offset into the specified * <code>CharacterIterator</code>. * @return an offset into <code>iter</code> that points * to the first character in <code>iter</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>iter</code>. * @since 1.2 */ public int canDisplayUpTo(CharacterIterator iter, int start, int limit) { Font2D font2d = getFont2D(); char c = iter.setIndex(start); for (int i = start; i < limit; i++, c = iter.next()) { if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } char c2 = iter.next(); // c2 could be CharacterIterator.DONE which is not a low surrogate. if (!Character.isLowSurrogate(c2)) { return i; } if (!font2d.canDisplay(Character.toCodePoint(c, c2))) { return i; } i++; } return -1; }
Example 15
Source File: Font.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display a * specified <code>String</code>. For strings with Unicode encoding, * it is important to know if a particular font can display the * string. This method returns an offset into the <code>String</code> * <code>str</code> which is the first character this * <code>Font</code> cannot display without using the missing glyph * code. If the <code>Font</code> can display all characters, -1 is * returned. * @param str a <code>String</code> object * @return an offset into <code>str</code> that points * to the first character in <code>str</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>str</code>. * @since 1.2 */ public int canDisplayUpTo(String str) { Font2D font2d = getFont2D(); int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } if (!font2d.canDisplay(str.codePointAt(i))) { return i; } i++; } return -1; }
Example 16
Source File: Font.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Indicates whether or not this <code>Font</code> can display the * text specified by the <code>iter</code> starting at * <code>start</code> and ending at <code>limit</code>. * * @param iter a {@link CharacterIterator} object * @param start the specified starting offset into the specified * <code>CharacterIterator</code>. * @param limit the specified ending offset into the specified * <code>CharacterIterator</code>. * @return an offset into <code>iter</code> that points * to the first character in <code>iter</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>iter</code>. * @since 1.2 */ public int canDisplayUpTo(CharacterIterator iter, int start, int limit) { Font2D font2d = getFont2D(); char c = iter.setIndex(start); for (int i = start; i < limit; i++, c = iter.next()) { if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } char c2 = iter.next(); // c2 could be CharacterIterator.DONE which is not a low surrogate. if (!Character.isLowSurrogate(c2)) { return i; } if (!font2d.canDisplay(Character.toCodePoint(c, c2))) { return i; } i++; } return -1; }
Example 17
Source File: Font.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Indicates whether or not this {@code Font} can display * the characters in the specified {@code text} * starting at {@code start} and ending at * {@code limit}. This method is a convenience overload. * @param text the specified array of {@code char} values * @param start the specified starting offset (in * {@code char}s) into the specified array of * {@code char} values * @param limit the specified ending offset (in * {@code char}s) into the specified array of * {@code char} values * @return an offset into {@code text} that points * to the first character in {@code text} that this * {@code Font} cannot display; or {@code -1} if * this {@code Font} can display all characters in * {@code text}. * @since 1.2 */ public int canDisplayUpTo(char[] text, int start, int limit) { Font2D font2d = getFont2D(); for (int i = start; i < limit; i++) { char c = text[i]; if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } if (!font2d.canDisplay(Character.codePointAt(text, i, limit))) { return i; } i++; } return -1; }
Example 18
Source File: Font.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Indicates whether or not this <code>Font</code> can display * the characters in the specified <code>text</code> * starting at <code>start</code> and ending at * <code>limit</code>. This method is a convenience overload. * @param text the specified array of <code>char</code> values * @param start the specified starting offset (in * <code>char</code>s) into the specified array of * <code>char</code> values * @param limit the specified ending offset (in * <code>char</code>s) into the specified array of * <code>char</code> values * @return an offset into <code>text</code> that points * to the first character in <code>text</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>text</code>. * @since 1.2 */ public int canDisplayUpTo(char[] text, int start, int limit) { Font2D font2d = getFont2D(); for (int i = start; i < limit; i++) { char c = text[i]; if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } if (!font2d.canDisplay(Character.codePointAt(text, i, limit))) { return i; } i++; } return -1; }
Example 19
Source File: Font.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Indicates whether or not this <code>Font</code> can display * the characters in the specified <code>text</code> * starting at <code>start</code> and ending at * <code>limit</code>. This method is a convenience overload. * @param text the specified array of <code>char</code> values * @param start the specified starting offset (in * <code>char</code>s) into the specified array of * <code>char</code> values * @param limit the specified ending offset (in * <code>char</code>s) into the specified array of * <code>char</code> values * @return an offset into <code>text</code> that points * to the first character in <code>text</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>text</code>. * @since 1.2 */ public int canDisplayUpTo(char[] text, int start, int limit) { Font2D font2d = getFont2D(); for (int i = start; i < limit; i++) { char c = text[i]; if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } if (!font2d.canDisplay(Character.codePointAt(text, i, limit))) { return i; } i++; } return -1; }
Example 20
Source File: Font.java From Java8CN with Apache License 2.0 | 4 votes |
/** * Indicates whether or not this <code>Font</code> can display * the characters in the specified <code>text</code> * starting at <code>start</code> and ending at * <code>limit</code>. This method is a convenience overload. * @param text the specified array of <code>char</code> values * @param start the specified starting offset (in * <code>char</code>s) into the specified array of * <code>char</code> values * @param limit the specified ending offset (in * <code>char</code>s) into the specified array of * <code>char</code> values * @return an offset into <code>text</code> that points * to the first character in <code>text</code> that this * <code>Font</code> cannot display; or <code>-1</code> if * this <code>Font</code> can display all characters in * <code>text</code>. * @since 1.2 */ public int canDisplayUpTo(char[] text, int start, int limit) { Font2D font2d = getFont2D(); for (int i = start; i < limit; i++) { char c = text[i]; if (font2d.canDisplay(c)) { continue; } if (!Character.isHighSurrogate(c)) { return i; } if (!font2d.canDisplay(Character.codePointAt(text, i, limit))) { return i; } i++; } return -1; }