zoukankan      html  css  js  c++  java
  • 字体相关参数与数据集合

    项目中,需要实现字体相关操作,收集了一些相关参数,可以引用的。

    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" };
            }
    
        }
    }
    Source Code
  • 相关阅读:
    Attribute+Reflection,提高代码重用
    类型安全的EventHandlerList
    简单一招,使解决方案下的项目版本号统一
    T-SQL 随机返回特定行数据和分页查询
    2013年中国系统架构师大会随想
    C#实现在注册表中保存信息
    滤镜
    蒙版
    图层样式和混合模式
    布尔运算
  • 原文地址:https://www.cnblogs.com/insus/p/13600932.html
Copyright © 2011-2022 走看看