import { STextAlign } from "./enums/STextAlign"; import { STextBaseLine } from "./enums/STextBaseLine"; import { STextDirection } from "./enums/STextDirection"; /** * 字体 * * @author 庞利祥(sybotan@126.com) */ export class SFont { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 属性定义 /** 字体 */ name = "sans-serif"; /** 字号 */ size = 16; /** 文本对齐选项 */ textAlign = STextAlign.Start; /** 文本基线对齐选项 */ readonly textBaseLine = STextBaseLine.Top; /** 文本方向 */ textDirection = STextDirection.Inherit; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // 构造函数 /** * 构造函数 */ constructor(); /** * 构造函数 * * @param font FONT */ constructor(font: SFont); /** * 构造函数 * * @param name 字体 * @param size 字号 */ constructor(name: string, size?: number); /** * 构造函数 * * @param name 字体 | SFont * @param size 字号 */ constructor(name?: string | SFont, size?: number) { if (name == undefined) { return; } if (name instanceof SFont) { this.name = name.name; this.size = name.size; this.textAlign = name.textAlign; // this.textBaseLine = name.textBaseLine; this.textDirection = name.textDirection; } else { this.name = name; this.size = size != undefined ? size : 16; } } // Constructor } // Class SFont