コード例 #1
0
        public OpenFontStore()
        {
            installFontCollection = InstalledFontCollection.GetSharedFontCollection(fontCollection =>
            {
                fontCollection.SetFontNameDuplicatedHandler((f0, f1) => FontNameDuplicatedDecision.Skip);
                fontCollection.LoadSystemFonts();
            });


            _defaultFontNotFoundHandler = (fontCollection, fontName, subfamName, style) =>
            {
                //TODO: implement font not found mapping here
                //_fontsMapping["monospace"] = "Courier New";
                //_fontsMapping["Helvetica"] = "Arial";
                fontName = fontName.ToUpper();
                switch (fontName)
                {
                case "MONOSPACE":
                    return(fontCollection.GetFont("Courier New", style));

                case "HELVETICA":
                    return(fontCollection.GetFont("Arial", style));

                case "TAHOMA":
                    //default font must found
                    //if not throw err
                    //this prevent infinit loop
                    throw new System.NotSupportedException();

                default:
                    return(fontCollection.GetFont("tahoma", style));
                }
            };
        }
コード例 #2
0
 public void SetFontNotFoundHandler(FontNotFoundHandler fontNotFoundHandler)
 {
     this.fontNotFoundHandler = fontNotFoundHandler;
 }
コード例 #3
0
 public void SetFontNotFoundHandler(FontNotFoundHandler fontNotFoundHandler)
 {
     installFontCollection.SetFontNotFoundHandler(fontNotFoundHandler);
 }
コード例 #4
0
 public static void SetFontNotFoundHandler(FontNotFoundHandler fontNotFoundHandler)
 {
     s_installFontCollection.SetFontNotFoundHandler(fontNotFoundHandler);
 }
コード例 #5
0
 public void SetFontNotFoundHandler(FontNotFoundHandler handler)
 {
     fontNotFoundHandler = handler;
 }
コード例 #6
0
 public void SetFontNotFoundHandler(FontNotFoundHandler handler)
 {
     fontNotFoundHandler = handler;
 }