protected Style(Style s) { this.desc = new FontDesc(s.desc); this.Margin = new Box(s.Margin); this.Padding = new Box(s.Padding); this.Empty = s.Empty; this.Pre = s.Pre; }
public Stylesheet() { DefaultFont = new FontDesc("Times New Roman", 12, false, false, false); TagFont = new FontDesc("Verdana", 9, false, false, false); DefaultPadding = new Box(0, 0, 0, 15); BindStyles(new NameTable()); }
public void Cascade(FontDesc baseStyle) { if (this.Family == null || this.Family.Length == 0) { this.Family = baseStyle.Family; } if (this.Size == 0) { this.Size = baseStyle.Size; } this.bold.Cascade(baseStyle.bold); this.italic.Cascade(baseStyle.italic); this.underline.Cascade(baseStyle.underline); }
public void Bind(IGraphics gr, Stylesheet s) { stylesheet = s; FontDesc fd = desc; if (fd.Family == null) { fd = s.DefaultFont; } object fontHandle = gr.GetFontHandle(fd); gr.PushFont(fontHandle); fontAscent = gr.GetFontAscent(); fontHeight = gr.GetFontHeight(); gr.PopFont(); }
public override bool Equals(object obj) { FontDesc other = obj as FontDesc; if (other == null) { return(false); } if (!(Size == other.Size && Bold.Equals(other.Bold) && Italic.Equals(other.Italic) && Underline.Equals(other.Underline))) { return(false); } return(Family == null ? other.Family == null : Family.Equals(other.Family)); }
private Font CreateFont(FontDesc fd) { Font f=new Font(fd.Family, fd.Size, fd.Style); fontHandles[fd]=f; return f; }
public object GetFontHandle(FontDesc fd) { object ret=fontHandles[fd]; if ( ret == null ) ret=CreateFont(fd); return ret; }
public Stylesheet() { DefaultFont=new FontDesc("Times New Roman", 12, false, false, false); TagFont=new FontDesc("Verdana", 9, false, false, false); DefaultPadding=new Box(0, 0, 0, 15); BindStyles(new NameTable()); }
protected Style(Style s) { this.desc=new FontDesc(s.desc); this.Margin=new Box(s.Margin); this.Padding=new Box(s.Padding); this.Empty=s.Empty; this.Pre=s.Pre; }
public void Cascade(FontDesc baseStyle) { if ( this.Family == null || this.Family.Length == 0 ) this.Family=baseStyle.Family; if ( this.Size == 0 ) this.Size=baseStyle.Size; this.bold.Cascade(baseStyle.bold); this.italic.Cascade(baseStyle.italic); this.underline.Cascade(baseStyle.underline); }
public FontDesc(FontDesc o) : this(o.Family, o.Size, o.bold, o.italic, o.underline) { }
public void Cascade(Style baseStyle) { Padding.Cascade(baseStyle.Padding); Margin.Cascade(baseStyle.Margin); FontDesc.Cascade(baseStyle.FontDesc); }
public object GetFontHandle(FontDesc fd) { Win32Util.LOGFONT lf=new Win32Util.LOGFONT(); lf.lfFaceName=fd.Family; lf.lfHeight=fd.Size; lf.lfItalic=(byte) (fd.Style & FontStyle.Italic); if ( (fd.Style & FontStyle.Bold) == FontStyle.Bold ) lf.lfWeight=700; lf.lfItalic=(byte) (fd.Style & FontStyle.Underline); return Win32Util.CreateFont(lf); }
private static void Recurse(int depth, IGraphics gr, Rectangle rc) { object o; FontDesc fd; fd=new FontDesc("Arial", 10, false, false, false); o=gr.GetFontHandle(fd); gr.PushFont(o); gr.MeasureText("my name is alfie"); gr.DrawText(rc, 20, "hello", Color.Black, Color.White, -1, -1); fd=new FontDesc("Times New Roman", 10, false, false, false); o=gr.GetFontHandle(fd); gr.PushFont(o); gr.MeasureText("my name is alfie"); fd=new FontDesc("Arial", 10, false, false, false); o=gr.GetFontHandle(fd); gr.PushFont(o); gr.MeasureText("my name is alfie"); if ( depth < 100 ) Recurse(depth+1, gr, rc); gr.PopFont(); gr.PopFont(); }