Ejemplo n.º 1
0
        public override bool LoadFont(Font font)
        {
            Debug.Print(String.Format("LoadFont {0}", font.FaceName));
            font.RealSize = font.Size * Scale;

            // we check if this font is already loaded, if so we dispose it first
            QFont sysQFont = font.RendererData as QFont;

            if (sysQFont != null)
            {
                sysQFont.Dispose();
            }

            // get font style from the name
            var n     = font.FaceName.Split('|');
            var style = FontStyle.Regular;

            if (n.Length == 2)
            {
                style = FontStyle.TryParse(n[1], true, out style) == true ? style : FontStyle.Regular;
            }
            // now load the font - note this can fail (I think) if the font is not found
            sysQFont = new QFont(n[0], font.Size, new QFontBuilderConfiguration()
            {
                Characters = CharacterSet.General
            }, style);
            font.RendererData = sysQFont;
            return(true);

            //Debug.Print(String.Format("LoadFont {0}", font.FaceName));
            //font.RealSize = font.Size * Scale;
            //System.Drawing.Font sysFont = font.RendererData as System.Drawing.Font;
        }