Example #1
0
 public static Font get(Style style)
 {
     Font font;
     if (!fontCache.TryGetValue(uidOf(style), out font))
     {
         fontCache[uidOf(style)] = font = createFont(style);
     }
     return font;
 }
Example #2
0
        protected Document()
        {
            rows = new DocumentRowCollection();

            style = new Style();

            style.FontName = Control.DefaultFont.Name;
            style.FontHeight = Control.DefaultFont.SizeInPoints;
            style.Foreground = Color.Black;
            style.Background = Color.White;
        }
Example #3
0
        public virtual Style combine(Style style)
        {
            Style result = new Style();

            result.fontHeight = fontHeight;
            result.fontName = fontName;
            result.foreground = foreground;
            result.background = background;

            if (style.fontName != null)
                result.fontName = style.fontName;
            if (style.fontHeight > 0)
                result.fontHeight = style.fontHeight;
            if (!style.foreground.IsEmpty)
                result.foreground = style.foreground;
            if (!style.background.IsEmpty)
                result.background = style.background;

            result.fontStyle |= style.fontStyle;

            return result;
        }
Example #4
0
 private static string uidOf(Style style)
 {
     return style.FontName + ", "
         + style.FontHeight + "pt, "
         + style.FontStyle;
 }
Example #5
0
 private static Font createFont(Style style)
 {
     return new Font(style.FontName, style.FontHeight, style.FontStyle);
 }
Example #6
0
 public static Brush getForeground(Style style)
 {
     return getSolid(style.Foreground);
 }