| 123456789101112131415161718192021222324 |
- export class CustomTextStyle implements AttributeModifier<TextAttribute> {
- fontSize: number | string | Resource = 16;
- fontWeight: number | FontWeight | string = 400;
- fontColor: ResourceColor = '#000000';
- constructor(font: CustomFont) {
- this.fontSize = font.size ?? this.fontSize
- this.fontWeight = font.weight ?? this.fontWeight
- this.fontColor = font.color ?? this.fontColor
- }
- applyNormalAttribute(instance: TextAttribute): void {
- instance
- .fontSize(this.fontSize)
- .fontWeight(this.fontWeight)
- .fontColor(this.fontColor)
- }
- }
- interface CustomFont{
- size?: number | string | Resource
- weight?: number | FontWeight | string
- color?: ResourceColor
- }
|