< prev index next >

src/java.desktop/share/classes/sun/font/SunFontManager.java

Print this page




 628      * have and is good enough for the known cases.
 629      * Also don't want to register fonts that match JRE font families
 630      * but are coming from a source other than the JRE.
 631      * This will ensure that we will algorithmically style the JRE
 632      * plain font and get the same set of glyphs for all styles.
 633      *
 634      * Note that this method returns a value
 635      * if it returns the same object as its argument that means this
 636      * font was newly registered.
 637      * If it returns a different object it means this font already exists,
 638      * and you should use that one.
 639      * If it returns null means this font was not registered and none
 640      * in that name is registered. The caller must find a substitute
 641      */
 642     // MACOSX begin -- need to access this in subclass
 643     protected PhysicalFont addToFontList(PhysicalFont f, int rank) {
 644     // MACOSX end
 645 
 646         String fontName = f.fullName;
 647         String familyName = f.familyName;
 648         if (fontName == null || "".equals(fontName)) {
 649             return null;
 650         }
 651         if (compositeFonts.containsKey(fontName)) {
 652             /* Don't register any font that has the same name as a composite */
 653             return null;
 654         }
 655         f.setRank(rank);
 656         if (!physicalFonts.containsKey(fontName)) {
 657             if (FontUtilities.isLogging()) {
 658                 FontUtilities.getLogger().info("Add to Family "+familyName +
 659                             ", Font " + fontName + " rank="+rank);
 660             }
 661             physicalFonts.put(fontName, f);
 662             FontFamily family = FontFamily.getFamily(familyName);
 663             if (family == null) {
 664                 family = new FontFamily(familyName, false, rank);
 665                 family.setFont(f, f.style);
 666             } else {
 667                 family.setFont(f, f.style);
 668             }




 628      * have and is good enough for the known cases.
 629      * Also don't want to register fonts that match JRE font families
 630      * but are coming from a source other than the JRE.
 631      * This will ensure that we will algorithmically style the JRE
 632      * plain font and get the same set of glyphs for all styles.
 633      *
 634      * Note that this method returns a value
 635      * if it returns the same object as its argument that means this
 636      * font was newly registered.
 637      * If it returns a different object it means this font already exists,
 638      * and you should use that one.
 639      * If it returns null means this font was not registered and none
 640      * in that name is registered. The caller must find a substitute
 641      */
 642     // MACOSX begin -- need to access this in subclass
 643     protected PhysicalFont addToFontList(PhysicalFont f, int rank) {
 644     // MACOSX end
 645 
 646         String fontName = f.fullName;
 647         String familyName = f.familyName;
 648         if (fontName == null || fontName.isEmpty()) {
 649             return null;
 650         }
 651         if (compositeFonts.containsKey(fontName)) {
 652             /* Don't register any font that has the same name as a composite */
 653             return null;
 654         }
 655         f.setRank(rank);
 656         if (!physicalFonts.containsKey(fontName)) {
 657             if (FontUtilities.isLogging()) {
 658                 FontUtilities.getLogger().info("Add to Family "+familyName +
 659                             ", Font " + fontName + " rank="+rank);
 660             }
 661             physicalFonts.put(fontName, f);
 662             FontFamily family = FontFamily.getFamily(familyName);
 663             if (family == null) {
 664                 family = new FontFamily(familyName, false, rank);
 665                 family.setFont(f, f.style);
 666             } else {
 667                 family.setFont(f, f.style);
 668             }


< prev index next >