Skip to content

Commit efde120

Browse files
committed
Font: convert stored properties to getters
This is a purely aesthetic change to make the style consistent with the rest of the repository.
1 parent 48c0bd3 commit efde120

File tree

1 file changed

+78
-31
lines changed
  • Sources/SwiftWin32/Text Display and Fonts

1 file changed

+78
-31
lines changed

Sources/SwiftWin32/Text Display and Fonts/Font.swift

Lines changed: 78 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -557,15 +557,41 @@ public extension Font {
557557
}
558558

559559
public extension Font.Weight {
560-
static let ultraLight: Font.Weight = Font.Weight(rawValue: FW_ULTRALIGHT)
561-
static let thin: Font.Weight = Font.Weight(rawValue: FW_THIN)
562-
static let light: Font.Weight = Font.Weight(rawValue: FW_LIGHT)
563-
static let regular: Font.Weight = Font.Weight(rawValue: FW_REGULAR)
564-
static let medium: Font.Weight = Font.Weight(rawValue: FW_MEDIUM)
565-
static let semibold: Font.Weight = Font.Weight(rawValue: FW_SEMIBOLD)
566-
static let bold: Font.Weight = Font.Weight(rawValue: FW_BOLD)
567-
static let heavy: Font.Weight = Font.Weight(rawValue: FW_HEAVY)
568-
static let black: Font.Weight = Font.Weight(rawValue: FW_BLACK)
560+
static var ultraLight: Font.Weight {
561+
Font.Weight(rawValue: FW_ULTRALIGHT)
562+
}
563+
564+
static var thin: Font.Weight {
565+
Font.Weight(rawValue: FW_THIN)
566+
}
567+
568+
static var light: Font.Weight {
569+
Font.Weight(rawValue: FW_LIGHT)
570+
}
571+
572+
static var regular: Font.Weight {
573+
Font.Weight(rawValue: FW_REGULAR)
574+
}
575+
576+
static var medium: Font.Weight {
577+
Font.Weight(rawValue: FW_MEDIUM)
578+
}
579+
580+
static var semibold: Font.Weight {
581+
Font.Weight(rawValue: FW_SEMIBOLD)
582+
}
583+
584+
static var bold: Font.Weight {
585+
Font.Weight(rawValue: FW_BOLD)
586+
}
587+
588+
static var heavy: Font.Weight {
589+
Font.Weight(rawValue: FW_HEAVY)
590+
}
591+
592+
static var black: Font.Weight {
593+
Font.Weight(rawValue: FW_BLACK)
594+
}
569595
}
570596

571597
public extension Font {
@@ -580,26 +606,47 @@ public extension Font {
580606
}
581607

582608
public extension Font.TextStyle {
583-
static let body: Font.TextStyle =
584-
Font.TextStyle(rawValue: "UICTFontTextStyleBody")
585-
static let callout: Font.TextStyle =
586-
Font.TextStyle(rawValue: "UICTFontTextStyleCallout")
587-
static let caption1: Font.TextStyle =
588-
Font.TextStyle(rawValue: "UICTFontTextStyleCaption1")
589-
static let caption2: Font.TextStyle =
590-
Font.TextStyle(rawValue: "UICTFontTextStyleCaption2")
591-
static let footnote: Font.TextStyle =
592-
Font.TextStyle(rawValue: "UICTFontTextStyleFootnote")
593-
static let headline: Font.TextStyle =
594-
Font.TextStyle(rawValue: "UICTFontTextStyleHeadline")
595-
static let subheadline: Font.TextStyle =
596-
Font.TextStyle(rawValue: "UICTFontTextStyleSubhead")
597-
static let largeTitle: Font.TextStyle =
598-
Font.TextStyle(rawValue: "UICTFontTextStyleTitle0")
599-
static let title1: Font.TextStyle =
600-
Font.TextStyle(rawValue: "UICTFontTextStyleTitle1")
601-
static let title2: Font.TextStyle =
602-
Font.TextStyle(rawValue: "UICTFontTextStyleTitle2")
603-
static let title3: Font.TextStyle =
604-
Font.TextStyle(rawValue: "UICTFontTextStyleTitle3")
609+
static var body: Font.TextStyle {
610+
Font.TextStyle(rawValue: "UICTFontTextStyleBody")
611+
}
612+
613+
static var callout: Font.TextStyle {
614+
Font.TextStyle(rawValue: "UICTFontTextStyleCallout")
615+
}
616+
617+
static var caption1: Font.TextStyle {
618+
Font.TextStyle(rawValue: "UICTFontTextStyleCaption1")
619+
}
620+
621+
static var caption2: Font.TextStyle {
622+
Font.TextStyle(rawValue: "UICTFontTextStyleCaption2")
623+
}
624+
625+
static var footnote: Font.TextStyle {
626+
Font.TextStyle(rawValue: "UICTFontTextStyleFootnote")
627+
}
628+
629+
static var headline: Font.TextStyle {
630+
Font.TextStyle(rawValue: "UICTFontTextStyleHeadline")
631+
}
632+
633+
static var subheadline: Font.TextStyle {
634+
Font.TextStyle(rawValue: "UICTFontTextStyleSubhead")
635+
}
636+
637+
static var largeTitle: Font.TextStyle {
638+
Font.TextStyle(rawValue: "UICTFontTextStyleTitle0")
639+
}
640+
641+
static var title1: Font.TextStyle {
642+
Font.TextStyle(rawValue: "UICTFontTextStyleTitle1")
643+
}
644+
645+
static var title2: Font.TextStyle {
646+
Font.TextStyle(rawValue: "UICTFontTextStyleTitle2")
647+
}
648+
649+
static var title3: Font.TextStyle {
650+
Font.TextStyle(rawValue: "UICTFontTextStyleTitle3")
651+
}
605652
}

0 commit comments

Comments
 (0)