124 return new RectBounds(bb[0], bb[1], bb[2], bb[3]); 125 } 126 127 @Override protected int[] createGlyphBoundingBox(int gc) { 128 if (fontFace == null) return null; 129 DWRITE_GLYPH_METRICS metrics = fontFace.GetDesignGlyphMetrics((short)gc, false); 130 if (metrics == null) return null; 131 int[] bb = new int[4]; 132 bb[0] = metrics.leftSideBearing; 133 bb[1] = metrics.verticalOriginY - metrics.advanceHeight + metrics.bottomSideBearing; 134 bb[2] = metrics.advanceWidth - metrics.rightSideBearing; 135 bb[3] = metrics.verticalOriginY - metrics.topSideBearing; 136 return bb; 137 } 138 139 @Override 140 protected PrismFontStrike<DWFontFile> createStrike(float size, BaseTransform transform, 141 int aaMode, FontStrikeDesc desc) { 142 return new DWFontStrike(this, size, transform, aaMode, desc); 143 } 144 } | 124 return new RectBounds(bb[0], bb[1], bb[2], bb[3]); 125 } 126 127 @Override protected int[] createGlyphBoundingBox(int gc) { 128 if (fontFace == null) return null; 129 DWRITE_GLYPH_METRICS metrics = fontFace.GetDesignGlyphMetrics((short)gc, false); 130 if (metrics == null) return null; 131 int[] bb = new int[4]; 132 bb[0] = metrics.leftSideBearing; 133 bb[1] = metrics.verticalOriginY - metrics.advanceHeight + metrics.bottomSideBearing; 134 bb[2] = metrics.advanceWidth - metrics.rightSideBearing; 135 bb[3] = metrics.verticalOriginY - metrics.topSideBearing; 136 return bb; 137 } 138 139 @Override 140 protected PrismFontStrike<DWFontFile> createStrike(float size, BaseTransform transform, 141 int aaMode, FontStrikeDesc desc) { 142 return new DWFontStrike(this, size, transform, aaMode, desc); 143 } 144 145 /* This is called only for fonts where a temp file was created 146 */ 147 @Override 148 protected synchronized void disposeOnShutdown() { 149 if (fontFace != null) { 150 //If this isn't done, Windows won't delete the file, since 151 // DW will have it open. 152 fontFace.Release(); 153 if (PrismFontFactory.debugFonts) { 154 System.err.println("fontFace freed: " + fontFace); 155 } 156 fontFace = null; 157 } 158 super.disposeOnShutdown(); // deletes the file. 159 } 160 } |