2127 * 2128 * @param attributes a map of attributes enabled for the new 2129 * {@code Font} 2130 * @return a new {@code Font} object. 2131 * @since 1.2 2132 */ 2133 public Font deriveFont(Map<? extends Attribute, ?> attributes) { 2134 if (attributes == null) { 2135 return this; 2136 } 2137 AttributeValues newValues = getAttributeValues().clone(); 2138 newValues.merge(attributes, RECOGNIZED_MASK); 2139 2140 return new Font(newValues, name, style, createdFont, font2DHandle); 2141 } 2142 2143 /** 2144 * Checks if this {@code Font} has a glyph for the specified 2145 * character. 2146 * 2147 * <p> <b>Note:</b> This method cannot handle <a 2148 * href="../../java/lang/Character.html#supplementary"> supplementary 2149 * characters</a>. To support all Unicode characters, including 2150 * supplementary characters, use the {@link #canDisplay(int)} 2151 * method or {@code canDisplayUpTo} methods. 2152 * 2153 * @param c the character for which a glyph is needed 2154 * @return {@code true} if this {@code Font} has a glyph for this 2155 * character; {@code false} otherwise. 2156 * @since 1.2 2157 */ 2158 public boolean canDisplay(char c){ 2159 return getFont2D().canDisplay(c); 2160 } 2161 2162 /** 2163 * Checks if this {@code Font} has a glyph for the specified 2164 * character. 2165 * 2166 * @param codePoint the character (Unicode code point) for which a glyph 2167 * is needed. 2168 * @return {@code true} if this {@code Font} has a glyph for the 2169 * character; {@code false} otherwise. | 2127 * 2128 * @param attributes a map of attributes enabled for the new 2129 * {@code Font} 2130 * @return a new {@code Font} object. 2131 * @since 1.2 2132 */ 2133 public Font deriveFont(Map<? extends Attribute, ?> attributes) { 2134 if (attributes == null) { 2135 return this; 2136 } 2137 AttributeValues newValues = getAttributeValues().clone(); 2138 newValues.merge(attributes, RECOGNIZED_MASK); 2139 2140 return new Font(newValues, name, style, createdFont, font2DHandle); 2141 } 2142 2143 /** 2144 * Checks if this {@code Font} has a glyph for the specified 2145 * character. 2146 * 2147 * <p> <b>Note:</b> This method cannot handle 2148 * <a href="../../../java.base/java/lang/Character.html#supplementary"> 2149 * supplementary characters</a>. 2150 * To support all Unicode characters, including 2151 * supplementary characters, use the {@link #canDisplay(int)} 2152 * method or {@code canDisplayUpTo} methods. 2153 * 2154 * @param c the character for which a glyph is needed 2155 * @return {@code true} if this {@code Font} has a glyph for this 2156 * character; {@code false} otherwise. 2157 * @since 1.2 2158 */ 2159 public boolean canDisplay(char c){ 2160 return getFont2D().canDisplay(c); 2161 } 2162 2163 /** 2164 * Checks if this {@code Font} has a glyph for the specified 2165 * character. 2166 * 2167 * @param codePoint the character (Unicode code point) for which a glyph 2168 * is needed. 2169 * @return {@code true} if this {@code Font} has a glyph for the 2170 * character; {@code false} otherwise. |