public override ActualFont GetFontAtPointSize(float fontPointSize) { currentFacePixelSize = (int)RequestFont.ConvEmSizeInPointsToPixels(fontPointSize); //---------------------------------- //set current fontface size NativeMyFontsLib.MyFtSetPixelSizes(this.ftFaceHandle, currentFacePixelSize); //create font size return(new NativeFont(this, this.name, FontStyle.Regular, currentFacePixelSize)); }
//internal NativeFont GetFontAtPixelSize(int pixelSize) //{ // NativeFont found; // if (!fonts.TryGetValue(pixelSize, out found)) // { // //---------------------------------- // //set current fontface size // currentFacePixelSize = pixelSize; // NativeMyFontsLib.MyFtSetPixelSizes(this.ftFaceHandle, pixelSize); // //create font size // NativeFont f = new NativeFont(this, this.name, FontStyle.Regular, pixelSize); // fonts.Add(pixelSize, f); // //------------------------------------ // return f; // } // return found; //} //internal NativeFont GetFontAtPointSize(float fontPointSize) //{ // //convert from point size to pixelsize *** // NativeFont nativeFont = GetFontAtPixelSize((int)RequestFont.ConvEmSizeInPointsToPixels(fontPointSize)); // return nativeFont; //} internal FontGlyph ReloadGlyphFromIndex(uint glyphIndex, int pixelSize) { if (currentFacePixelSize != pixelSize) { currentFacePixelSize = pixelSize; NativeMyFontsLib.MyFtSetPixelSizes(this.ftFaceHandle, pixelSize); } //-------------------------------------------------- var fontGlyph = new NativeFontGlyph(); NativeGlyphMatrix nativeGlyphMatrix; NativeMyFontsLib.MyFtLoadGlyph(ftFaceHandle, glyphIndex, out nativeGlyphMatrix); fontGlyph.glyphMatrix = nativeGlyphMatrix.matrixData; BuildOutlineGlyph(fontGlyph, pixelSize); return(fontGlyph); }
internal FontGlyph ReloadGlyphFromChar(char unicodeChar, int pixelSize) { if (currentFacePixelSize != pixelSize) { currentFacePixelSize = pixelSize; NativeMyFontsLib.MyFtSetPixelSizes(this.ftFaceHandle, pixelSize); } //-------------------------------------------------- var fontGlyph = new NativeFontGlyph(); NativeGlyphMatrix nativeGlyphMatrix; NativeMyFontsLib.MyFtLoadChar(ftFaceHandle, unicodeChar, out nativeGlyphMatrix); fontGlyph.glyphMatrix = nativeGlyphMatrix.matrixData; fontGlyph.nativeBmpPtr = nativeGlyphMatrix.bitmap; fontGlyph.nativeOutlinePtr = nativeGlyphMatrix.outline; //-------------------------------------------------- BuildOutlineGlyph(fontGlyph, pixelSize); return(fontGlyph); }