src/share/classes/sun/font/GlyphList.java

Print this page




 131      * from the right FontInfo. Its also needed by the code which
 132      * calculates glyph positions which already needs to access this
 133      * GlyphList and would otherwise need the FontInfo.
 134      * This is true only if LCD text and fractional metrics hints
 135      * are selected on the graphics.
 136      * When this is true and the glyph positions as determined by the
 137      * advances are non-integral, it requests adjustment of the positions.
 138      * Setting this for surfaces which do not support it through accelerated
 139      * loops may cause a slow-down as software loops are invoked instead.
 140      */
 141     boolean lcdSubPixPos;
 142 
 143     /* This scheme creates a singleton GlyphList which is checked out
 144      * for use. Callers who find its checked out create one that after use
 145      * is discarded. This means that in a MT-rendering environment,
 146      * there's no need to synchronise except for that one instance.
 147      * Fewer threads will then need to synchronise, perhaps helping
 148      * throughput on a MP system. If for some reason the reusable
 149      * GlyphList is checked out for a long time (or never returned?) then
 150      * we would end up always creating new ones. That situation should not
 151      * occur and if if did, it would just lead to some extra garbage being
 152      * created.
 153      */
 154     private static GlyphList reusableGL = new GlyphList();
 155     private static boolean inUse;
 156 
 157 
 158     void ensureCapacity(int len) {
 159       /* Note len must not be -ve! only setFromChars should be capable
 160        * of passing down a -ve len, and this guards against it.
 161        */
 162         if (len < 0) {
 163           len = 0;
 164         }
 165         if (usePositions && len > maxPosLen) {
 166             positions = new float[len * 2 + 2];
 167             maxPosLen = len;
 168         }
 169 
 170         if (maxLen == 0 || len > maxLen) {
 171             glyphData = new int[len];




 131      * from the right FontInfo. Its also needed by the code which
 132      * calculates glyph positions which already needs to access this
 133      * GlyphList and would otherwise need the FontInfo.
 134      * This is true only if LCD text and fractional metrics hints
 135      * are selected on the graphics.
 136      * When this is true and the glyph positions as determined by the
 137      * advances are non-integral, it requests adjustment of the positions.
 138      * Setting this for surfaces which do not support it through accelerated
 139      * loops may cause a slow-down as software loops are invoked instead.
 140      */
 141     boolean lcdSubPixPos;
 142 
 143     /* This scheme creates a singleton GlyphList which is checked out
 144      * for use. Callers who find its checked out create one that after use
 145      * is discarded. This means that in a MT-rendering environment,
 146      * there's no need to synchronise except for that one instance.
 147      * Fewer threads will then need to synchronise, perhaps helping
 148      * throughput on a MP system. If for some reason the reusable
 149      * GlyphList is checked out for a long time (or never returned?) then
 150      * we would end up always creating new ones. That situation should not
 151      * occur and if it did, it would just lead to some extra garbage being
 152      * created.
 153      */
 154     private static GlyphList reusableGL = new GlyphList();
 155     private static boolean inUse;
 156 
 157 
 158     void ensureCapacity(int len) {
 159       /* Note len must not be -ve! only setFromChars should be capable
 160        * of passing down a -ve len, and this guards against it.
 161        */
 162         if (len < 0) {
 163           len = 0;
 164         }
 165         if (usePositions && len > maxPosLen) {
 166             positions = new float[len * 2 + 2];
 167             maxPosLen = len;
 168         }
 169 
 170         if (maxLen == 0 || len > maxLen) {
 171             glyphData = new int[len];