Converts a FontUnit to a size for the HTML FONT tag
//------------------------------------------------------------------------------
// Copyright (c) 2003-2009 Whidsoft Corporation. All Rights Reserved.
//------------------------------------------------------------------------------
namespace Whidsoft.WebControls
{
using System;
using System.Drawing;
using System.IO;
using System.Collections;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Text.RegularExpressions;
/// <summary>
/// Utility class with various useful static functions.
/// </summary>
internal class Util
{
/// <summary>
/// Converts a FontUnit to a size for the HTML FONT tag
/// </summary>
internal static string ConvertToHtmlFontSize(FontUnit fu)
{
if ((int)(fu.Type) > 3)
{
return ((int)(fu.Type)-3).ToString();
}
if (fu.Type == FontSize.AsUnit) {
if (fu.Unit.Type == UnitType.Point) {
if (fu.Unit.Value <= 8)
return "1";
else if (fu.Unit.Value <= 10)
return "2";
else if (fu.Unit.Value <= 12)
return "3";
else if (fu.Unit.Value <= 14)
return "4";
else if (fu.Unit.Value <= 18)
return "5";
else if (fu.Unit.Value <= 24)
return "6";
else
return "7";
}
}
return null;
}
}
}
Related examples in the same category