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

Print this page




 132              * takes place at the same time as parsing the family name.
 133              * Do I really have to parse the style from the name?
 134              * Need to look into having the caller provide this. */
 135             if (index+1 < fullName.length()) {
 136                 String styleStr = fullName.substring(index+1);
 137                 if ("plain".equals(styleStr)) {
 138                     style = Font.PLAIN;
 139                 } else if ("bold".equals(styleStr)) {
 140                     style = Font.BOLD;
 141                 } else if ("italic".equals(styleStr)) {
 142                     style = Font.ITALIC;
 143                 } else if ("bolditalic".equals(styleStr)) {
 144                     style = Font.BOLD | Font.ITALIC;
 145                 }
 146             }
 147         } else {
 148             familyName = fullName;
 149         }
 150     }
 151 



















 152     /* This method is currently intended to be called only from
 153      * FontManager.getCompositeFontUIResource(Font)
 154      * It creates a new CompositeFont with the contents of the Physical
 155      * one pre-pended as slot 0.
 156      */
 157     CompositeFont(PhysicalFont physFont, CompositeFont compFont) {
 158 
 159         isStdComposite = false;
 160         handle = new Font2DHandle(this);
 161         fullName = physFont.fullName;
 162         familyName = physFont.familyName;
 163         style = physFont.style;
 164 
 165         numMetricsSlots = 1; /* Only the physical Font */
 166         numSlots = compFont.numSlots+1;
 167 
 168         /* Ugly though it is, we synchronize here on the FontManager class
 169          * because it is the lock used to do deferred initialisation.
 170          * We need to ensure that the arrays have consistent information.
 171          * But it may be possible to dispense with the synchronisation if




 132              * takes place at the same time as parsing the family name.
 133              * Do I really have to parse the style from the name?
 134              * Need to look into having the caller provide this. */
 135             if (index+1 < fullName.length()) {
 136                 String styleStr = fullName.substring(index+1);
 137                 if ("plain".equals(styleStr)) {
 138                     style = Font.PLAIN;
 139                 } else if ("bold".equals(styleStr)) {
 140                     style = Font.BOLD;
 141                 } else if ("italic".equals(styleStr)) {
 142                     style = Font.ITALIC;
 143                 } else if ("bolditalic".equals(styleStr)) {
 144                     style = Font.BOLD | Font.ITALIC;
 145                 }
 146             }
 147         } else {
 148             familyName = fullName;
 149         }
 150     }
 151 
 152     /*
 153      * Build a composite from a set of individual slot fonts.
 154      */
 155     CompositeFont(PhysicalFont[] slotFonts) {
 156 
 157         isStdComposite = false;
 158         handle = new Font2DHandle(this);
 159         fullName = slotFonts[0].fullName;
 160         familyName = slotFonts[0].familyName;
 161         style = slotFonts[0].style;
 162 
 163         numMetricsSlots = 1; /* Only the physical Font */
 164         numSlots = slotFonts.length;
 165 
 166         components = new PhysicalFont[numSlots];
 167         System.arraycopy(slotFonts, 0, components, 0, numSlots);
 168         deferredInitialisation = new boolean[numSlots]; // all false.
 169     }
 170 
 171     /* This method is currently intended to be called only from
 172      * FontManager.getCompositeFontUIResource(Font)
 173      * It creates a new CompositeFont with the contents of the Physical
 174      * one pre-pended as slot 0.
 175      */
 176     CompositeFont(PhysicalFont physFont, CompositeFont compFont) {
 177 
 178         isStdComposite = false;
 179         handle = new Font2DHandle(this);
 180         fullName = physFont.fullName;
 181         familyName = physFont.familyName;
 182         style = physFont.style;
 183 
 184         numMetricsSlots = 1; /* Only the physical Font */
 185         numSlots = compFont.numSlots+1;
 186 
 187         /* Ugly though it is, we synchronize here on the FontManager class
 188          * because it is the lock used to do deferred initialisation.
 189          * We need to ensure that the arrays have consistent information.
 190          * But it may be possible to dispense with the synchronisation if