Esempio n. 1
0
        public string GetPdfFont(StyleInfo si)
        {
            string face = FontNameNormalize(si.FontFamily);

            if (face == "Times-Roman")
            {
                if (si.IsFontBold() && si.FontStyle == FontStyleEnum.Italic)
                {
                    face = "Times-BoldItalic";
                }
                else if (si.IsFontBold())
                {
                    face = "Times-Bold";
                }
                else if (si.FontStyle == FontStyleEnum.Italic)
                {
                    face = "Times-Italic";
                }
            }
            else if (si.IsFontBold() &&
                     si.FontStyle == FontStyleEnum.Italic)              // bold and italic?
            {
                face = face + "-BoldOblique";
            }
            else if (si.IsFontBold())                                   // just bold?
            {
                face = face + "-Bold";
            }
            else if (si.FontStyle == FontStyleEnum.Italic)
            {
                face = face + "-Oblique";
            }

            return(GetPdfFont(face));
        }
Esempio n. 2
0
        private void DoStyle(Style style, Row row)
        {
            if (style == null)
            {
                return;
            }

            StyleInfo si = style.GetStyleInfo(r, row);

//            tw.Write(@"\plain");        // reset current attributes

            // Handle the font
            if (!_Fonts.Contains(si.FontFamily))
            {
                _Fonts.Add(si.FontFamily);
            }
            int fc = _Fonts.IndexOf(si.FontFamily);

            tw.Write(@"\f{0} ", fc);

            if (si.IsFontBold())
            {
                tw.Write(@"\b");
            }
            if (si.FontStyle == FontStyleEnum.Italic)
            {
                tw.Write(@"\i");
            }
            switch (si.TextDecoration)
            {
            case TextDecorationEnum.Underline:
                tw.Write(@"\ul");
                break;

            case TextDecorationEnum.LineThrough:
                tw.Write(@"\strike");
                break;

            default:
                break;
            }

            tw.Write(@"\fs{0}", (int)Math.Round(si.FontSize * 2, 0));        // font size

            // Handle the color
            int ic;

            if (!_Colors.Contains(si.Color))
            {
                _Colors.Add(si.Color);
            }
            ic = _Colors.IndexOf(si.Color) + 1;

            tw.Write(@"\cf{0} ", ic);
        }
Esempio n. 3
0
		public string GetPdfFont(StyleInfo si)
		{
			string face = FontNameNormalize(si.FontFamily);
            if (face == "Times-Roman")
            {
                if (si.IsFontBold() && si.FontStyle == FontStyleEnum.Italic)
                    face = "Times-BoldItalic";
                else if (si.IsFontBold())
                    face = "Times-Bold";
                else if (si.FontStyle == FontStyleEnum.Italic)
                    face = "Times-Italic";
            }
			else if (si.IsFontBold() && 
				si.FontStyle == FontStyleEnum.Italic)	// bold and italic?
				face = face + "-BoldOblique";
			else if (si.IsFontBold())			// just bold?
				face = face + "-Bold";
			else if (si.FontStyle == FontStyleEnum.Italic)
				face = face + "-Oblique";

			return GetPdfFont(face);
		}