Example #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));
                }
            };
        }
Example #2
0
 public OpenFontIFonts()
 {
     typefaceStore = new TypefaceStore();
     typefaceStore.FontCollection = InstalledFontCollection.GetSharedFontCollection(null);
     glyphLayout            = new GlyphLayout(); //create glyph layout with default value
     userGlyphPlanList      = new GlyphPlanList();
     userCharToGlyphMapList = new List <UserCharToGlyphIndexMap>();
 }
Example #3
0
        public OpenFontIFonts(IFontLoader fontloader)
        {
            this._fontloader             = fontloader;
            typefaceStore                = new TypefaceStore();
            typefaceStore.FontCollection = InstalledFontCollection.GetSharedFontCollection(null);
            glyphLayout = new GlyphLayout();

            glyphLayout.ScriptLang        = Typography.OpenFont.ScriptLangs.Thai;//test conplex script
            glyphLayout.PositionTechnique = PositionTechnique.OpenFont;
            //assign fitting engine


            //
            userGlyphPlanList      = new List <GlyphPlan>();
            userCharToGlyphMapList = new List <UserCharToGlyphIndexMap>();
        }