/// <summary> /// Load font /// </summary> /// <param name="face">Font name</param> /// <param name="size">Font size</param> /// <param name="bold">Bold flag</param> /// <param name="italic">Italic flag</param> /// <returns>Loaded font</returns> 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 (fonts.TryGetValue(key, out ret)) return ret; // fail with cache, so create new and store into cache ret = new HtmlFont(face, size, bold, italic); fonts[key] = ret; return ret; }
/// <summary> /// Load font /// </summary> /// <param name="face">Font name</param> /// <param name="size">Font size</param> /// <param name="bold">Bold flag</param> /// <param name="italic">Italic flag</param> /// <returns>Loaded font</returns> 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 (fonts.TryGetValue(key, out ret)) { return(ret); } // fail with cache, so create new and store into cache ret = new HtmlFont(face, size, bold, italic); fonts[key] = ret; return(ret); }