字体相关参数与数据集合
项目中,需要实现字体相关操作,收集了一些相关参数,可以引用的。
using System.Collections.Generic; using System.Drawing; using System.Drawing.Text; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; namespace Insus.NET.APIs { public class FontController : ApiController { [HttpPost] public IEnumerable<string> FontFamilys() { InstalledFontCollection fonts = new InstalledFontCollection(); foreach (FontFamily font in fonts.Families) { yield return font.Name; } } [HttpPost] public IEnumerable<string> FontStyles() { return new List<string>() { "normal", "italic", "oblique", "inherit", "initial", "unset" }; } [HttpPost] public IEnumerable<string> FontSizes() { return new List<string>() { "larger", "smaller", "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "inherit", "initial", "unset" }; } [HttpPost] public IEnumerable<string> FontWeights() { return new List<string>() { "normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", "inherit", "initial", "unset" }; } [HttpPost] public IEnumerable<string> FontVariants() { return new List<string>() { "normal", "small-caps", "inherit", "initial", "unset" }; } [HttpPost] public IEnumerable<string> LineHeights() { return new List<string>() { "normal", "inherit", "initial", "unset" }; } [HttpPost] public IEnumerable<string> FontUnits() { return new List<string>() { "%", "in", "cm", "mm", "em", "rem", "ex", "pt", "pc", "px" }; } } }