diff --git a/AuthenticatorShared/UI/Platform/Application/Support/Info.plist b/AuthenticatorShared/UI/Platform/Application/Support/Info.plist index 7ad38b4b03..da1ba631d5 100644 --- a/AuthenticatorShared/UI/Platform/Application/Support/Info.plist +++ b/AuthenticatorShared/UI/Platform/Application/Support/Info.plist @@ -16,5 +16,10 @@ 1.0 CFBundleVersion 1 + UIAppFonts + + InterVariable-Italic.ttf + InterVariable.ttf + diff --git a/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFont.swift b/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFont.swift index bc6067fafb..872b190f89 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFont.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/StyleGuideFont.swift @@ -54,17 +54,22 @@ extension StyleGuideFont { self.textStyle = textStyle } - /// Returns a `StyleGuideFont` that uses the DMSans font. + /// Returns a `StyleGuideFont` that uses the Inter font. /// /// - Parameters: /// - lineHeight: The line height for this style, in px. /// - size: The default font size for this style, in px. /// - textStyle: The text style for the font, used to determine how the font scales with dynamic type. - /// - Returns: A `StyleGuideFont` that uses the DMSans font. + /// - Returns: A `StyleGuideFont` that uses the Inter font. /// - static func dmSans(lineHeight: CGFloat, size: CGFloat, textStyle: SwiftUI.Font.TextStyle) -> StyleGuideFont { + static func inter(lineHeight: CGFloat, size: CGFloat, textStyle: SwiftUI.Font.TextStyle) -> StyleGuideFont { FontFamily.registerAllCustomFonts() - return self.init(font: FontFamily.DMSans.regular, lineHeight: lineHeight, size: size, textStyle: textStyle) + return self.init( + font: FontFamily.InterVariable.regular, + lineHeight: lineHeight, + size: size, + textStyle: textStyle, + ) } /// Returns a new `StyleGuideFont` with same properties but different font. @@ -86,55 +91,55 @@ extension StyleGuideFont { public extension StyleGuideFont { /// The font for the huge title style. - static let hugeTitle = StyleGuideFont.dmSans(lineHeight: 41, size: 34, textStyle: .largeTitle) + static let hugeTitle = StyleGuideFont.inter(lineHeight: 41, size: 34, textStyle: .largeTitle) /// The font for the large title style. - static let largeTitle = StyleGuideFont.dmSans(lineHeight: 32, size: 26, textStyle: .largeTitle) + static let largeTitle = StyleGuideFont.inter(lineHeight: 32, size: 26, textStyle: .largeTitle) /// The font for the title style. - static let title = StyleGuideFont.dmSans(lineHeight: 28, size: 22, textStyle: .title) + static let title = StyleGuideFont.inter(lineHeight: 28, size: 22, textStyle: .title) /// The font for the title2 style. - static let title2 = StyleGuideFont.dmSans(lineHeight: 22, size: 17, textStyle: .title2) + static let title2 = StyleGuideFont.inter(lineHeight: 22, size: 17, textStyle: .title2) /// The font for the title3 style. - static let title3 = StyleGuideFont.dmSans(lineHeight: 21, size: 16, textStyle: .title3) + static let title3 = StyleGuideFont.inter(lineHeight: 21, size: 16, textStyle: .title3) /// The font for the headline style. - static let headline = StyleGuideFont.dmSans(lineHeight: 28, size: 15, textStyle: .headline) + static let headline = StyleGuideFont.inter(lineHeight: 28, size: 15, textStyle: .headline) /// The font for the body style. - static let body = StyleGuideFont.dmSans(lineHeight: 20, size: 15, textStyle: .body) + static let body = StyleGuideFont.inter(lineHeight: 20, size: 15, textStyle: .body) /// The font for the bold body style. - static let bodyBold = body.with(font: FontFamily.DMSans.bold) + static let bodyBold = body.with(font: FontFamily.InterVariable.bold) /// The font for the monospaced body style. static let bodyMonospaced = StyleGuideFont(font: .system(.body, design: .monospaced), lineHeight: 22, size: 17) /// The font for the bold semibody style. - static let bodySemibold = body.with(font: FontFamily.DMSans.semiBold) + static let bodySemibold = body.with(font: FontFamily.InterVariable.semiBold) /// The font for the callout style. - static let callout = StyleGuideFont.dmSans(lineHeight: 18, size: 13, textStyle: .callout) + static let callout = StyleGuideFont.inter(lineHeight: 18, size: 13, textStyle: .callout) /// The font for the callout semibold style. - static let calloutSemibold = callout.with(font: FontFamily.DMSans.semiBold) + static let calloutSemibold = callout.with(font: FontFamily.InterVariable.semiBold) /// The font for the subheadline style. - static let subheadline = StyleGuideFont.dmSans(lineHeight: 16, size: 12, textStyle: .subheadline) + static let subheadline = StyleGuideFont.inter(lineHeight: 16, size: 12, textStyle: .subheadline) /// The font for the subheadline semibold style. - static let subheadlineSemibold = subheadline.with(font: FontFamily.DMSans.semiBold) + static let subheadlineSemibold = subheadline.with(font: FontFamily.InterVariable.semiBold) /// The font for the footnote style. - static let footnote = StyleGuideFont.dmSans(lineHeight: 18, size: 12, textStyle: .footnote) + static let footnote = StyleGuideFont.inter(lineHeight: 18, size: 12, textStyle: .footnote) /// The font for the caption1 style. - static let caption1 = StyleGuideFont.dmSans(lineHeight: 18, size: 12, textStyle: .caption) + static let caption1 = StyleGuideFont.inter(lineHeight: 18, size: 12, textStyle: .caption) /// The font for the caption2 style. - static let caption2 = StyleGuideFont.dmSans(lineHeight: 13, size: 11, textStyle: .caption2) + static let caption2 = StyleGuideFont.inter(lineHeight: 13, size: 11, textStyle: .caption2) /// The font for the caption2 style monospaced. static let caption2Monospaced = StyleGuideFont( @@ -253,7 +258,7 @@ public extension Text { // MARK: Previews #if DEBUG -struct StyleGuideFont_Previews: PreviewProvider { +struct StyleGuideFont_Previews: PreviewProvider { // swiftlint:disable:this type_body_length static var previews: some View { HStack { VStack(alignment: .trailing, spacing: 8) { @@ -450,6 +455,51 @@ struct StyleGuideFont_Previews: PreviewProvider { .background(Color(.systemGroupedBackground)) .previewDisplayName("Standard vs Bold Italic") + HStack { + VStack(alignment: .trailing, spacing: 8) { + Text("Ultra Light") + .styleGuide(.body, weight: .ultraLight) + Text("Thin") + .styleGuide(.body, weight: .thin) + Text("Light") + .styleGuide(.body, weight: .light) + Text("Normal") + .styleGuide(.body, weight: .regular) + Text("Medium") + .styleGuide(.body, weight: .medium) + Text("Semibold") + .styleGuide(.body, weight: .semibold) + Text("Bold") + .styleGuide(.body, weight: .bold) + Text("Heavy") + .styleGuide(.body, weight: .heavy) + Text("Black") + .styleGuide(.body, weight: .black) + } + VStack(alignment: .leading, spacing: 8) { + Text("Ultra Light Italic") + .styleGuide(.body, weight: .ultraLight, isItalic: true) + Text("Thin Italic") + .styleGuide(.body, weight: .thin, isItalic: true) + Text("Light Italic") + .styleGuide(.body, weight: .light, isItalic: true) + Text("Normal Italic") + .styleGuide(.body, weight: .regular, isItalic: true) + Text("Medium Italic") + .styleGuide(.body, weight: .medium, isItalic: true) + Text("Semibold Italic") + .styleGuide(.body, weight: .semibold, isItalic: true) + Text("Bold Italic") + .styleGuide(.body, weight: .bold, isItalic: true) + Text("Heavy Italic") + .styleGuide(.body, weight: .heavy, isItalic: true) + Text("Black Italic") + .styleGuide(.body, weight: .black, isItalic: true) + } + } + .background(Color(.systemGroupedBackground)) + .previewDisplayName("Body Weights") + VStack(alignment: .leading) { Button("Sample Button", action: {}) .buttonStyle(.primary()) diff --git a/BitwardenKit/UI/Platform/Application/Appearance/UI.swift b/BitwardenKit/UI/Platform/Application/Appearance/UI.swift index 33e571db7e..036166070f 100644 --- a/BitwardenKit/UI/Platform/Application/Appearance/UI.swift +++ b/BitwardenKit/UI/Platform/Application/Appearance/UI.swift @@ -59,17 +59,17 @@ public enum UI { @MainActor public static func applyDefaultAppearances() { // swiftlint:disable:this function_body_length let bodyFont = UIFontMetrics(forTextStyle: .body).scaledFont( - for: FontFamily.DMSans.regular.font(size: 15), + for: FontFamily.InterVariable.regular.font(size: 15), ) let bodyBoldFont = UIFontMetrics(forTextStyle: .body).scaledFont( - for: FontFamily.DMSans.bold.font(size: 15), + for: FontFamily.InterVariable.bold.font(size: 15), ) let largeTitleFont = UIFontMetrics(forTextStyle: .largeTitle).scaledFont( - for: FontFamily.DMSans.bold.font(size: 26), + for: FontFamily.InterVariable.bold.font(size: 26), ) let iconBadgeBackground = SharedAsset.Colors.iconBadgeBackground.color let iconBadgeTextAttributes: [NSAttributedString.Key: Any] = [ - .font: FontFamily.DMSans.bold.font(size: 12), + .font: FontFamily.InterVariable.bold.font(size: 12), .foregroundColor: SharedAsset.Colors.iconBadgeForeground.color, ] @@ -124,7 +124,7 @@ public enum UI { UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).title = Localizations.cancel UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes( - [.font: FontFamily.DMSans.regular.font(size: 15)], + [.font: FontFamily.InterVariable.regular.font(size: 15)], for: .normal, ) @@ -137,14 +137,18 @@ public enum UI { UISegmentedControl.appearance().setTitleTextAttributes( [ - .font: UIFontMetrics(forTextStyle: .callout).scaledFont(for: FontFamily.DMSans.regular.font(size: 13)), + .font: UIFontMetrics(forTextStyle: .callout).scaledFont( + for: FontFamily.InterVariable.regular.font(size: 13), + ), .foregroundColor: SharedAsset.Colors.textSecondary.color, ], for: .normal, ) UISegmentedControl.appearance().setTitleTextAttributes( [ - .font: UIFontMetrics(forTextStyle: .callout).scaledFont(for: FontFamily.DMSans.semiBold.font(size: 13)), + .font: UIFontMetrics(forTextStyle: .callout).scaledFont( + for: FontFamily.InterVariable.semiBold.font(size: 13), + ), .foregroundColor: SharedAsset.Colors.textInteraction.color, ], for: .selected, diff --git a/BitwardenKit/UI/Platform/Application/Views/BitwardenStepper.swift b/BitwardenKit/UI/Platform/Application/Views/BitwardenStepper.swift index 4534364005..583c9ca91b 100644 --- a/BitwardenKit/UI/Platform/Application/Views/BitwardenStepper.swift +++ b/BitwardenKit/UI/Platform/Application/Views/BitwardenStepper.swift @@ -50,7 +50,7 @@ public struct BitwardenStepper: View { // This width will change as the number of digits changes (e.g. "9" to "10"), but that's // better than it changing for each digit (e.g. "0" to "1"). let zeroString = String(repeating: "0", count: value.numberOfDigits) - let font = FontFamily.DMSans.semiBold.font(size: StyleGuideFont.body.size) + let font = FontFamily.InterVariable.semiBold.font(size: StyleGuideFont.body.size) let traitCollection = UITraitCollection( preferredContentSizeCategory: UIContentSizeCategory(dynamicTypeSize), ) diff --git a/BitwardenKit/UI/Platform/Application/Views/BitwardenUITextView.swift b/BitwardenKit/UI/Platform/Application/Views/BitwardenUITextView.swift index 4c3412ca3c..2eaf104149 100644 --- a/BitwardenKit/UI/Platform/Application/Views/BitwardenUITextView.swift +++ b/BitwardenKit/UI/Platform/Application/Views/BitwardenUITextView.swift @@ -129,7 +129,7 @@ public struct BitwardenUITextView: UIViewRepresentable { textView.textContainerInset = UIEdgeInsets(top: 4, left: 0, bottom: 4, right: 0) textView.textContainer.lineFragmentPadding = 0 textView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) - let customFont = FontFamily.DMSans.regular.font(size: 15) + let customFont = FontFamily.InterVariable.regular.font(size: 15) textView.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: customFont) return textView } diff --git a/BitwardenResources/Fonts/DMSans-Bold.ttf b/BitwardenResources/Fonts/DMSans-Bold.ttf deleted file mode 100644 index 809e9788a3..0000000000 Binary files a/BitwardenResources/Fonts/DMSans-Bold.ttf and /dev/null differ diff --git a/BitwardenResources/Fonts/DMSans-BoldItalic.ttf b/BitwardenResources/Fonts/DMSans-BoldItalic.ttf deleted file mode 100644 index a22b782736..0000000000 Binary files a/BitwardenResources/Fonts/DMSans-BoldItalic.ttf and /dev/null differ diff --git a/BitwardenResources/Fonts/DMSans-Italic.ttf b/BitwardenResources/Fonts/DMSans-Italic.ttf deleted file mode 100644 index 3319ec3df7..0000000000 Binary files a/BitwardenResources/Fonts/DMSans-Italic.ttf and /dev/null differ diff --git a/BitwardenResources/Fonts/DMSans-Regular.ttf b/BitwardenResources/Fonts/DMSans-Regular.ttf deleted file mode 100644 index 28ff3c878d..0000000000 Binary files a/BitwardenResources/Fonts/DMSans-Regular.ttf and /dev/null differ diff --git a/BitwardenResources/Fonts/DMSans-SemiBold.ttf b/BitwardenResources/Fonts/DMSans-SemiBold.ttf deleted file mode 100644 index 4dde30434e..0000000000 Binary files a/BitwardenResources/Fonts/DMSans-SemiBold.ttf and /dev/null differ diff --git a/BitwardenResources/Fonts/DMSans-SemiBoldItalic.ttf b/BitwardenResources/Fonts/DMSans-SemiBoldItalic.ttf deleted file mode 100644 index 115a9542eb..0000000000 Binary files a/BitwardenResources/Fonts/DMSans-SemiBoldItalic.ttf and /dev/null differ diff --git a/BitwardenResources/Fonts/InterVariable-Italic.ttf b/BitwardenResources/Fonts/InterVariable-Italic.ttf new file mode 100644 index 0000000000..5b358cdd51 Binary files /dev/null and b/BitwardenResources/Fonts/InterVariable-Italic.ttf differ diff --git a/BitwardenResources/Fonts/InterVariable.ttf b/BitwardenResources/Fonts/InterVariable.ttf new file mode 100644 index 0000000000..4ab79e0102 Binary files /dev/null and b/BitwardenResources/Fonts/InterVariable.ttf differ diff --git a/BitwardenShared/UI/Platform/Application/Support/Info.plist b/BitwardenShared/UI/Platform/Application/Support/Info.plist index 23cae428dd..3373216c7d 100644 --- a/BitwardenShared/UI/Platform/Application/Support/Info.plist +++ b/BitwardenShared/UI/Platform/Application/Support/Info.plist @@ -20,12 +20,8 @@ 1 UIAppFonts - DMSans-Bold.ttf - DMSans-BoldItalic.ttf - DMSans-Italic.ttf - DMSans-Regular.ttf - DMSans-SemiBold.ttf - DMSans-SemiBoldItalic.ttf + InterVariable-Italic.ttf + InterVariable.ttf