Exemple #1
0
 public void SetFonts(string familyLatn, float sz)
 {
     fntSimpA = FontPool.GetFont(IdeoFont.ArphicKai, SimpTradFont.Simp, sz, FontStyle.Regular);
     fntTradA = FontPool.GetFont(IdeoFont.ArphicKai, SimpTradFont.Trad, sz, FontStyle.Regular);
     //fntSimpN = FontPool.GetFont(IdeoFont.Noto, SimpTradFont.Simp, sz, FontStyle.Regular);
     //fntTradN = FontPool.GetFont(IdeoFont.Noto, SimpTradFont.Trad, sz, FontStyle.Regular);
     fntSimpN = FontPool.GetFont(IdeoFont.WinKai, SimpTradFont.Simp, sz, FontStyle.Regular);
     fntTradN = FontPool.GetFont(IdeoFont.WinKai, SimpTradFont.Trad, sz, FontStyle.Regular);
     fntLatn  = new Font(familyLatn, sz / 1.3F, FontStyle.Regular);
     Invalidate();
 }
Exemple #2
0
 public void SetFonts(string familyLatn, float sz)
 {
     fntSimpA = FontPool.GetFont(IdeoFont.ArphicKai, SimpTradFont.Simp, sz, FontStyle.Regular);
     fntTradA = FontPool.GetFont(IdeoFont.ArphicKai, SimpTradFont.Trad, sz, FontStyle.Regular);
     //fntSimpN = FontPool.GetFont(IdeoFont.Noto, SimpTradFont.Simp, sz, FontStyle.Regular);
     //fntTradN = FontPool.GetFont(IdeoFont.Noto, SimpTradFont.Trad, sz, FontStyle.Regular);
     fntSimpN = FontPool.GetFont(IdeoFont.WinKai, SimpTradFont.Simp, sz, FontStyle.Regular);
     fntTradN = FontPool.GetFont(IdeoFont.WinKai, SimpTradFont.Trad, sz, FontStyle.Regular);
     fntLatn = new Font(familyLatn, sz / 1.3F, FontStyle.Regular);
     Invalidate();
 }
Exemple #3
0
        private void drawHanzi(Graphics g, string txt, FontTray ft, PointF pt, Brush b, StringFormat sf)
        {
            float x = pt.X;
            float y = pt.Y + ft.VertOfs;

            for (int i = 0; i != txt.Length; ++i)
            {
                string chr = txt.Substring(i, 1);
                g.DrawString(chr, ft.Font, b, new PointF(x + ft.HorizOfs, y), sf);
                x += ft.DisplayWidth;
            }
        }
Exemple #4
0
        /// <summary>
        /// Get a specific font.
        /// </summary>
        public static FontTray GetFont(IdeoFont ifont, SimpTradFont stfont, float size, FontStyle style)
        {
            if (scale == 0)
            {
                throw new InvalidOperationException("Cannot manufacture fonts until scale has been set.");
            }
            FontTray res    = null;
            float    height = size * 4F / 3F;

            height *= scale;

            if (ifont == IdeoFont.WinKai)
            {
                if (stfont == SimpTradFont.Simp)
                {
                    res = new FontTray(
                        new Font("KaiTi", size, style), 0, -0.05F,
                        height * 0.9F, height);
                }
                else
                {
                    res = new FontTray(
                        new Font("DFKai-SB", size, style), 0, -0.05F,
                        height * 0.9F, height);
                }
                return(res);
            }

            foreach (FontFamily ff in fonts.Families)
            {
                if (ifont == IdeoFont.ArphicKai && stfont == SimpTradFont.Trad && ff.Name == "AR PL UKai TW")
                {
                    res = new FontTray(
                        new Font(ff, size, style), -0.08798828125F * height, -0.05F,
                        height * 0.9F, height);
                }
                else if (ifont == IdeoFont.ArphicKai && stfont == SimpTradFont.Simp && ff.Name == "䡡湄楮札䍓ⵆ潮瑳")
                {
                    res = new FontTray(
                        new Font(ff, size, style), 0, -0.05F,
                        height * 0.9F, height);
                }
                else if (ifont == IdeoFont.Noto && stfont == SimpTradFont.Trad && ff.Name == "Noto Sans T Chinese Light")
                {
                    res = new FontTray(
                        new Font(ff, size * 0.85F, style), height * 0.075F, height * 0.025F,
                        height * 0.9F, height);
                }
                else if (ifont == IdeoFont.Noto && stfont == SimpTradFont.Simp && ff.Name == "Noto Sans S Chinese Regular")
                {
                    res = new FontTray(
                        new Font(ff, size * 0.85F, style), height * 0.075F, height * 0.025F,
                        height * 0.9F, height);
                }
                if (res != null)
                {
                    break;
                }
            }
            return(res);
        }
Exemple #5
0
 private void drawHanzi(Graphics g, string txt, FontTray ft, PointF pt, Brush b, StringFormat sf)
 {
     float x = pt.X;
     float y = pt.Y + ft.VertOfs;
     for (int i = 0; i != txt.Length; ++i)
     {
         string chr = txt.Substring(i, 1);
         g.DrawString(chr, ft.Font, b, new PointF(x + ft.HorizOfs, y), sf);
         x += ft.DisplayWidth;
     }
 }
Exemple #6
0
        /// <summary>
        /// Get a specific font.
        /// </summary>
        public static FontTray GetFont(IdeoFont ifont, SimpTradFont stfont, float size, FontStyle style)
        {
            if (scale == 0) throw new InvalidOperationException("Cannot manufacture fonts until scale has been set.");
            FontTray res = null;
            float height = size * 4F / 3F;
            height *= scale;

            if (ifont == IdeoFont.WinKai)
            {
                if (stfont == SimpTradFont.Simp)
                    res = new FontTray(
                        new Font("KaiTi", size, style), 0, -0.05F,
                        height * 0.9F, height);
                else res = new FontTray(
                     new Font("DFKai-SB", size, style), 0, -0.05F,
                     height * 0.9F, height);
                return res;
            }

            foreach (FontFamily ff in fonts.Families)
            {
                if (ifont == IdeoFont.ArphicKai && stfont == SimpTradFont.Trad && ff.Name == "AR PL UKai TW")
                    res = new FontTray(
                        new Font(ff, size, style), -0.08798828125F * height, -0.05F,
                        height * 0.9F, height);
                else if (ifont == IdeoFont.ArphicKai && stfont == SimpTradFont.Simp && ff.Name == "䡡湄楮札䍓ⵆ潮瑳")
                    res = new FontTray(
                        new Font(ff, size, style), 0, -0.05F,
                        height * 0.9F, height);
                else if (ifont == IdeoFont.Noto && stfont == SimpTradFont.Trad && ff.Name == "Noto Sans T Chinese Light")
                    res = new FontTray(
                        new Font(ff, size * 0.85F, style), height * 0.075F, height * 0.025F,
                        height * 0.9F, height);
                else if (ifont == IdeoFont.Noto && stfont == SimpTradFont.Simp && ff.Name == "Noto Sans S Chinese Regular")
                    res = new FontTray(
                        new Font(ff, size * 0.85F, style), height * 0.075F, height * 0.025F,
                        height * 0.9F, height);
                if (res != null) break;
            }
            return res;
        }