What is the browser compatible proper way to render a Font when overriding the Control.Render method?
I've looked around, and it looks like I should do
protected override void Render(HtmlTextWriter writer)
{
writer.AddStyleAttribute(HtmlTextWriterStyle.FontFamily, Font.Name);
writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, Font.SizeInPoints.ToString());
writer.RenderBeginTag(...);
...
writer.RenderEndTag();
}
Is there a better way to render a font into a tag? I feel like I'm missing some method like HtmlTextWriter.AddFont(Font font). I also feel like I'm missing something about CSS properties. There's an enumeration HtmlTextWriterTag and HtmlTextWriterStyle, is there is enumeration of CSS properties?
I'm doing this so I can subclass HtmlForm, add a Font property to it, and then subclass all the WebControls that use TABLE tags for layout and have them look up through the control hierarchy for their font if they don't have a font assigned to them declaratively or in code.