public GdiPathFont(GdiPathFontFace fontface, int emSizeInPoints)
        {
            this.fontface       = fontface;
            this.emSizeInPoints = emSizeInPoints;
            //--------------------------------------
            emSizeInPixels = (int)(((float)emSizeInPoints / (float)POINTS_PER_INCH) * (float)PIXEL_PER_INCH);
            //currentEmScalling = (float)emSizeInPixels / (float)fontface.UnitsPerEm;

            //-----------------
            //implementation
            gdiFont = new System.Drawing.Font(fontface.FaceName, emSizeInPoints);
        }
Example #2
0
        public static Font LoadFont(string filename, int fontPointSize)
        {
            //load font from specific file
            GdiPathFontFace fontFace;

            if (!fontFaces.TryGetValue(filename, out fontFace))
            {
                //create new font face
                fontFace = new GdiPathFontFace(filename);
                fontFaces.Add(filename, fontFace);
            }
            if (fontFace == null)
            {
                return(null);
            }
            return(fontFace.GetFontAtSpecificSize(fontPointSize));
        }