194 protected synchronized long getNativeFontPtr() { 195 if (nativeFontPtr == 0L) { 196 nativeFontPtr = createNativeFont(nativeFontName, style); 197 } 198 return nativeFontPtr; 199 } 200 201 private native long getCGFontPtrNative(long ptr); 202 203 // This digs the CGFont out of the AWTFont. 204 protected synchronized long getPlatformNativeFontPtr() { 205 return getCGFontPtrNative(getNativeFontPtr()); 206 } 207 208 static native void getCascadeList(long nativeFontPtr, ArrayList<String> listOfString); 209 210 private CompositeFont createCompositeFont() { 211 ArrayList<String> listOfString = new ArrayList<String>(); 212 getCascadeList(nativeFontPtr, listOfString); 213 214 FontManager fm = FontManagerFactory.getInstance(); 215 int numFonts = 1 + listOfString.size(); 216 PhysicalFont[] fonts = new PhysicalFont[numFonts]; 217 fonts[0] = this; 218 int idx = 1; 219 for (String s : listOfString) { 220 if (s.equals(".AppleSymbolsFB")) { 221 // Don't know why we get the weird name above .. replace. 222 s = "AppleSymbols"; 223 } 224 Font2D f2d = fm.findFont2D(s, Font.PLAIN, FontManager.NO_FALLBACK); 225 if (f2d == null || f2d == this) { 226 continue; 227 } 228 fonts[idx++] = (PhysicalFont)f2d; 229 } 230 if (idx < fonts.length) { 231 PhysicalFont[] orig = fonts; 232 fonts = new PhysicalFont[idx]; 233 System.arraycopy(orig, 0, fonts, 0, idx); | 194 protected synchronized long getNativeFontPtr() { 195 if (nativeFontPtr == 0L) { 196 nativeFontPtr = createNativeFont(nativeFontName, style); 197 } 198 return nativeFontPtr; 199 } 200 201 private native long getCGFontPtrNative(long ptr); 202 203 // This digs the CGFont out of the AWTFont. 204 protected synchronized long getPlatformNativeFontPtr() { 205 return getCGFontPtrNative(getNativeFontPtr()); 206 } 207 208 static native void getCascadeList(long nativeFontPtr, ArrayList<String> listOfString); 209 210 private CompositeFont createCompositeFont() { 211 ArrayList<String> listOfString = new ArrayList<String>(); 212 getCascadeList(nativeFontPtr, listOfString); 213 214 // add JRE "Lucida Sans Regular" to the cascade list to enable fallback 215 // to happen to this JRE font in case the intended glyph is missing in 216 // fonts provided in the CoreText provided cascaded list 217 listOfString.add("Lucida Sans Regular"); 218 FontManager fm = FontManagerFactory.getInstance(); 219 int numFonts = 1 + listOfString.size(); 220 PhysicalFont[] fonts = new PhysicalFont[numFonts]; 221 fonts[0] = this; 222 int idx = 1; 223 for (String s : listOfString) { 224 if (s.equals(".AppleSymbolsFB")) { 225 // Don't know why we get the weird name above .. replace. 226 s = "AppleSymbols"; 227 } 228 Font2D f2d = fm.findFont2D(s, Font.PLAIN, FontManager.NO_FALLBACK); 229 if (f2d == null || f2d == this) { 230 continue; 231 } 232 fonts[idx++] = (PhysicalFont)f2d; 233 } 234 if (idx < fonts.length) { 235 PhysicalFont[] orig = fonts; 236 fonts = new PhysicalFont[idx]; 237 System.arraycopy(orig, 0, fonts, 0, idx); |