< prev index next >

modules/javafx.graphics/src/main/java/com/sun/javafx/font/directwrite/DWFontFile.java

Print this page




 101                                  OS.DWRITE_FONT_STYLE_NORMAL;
 102         IDWriteFont font = family.GetFirstMatchingFont(weight, stretch, style);
 103         family.Release();
 104         if (font == null) return null;
 105         IDWriteFontFace face = font.CreateFontFace();
 106         font.Release();
 107         return face;
 108     }
 109 
 110     IDWriteFontFace getFontFace() {
 111         return fontFace;
 112     }
 113 
 114     Path2D getGlyphOutline(int gc, float size) {
 115         if (fontFace == null) return null;
 116         if (size == 0) return new Path2D();
 117         return fontFace.GetGlyphRunOutline(size, (short)gc, false);
 118     }
 119 
 120     RectBounds getBBox(int glyphCode, float size) {
 121         /* In coretext and t2k this is the bounds for the path of the glyph */
 122         float[] bb = new float[4];
 123         getGlyphBoundingBox(glyphCode, size, bb);
 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) {




 101                                  OS.DWRITE_FONT_STYLE_NORMAL;
 102         IDWriteFont font = family.GetFirstMatchingFont(weight, stretch, style);
 103         family.Release();
 104         if (font == null) return null;
 105         IDWriteFontFace face = font.CreateFontFace();
 106         font.Release();
 107         return face;
 108     }
 109 
 110     IDWriteFontFace getFontFace() {
 111         return fontFace;
 112     }
 113 
 114     Path2D getGlyphOutline(int gc, float size) {
 115         if (fontFace == null) return null;
 116         if (size == 0) return new Path2D();
 117         return fontFace.GetGlyphRunOutline(size, (short)gc, false);
 118     }
 119 
 120     RectBounds getBBox(int glyphCode, float size) {
 121         /* In coretext this is the bounds for the path of the glyph */
 122         float[] bb = new float[4];
 123         getGlyphBoundingBox(glyphCode, size, bb);
 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) {


< prev index next >