示例#1
0
 public override HtFont LoadFont(string face, int size, bool bold, bool italic)
 {
     // try get from cache
     string key = string.Format("{0}{1}{2}{3}", face, size, bold ? "b" : "", italic ? "i" : "");
     HtmlFont ret;
     if (this.fonts.TryGetValue(key, out ret)) return ret;
     // fail with cache, so create new and store into cache
     ret = new HtmlFont(face, size, bold, italic);
     this.fonts[key] = ret;
     return ret;
 }
示例#2
0
        public override HtFont LoadFont(string face, int size, bool bold, bool italic)
        {
            // try get from cache
            string   key = string.Format("{0}{1}{2}{3}", face, size, bold ? "b" : "", italic ? "i" : "");
            HtmlFont ret;

            if (this.fonts.TryGetValue(key, out ret))
            {
                return(ret);
            }
            // fail with cache, so create new and store into cache
            ret             = new HtmlFont(face, size, bold, italic);
            this.fonts[key] = ret;
            return(ret);
        }