예제 #1
0
        private void RenderTextLayout(TextLayout layout, Page page)
        {
            if (layout == null)
            {
                return;
            }

            TextStyle style = (TextStyle)layout.Style;

            if (style.BackColor != null)
            {
                page.AddPath(layout.Bounds.Points, 0, null, Convert.Color(style.BackColor));
            }

            //	Draw the border after the background so that the background doesn't
            //	overwrite the border. But draw the border before the content so that
            //	if for any reason the text exceeds the bounds (which should be impossible)
            //	then at least the text will still be visible.
            RenderBorder(layout.Bounds, style.Border, page);

            foreach (LineDraft line in layout.Lines)
            {
                foreach (StrokeDraft stroke in line.Strokes)
                {
                    string text = stroke.Stroke.Text;
                    int    x    = stroke.Position.X;
                    int    y    = stroke.Position.Y;
                    Demon.Report.Style.Font font  = stroke.Stroke.Format.Font;
                    Demon.PDF.Color         color = Convert.Color(stroke.Stroke.Format.Color);
                    page.AddText(text, x, y, font.FamilyName, font.Bold, font.Italic, font.Size, color);

                    if (font.Underline)
                    {
                        Demon.Font.Font strokeFont = _generator.GetFont(font);
                        int             lineY      = y + strokeFont.GetUnderlinePosition(font.Size);
                        float           thickness  = strokeFont.GetUnderlineThickness(font.Size);

                        List <Position> points = new List <Position>();
                        points.Add(new Position(x, lineY));
                        points.Add(new Position(x + stroke.Stroke.Width, lineY));

                        page.AddPath(points, thickness, color, null);
                    }
                }
            }
        }
예제 #2
0
        public void AddFont(Demon.Font.Font font)
        {
            //	In the report library, if a single font is used with variations such as
            //	bold and italic, that gives rise to two report font objects. But in such
            //	a case we only want a single Word font object, because we're only interested
            //	in the family name. (If we were to embed the fonts then I think we'd need
            //	to store the two fonts separately.)
            bool found = false;

            foreach (Font exists in _fonts)
            {
                if (exists.FamilyName == font.FamilyName)
                {
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                _fonts.Add(new Font(font));
            }
        }
예제 #3
0
 public void AddFont(Demon.Font.Font font)
 {
     _fontTable.AddFont(font);
 }
예제 #4
0
 public Font(Demon.Font.Font src)
 {
     _underlying = src;
 }
예제 #5
0
 public EmbeddedFont(string name, Demon.Font.Font src)
     : base(name)
 {
     _underlying = src;
 }