Example #1
0
        public void AppendFontToLib(string benchmarkStr, Font font)
        {
            int len = benchmarkStr.Length;

            for (int i = 0; i < len; i++)
            {
                char    v       = benchmarkStr[i];
                StdFont stdfont = new StdFont(v);
                stdfont.BuildData(font);
                Dictionary <Font, AbstractFont> fontInstanceMap;
                if (FontMap.TryGetValue(v, out fontInstanceMap))
                {
                    //字符存在
                    fontInstanceMap[font] = stdfont;
                }
                else
                {
                    //新字符
                    fontInstanceMap       = new Dictionary <Font, AbstractFont>();
                    fontInstanceMap[font] = stdfont;
                    FontMap[v]            = fontInstanceMap;
                }
            }
            RaiseFontLibChangedEvent();
        }
Example #2
0
        public void AppendFontToLib(string benchmarkStr, Font font, ref Dictionary <char, Dictionary <Font, AbstractFont> > fontmap)
        {
            int len = benchmarkStr.Length;

            for (int i = 0; i < len; i++)
            {
                char    v       = benchmarkStr[i];
                StdFont stdfont = new StdFont(v);
                bool    succ    = stdfont.BuildData(font);
                if (!succ)
                {
                    return;
                }
                //Console.WriteLine(stdfont.FontName+"   "+stdfont.RealData);
                Dictionary <Font, AbstractFont> fontInstanceMap;
                if (fontmap.TryGetValue(v, out fontInstanceMap))
                {
                    //字符存在
                    fontInstanceMap[font] = stdfont;
                }
                else
                {
                    //新字符
                    fontInstanceMap       = new Dictionary <Font, AbstractFont>();
                    fontInstanceMap[font] = stdfont;
                    fontmap[v]            = fontInstanceMap;
                }
            }
        }