Пример #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;
 }
 public void SetFontNotFoundHandler(FontNotFoundHandler handler)
 {
     fontNotFoundHandler = handler;
 }