コード例 #1
0
ファイル: NGUIDevice.cs プロジェクト: fengqk/Art
 /// <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>
 /// <param name="spacingX">Horizontal space</param>
 /// <param name="spacingY">Vertical space</param>
 /// <returns>Loaded font</returns>
 public override HtFont LoadFont(string face, int size, bool bold, bool italic, int spacingX, int spacingY) {
   // try get from cache
   string key = string.Format("{0}{1}{2}{3}sx{4}sy{5}", face, size, bold ? "b" : "", italic ? "i" : "", spacingX, spacingY);
   HtFont ret;
   if (fonts.TryGetValue(key, out ret)) return ret;
   // fail with cache, so create new and store into cache
   ret = new NGUIFont(face, size, bold, italic, spacingX, spacingY);
   fonts[key] = ret;
   return ret;
 }
コード例 #2
0
        /// <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" : "");
            NGUIFont ret;

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