added fonts
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
b18edd6033
commit
20895847ed
@ -27,6 +27,17 @@
|
||||
EA3361C328902D960071C351 /* VDSToggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C228902D960071C351 /* VDSToggle.swift */; };
|
||||
EA3361C5289030FC0071C351 /* Accessable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C4289030FC0071C351 /* Accessable.swift */; };
|
||||
EA3361C9289054C50071C351 /* Surfaceable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361C8289054C50071C351 /* Surfaceable.swift */; };
|
||||
EA3361E12891D1110071C351 /* TypographyProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361E02891D1110071C351 /* TypographyProtocol.swift */; };
|
||||
EA3361E32891D1860071C351 /* FontWeight.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3361E22891D1860071C351 /* FontWeight.swift */; };
|
||||
EA3361F42891D5290071C351 /* VDSTypographyTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EA3361F32891D5290071C351 /* VDSTypographyTokens.xcframework */; };
|
||||
EA3362042891E14D0071C351 /* VerizonNHGeTX-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = EA3362002891E14C0071C351 /* VerizonNHGeTX-Bold.otf */; };
|
||||
EA3362052891E14D0071C351 /* VerizonNHGeDS-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = EA3362012891E14D0071C351 /* VerizonNHGeDS-Bold.otf */; };
|
||||
EA3362062891E14D0071C351 /* VerizonNHGeTX-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = EA3362022891E14D0071C351 /* VerizonNHGeTX-Regular.otf */; };
|
||||
EA3362072891E14D0071C351 /* VerizonNHGeDS-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = EA3362032891E14D0071C351 /* VerizonNHGeDS-Regular.otf */; };
|
||||
EA33622C2891E73B0071C351 /* FontProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA33622B2891E73B0071C351 /* FontProtocol.swift */; };
|
||||
EA33622E2891EA3C0071C351 /* DispatchQueue+Once.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA33622D2891EA3C0071C351 /* DispatchQueue+Once.swift */; };
|
||||
EA3362302891EB4A0071C351 /* VDSFonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA33622F2891EB4A0071C351 /* VDSFonts.swift */; };
|
||||
EA3362322891F2ED0071C351 /* VDSFontStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3362312891F2ED0071C351 /* VDSFontStyles.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -61,6 +72,17 @@
|
||||
EA3361C228902D960071C351 /* VDSToggle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VDSToggle.swift; sourceTree = "<group>"; };
|
||||
EA3361C4289030FC0071C351 /* Accessable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Accessable.swift; sourceTree = "<group>"; };
|
||||
EA3361C8289054C50071C351 /* Surfaceable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Surfaceable.swift; sourceTree = "<group>"; };
|
||||
EA3361E02891D1110071C351 /* TypographyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypographyProtocol.swift; sourceTree = "<group>"; };
|
||||
EA3361E22891D1860071C351 /* FontWeight.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontWeight.swift; sourceTree = "<group>"; };
|
||||
EA3361F32891D5290071C351 /* VDSTypographyTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSTypographyTokens.xcframework; path = ../SharedFrameworks/VDSTypographyTokens.xcframework; sourceTree = "<group>"; };
|
||||
EA3362002891E14C0071C351 /* VerizonNHGeTX-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "VerizonNHGeTX-Bold.otf"; sourceTree = "<group>"; };
|
||||
EA3362012891E14D0071C351 /* VerizonNHGeDS-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "VerizonNHGeDS-Bold.otf"; sourceTree = "<group>"; };
|
||||
EA3362022891E14D0071C351 /* VerizonNHGeTX-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "VerizonNHGeTX-Regular.otf"; sourceTree = "<group>"; };
|
||||
EA3362032891E14D0071C351 /* VerizonNHGeDS-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "VerizonNHGeDS-Regular.otf"; sourceTree = "<group>"; };
|
||||
EA33622B2891E73B0071C351 /* FontProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontProtocol.swift; sourceTree = "<group>"; };
|
||||
EA33622D2891EA3C0071C351 /* DispatchQueue+Once.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DispatchQueue+Once.swift"; sourceTree = "<group>"; };
|
||||
EA33622F2891EB4A0071C351 /* VDSFonts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VDSFonts.swift; sourceTree = "<group>"; };
|
||||
EA3362312891F2ED0071C351 /* VDSFontStyles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VDSFontStyles.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -69,6 +91,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA336195288B1C420071C351 /* VDSColorTokens.xcframework in Frameworks */,
|
||||
EA3361F42891D5290071C351 /* VDSTypographyTokens.xcframework in Frameworks */,
|
||||
EA336197288B1C420071C351 /* VDSFormControlsTokens.xcframework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -106,13 +129,15 @@
|
||||
EA33616E288B19200071C351 /* VDS */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EA336170288B19200071C351 /* VDS.docc */,
|
||||
EA33616F288B19200071C351 /* VDS.h */,
|
||||
EA3361B4288B2A360071C351 /* BaseClasses */,
|
||||
EA33619D288B1E330071C351 /* Components */,
|
||||
EA3361A6288B23240071C351 /* Extensions */,
|
||||
EA3361AB288B25EC0071C351 /* Protocols */,
|
||||
EA3361DF2891D0F10071C351 /* Typography */,
|
||||
EA3361B9288B2BE30071C351 /* Utilities */,
|
||||
EA3361FE2891E14C0071C351 /* SupportingFiles */,
|
||||
EA336170288B19200071C351 /* VDS.docc */,
|
||||
EA33616F288B19200071C351 /* VDS.h */,
|
||||
);
|
||||
path = VDS;
|
||||
sourceTree = "<group>";
|
||||
@ -128,6 +153,7 @@
|
||||
EA33618D288B1C0C0071C351 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EA3361F32891D5290071C351 /* VDSTypographyTokens.xcframework */,
|
||||
EA33618E288B1C0C0071C351 /* VDSColorTokens.xcframework */,
|
||||
EA33618F288B1C0C0071C351 /* VDSFormControlsTokens.xcframework */,
|
||||
);
|
||||
@ -155,6 +181,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EA3361A7288B23300071C351 /* UIColor.swift */,
|
||||
EA33622D2891EA3C0071C351 /* DispatchQueue+Once.swift */,
|
||||
);
|
||||
path = Extensions;
|
||||
sourceTree = "<group>";
|
||||
@ -191,6 +218,37 @@
|
||||
path = Utilities;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EA3361DF2891D0F10071C351 /* Typography */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EA33622F2891EB4A0071C351 /* VDSFonts.swift */,
|
||||
EA3362312891F2ED0071C351 /* VDSFontStyles.swift */,
|
||||
EA3361E02891D1110071C351 /* TypographyProtocol.swift */,
|
||||
EA3361E22891D1860071C351 /* FontWeight.swift */,
|
||||
EA33622B2891E73B0071C351 /* FontProtocol.swift */,
|
||||
);
|
||||
path = Typography;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EA3361FE2891E14C0071C351 /* SupportingFiles */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EA3361FF2891E14C0071C351 /* Fonts */,
|
||||
);
|
||||
path = SupportingFiles;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EA3361FF2891E14C0071C351 /* Fonts */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EA3362002891E14C0071C351 /* VerizonNHGeTX-Bold.otf */,
|
||||
EA3362012891E14D0071C351 /* VerizonNHGeDS-Bold.otf */,
|
||||
EA3362022891E14D0071C351 /* VerizonNHGeTX-Regular.otf */,
|
||||
EA3362032891E14D0071C351 /* VerizonNHGeDS-Regular.otf */,
|
||||
);
|
||||
path = Fonts;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
@ -283,6 +341,10 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA3362042891E14D0071C351 /* VerizonNHGeTX-Bold.otf in Resources */,
|
||||
EA3362072891E14D0071C351 /* VerizonNHGeDS-Regular.otf in Resources */,
|
||||
EA3362062891E14D0071C351 /* VerizonNHGeTX-Regular.otf in Resources */,
|
||||
EA3362052891E14D0071C351 /* VerizonNHGeDS-Bold.otf in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -300,8 +362,11 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA3362322891F2ED0071C351 /* VDSFontStyles.swift in Sources */,
|
||||
EA3361C328902D960071C351 /* VDSToggle.swift in Sources */,
|
||||
EA33622E2891EA3C0071C351 /* DispatchQueue+Once.swift in Sources */,
|
||||
EA3361C5289030FC0071C351 /* Accessable.swift in Sources */,
|
||||
EA33622C2891E73B0071C351 /* FontProtocol.swift in Sources */,
|
||||
EA3361C9289054C50071C351 /* Surfaceable.swift in Sources */,
|
||||
EA3361A2288B1E840071C351 /* VDSToggleModel.swift in Sources */,
|
||||
EA3361BD288B2C760071C351 /* TypeAlias.swift in Sources */,
|
||||
@ -310,8 +375,11 @@
|
||||
EA336171288B19200071C351 /* VDS.docc in Sources */,
|
||||
EA3361AA288B25E40071C351 /* Disabling.swift in Sources */,
|
||||
EA3361B6288B2A410071C351 /* Control.swift in Sources */,
|
||||
EA3361E32891D1860071C351 /* FontWeight.swift in Sources */,
|
||||
EA3361B1288B26490071C351 /* Invertable.swift in Sources */,
|
||||
EA3361AD288B26190071C351 /* DataTrackable.swift in Sources */,
|
||||
EA3361E12891D1110071C351 /* TypographyProtocol.swift in Sources */,
|
||||
EA3362302891EB4A0071C351 /* VDSFonts.swift in Sources */,
|
||||
EA3361B8288B2AAA0071C351 /* ViewProtocol.swift in Sources */,
|
||||
EA3361BF288B2EA60071C351 /* Modelable.swift in Sources */,
|
||||
EA3361A8288B23300071C351 /* UIColor.swift in Sources */,
|
||||
|
||||
42
VDS/Extensions/DispatchQueue+Once.swift
Normal file
42
VDS/Extensions/DispatchQueue+Once.swift
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// DispatchQueue+Once.swift
|
||||
// VDS
|
||||
//
|
||||
// Created by Matt Bruce on 7/27/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension DispatchQueue {
|
||||
private static var _onceTracker = [String]()
|
||||
|
||||
public class func once(
|
||||
file: String = #file,
|
||||
function: String = #function,
|
||||
line: Int = #line,
|
||||
block: () -> Void
|
||||
) {
|
||||
let token = "\(file):\(function):\(line)"
|
||||
once(token: token, block: block)
|
||||
}
|
||||
|
||||
/**
|
||||
Executes a block of code, associated with a unique token, only once. The code is thread safe and will
|
||||
only execute the code once even in the presence of multithreaded calls.
|
||||
|
||||
- parameter token: A unique reverse DNS style name such as com.vectorform.<name> or a GUID
|
||||
- parameter block: Block to execute once
|
||||
*/
|
||||
public class func once(
|
||||
token: String,
|
||||
block: () -> Void
|
||||
) {
|
||||
objc_sync_enter(self)
|
||||
defer { objc_sync_exit(self) }
|
||||
|
||||
guard !_onceTracker.contains(token) else { return }
|
||||
|
||||
_onceTracker.append(token)
|
||||
block()
|
||||
}
|
||||
}
|
||||
BIN
VDS/SupportingFiles/Fonts/VerizonNHGeDS-Bold.otf
Executable file
BIN
VDS/SupportingFiles/Fonts/VerizonNHGeDS-Bold.otf
Executable file
Binary file not shown.
BIN
VDS/SupportingFiles/Fonts/VerizonNHGeDS-Regular.otf
Executable file
BIN
VDS/SupportingFiles/Fonts/VerizonNHGeDS-Regular.otf
Executable file
Binary file not shown.
BIN
VDS/SupportingFiles/Fonts/VerizonNHGeTX-Bold.otf
Executable file
BIN
VDS/SupportingFiles/Fonts/VerizonNHGeTX-Bold.otf
Executable file
Binary file not shown.
BIN
VDS/SupportingFiles/Fonts/VerizonNHGeTX-Regular.otf
Executable file
BIN
VDS/SupportingFiles/Fonts/VerizonNHGeTX-Regular.otf
Executable file
Binary file not shown.
52
VDS/Typography/FontProtocol.swift
Normal file
52
VDS/Typography/FontProtocol.swift
Normal file
@ -0,0 +1,52 @@
|
||||
//
|
||||
// FontStyle.swift
|
||||
// VDS
|
||||
//
|
||||
// Created by Matt Bruce on 7/27/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
public protocol FontProtocol: CaseIterable, RawRepresentable, Hashable {
|
||||
var fontFileExtension: String { get }
|
||||
var fontName: String { get }
|
||||
}
|
||||
|
||||
extension FontProtocol {
|
||||
|
||||
public func register() {
|
||||
guard let bundle = Bundle(identifier: "com.verizon.vega.metrics") else { return }
|
||||
Self.allCases.forEach{ font in
|
||||
if let url = bundle.url(forResource: font.fontName, withExtension: font.fontFileExtension){
|
||||
do{
|
||||
try Self.register(from: url)
|
||||
} catch{
|
||||
//DLog("Font called \(font.fontName).\(font.fontFileExtension) couldn't be registered")
|
||||
}
|
||||
} else {
|
||||
//DLog("Font for FontStyle: \(font) couldn't be found")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static func register(from url: URL) throws {
|
||||
guard let fontDataProvider = CGDataProvider(url: url as CFURL) else {
|
||||
throw NSError(domain: "www.verizon.com", code: 123, userInfo: ["description":"Could not create font data provider for \(url)."])
|
||||
}
|
||||
let font = CGFont(fontDataProvider)
|
||||
var error: Unmanaged<CFError>?
|
||||
guard CTFontManagerRegisterGraphicsFont(font!, &error) else {
|
||||
throw error!.takeUnretainedValue()
|
||||
}
|
||||
}
|
||||
|
||||
public func font(ofSize size: CGFloat) -> UIFont{
|
||||
DispatchQueue.once(block: { self.register() })
|
||||
if let font = UIFont(name: self.fontName, size: size){
|
||||
return UIFontMetrics.default.scaledFont(for: font)
|
||||
} else {
|
||||
return UIFontMetrics.default.scaledFont(for: UIFont.systemFont(ofSize: size))
|
||||
}
|
||||
}
|
||||
}
|
||||
23
VDS/Typography/FontWeight.swift
Normal file
23
VDS/Typography/FontWeight.swift
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// FontWeight.swift
|
||||
// VDS
|
||||
//
|
||||
// Created by Matt Bruce on 7/27/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import VDSTypographyTokens
|
||||
|
||||
public struct Typography {
|
||||
|
||||
public enum FontWeight: String, Codable {
|
||||
case regular, bold
|
||||
}
|
||||
|
||||
public enum Letterspacing: String, Codable {
|
||||
case tight, wide
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
192
VDS/Typography/TypographyProtocol.swift
Normal file
192
VDS/Typography/TypographyProtocol.swift
Normal file
@ -0,0 +1,192 @@
|
||||
//
|
||||
// TypographyProtocol.swift
|
||||
// VDS
|
||||
//
|
||||
// Created by Matt Bruce on 7/27/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import VDSTypographyTokens
|
||||
|
||||
public protocol XXLFontable {
|
||||
static var xxlBold: UIFont { get }
|
||||
static var xxlRegular: UIFont { get }
|
||||
}
|
||||
|
||||
public protocol XLFontable {
|
||||
static var xlBold: UIFont { get }
|
||||
static var xlRegular: UIFont { get }
|
||||
}
|
||||
|
||||
public protocol LargeFontable {
|
||||
static var largeBold: UIFont { get }
|
||||
static var largeRegular: UIFont { get }
|
||||
}
|
||||
|
||||
public protocol MediumFontable {
|
||||
static var mediumBold: UIFont { get }
|
||||
static var mediumRegular: UIFont { get }
|
||||
}
|
||||
|
||||
public protocol SmallFontable {
|
||||
static var smallBold: UIFont { get }
|
||||
static var smallRegular: UIFont { get }
|
||||
}
|
||||
|
||||
public protocol XSmallFontable {
|
||||
static var xsmallBold: UIFont { get }
|
||||
static var xsmallRegular: UIFont { get }
|
||||
}
|
||||
|
||||
public protocol FeatureTypograhyProtocol: XLFontable, LargeFontable, MediumFontable, SmallFontable, XSmallFontable {}
|
||||
|
||||
public protocol TitleTypograhyProtocol: XXLFontable, XLFontable, LargeFontable, MediumFontable, SmallFontable {}
|
||||
|
||||
public protocol BodyTypograhyProtocol: LargeFontable, MediumFontable, SmallFontable {}
|
||||
|
||||
public protocol MicroTypographyProtocol {
|
||||
static var bold: UIFont { get }
|
||||
static var regular: UIFont { get }
|
||||
}
|
||||
|
||||
//public struct VDSFontStyles {
|
||||
// public enum Feature: FeatureTypograhyProtocol {
|
||||
//
|
||||
// private static func getFont(vdsFont: VDSFonts, size: AvailableSize) -> UIFont {
|
||||
// switch size {
|
||||
// case .xlarge:
|
||||
// return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96)
|
||||
// case .large:
|
||||
// return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80)
|
||||
// case .medium:
|
||||
// return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature96 : VDSTypography.fontSizeFeature64)
|
||||
// case .small:
|
||||
// return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature80 : VDSTypography.fontSizeFeature48)
|
||||
// case .xsmall:
|
||||
// return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static var xlBold: UIFont {
|
||||
// return VDSFonts.dsBold.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96)
|
||||
// }
|
||||
//
|
||||
// public static var xlRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96)
|
||||
// }
|
||||
//
|
||||
// public static var largeBold: UIFont{
|
||||
// return VDSFonts.dsBold.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80)
|
||||
// }
|
||||
//
|
||||
// public static var largeRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80)
|
||||
// }
|
||||
//
|
||||
// public static var mediumBold: UIFont{
|
||||
// return VDSFonts.dsBold.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature96 : VDSTypography.fontSizeFeature64)
|
||||
// }
|
||||
//
|
||||
// public static var mediumRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature96 : VDSTypography.fontSizeFeature64)
|
||||
// }
|
||||
//
|
||||
// public static var smallBold: UIFont{
|
||||
// return VDSFonts.dsBold.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature80 : VDSTypography.fontSizeFeature48)
|
||||
// }
|
||||
//
|
||||
// public static var smallRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature80 : VDSTypography.fontSizeFeature48)
|
||||
// }
|
||||
//
|
||||
// public static var xsmallBold: UIFont{
|
||||
// return VDSFonts.dsBold.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40)
|
||||
// }
|
||||
//
|
||||
// public static var xsmallRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public enum Title: TitleTypograhyProtocol {
|
||||
//
|
||||
// public static var xxlBold: UIFont {
|
||||
// return VDSFonts.dsBold.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle64 : VDSTypography.fontSizeTitle40)
|
||||
// }
|
||||
//
|
||||
// public static var xxlRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle64 : VDSTypography.fontSizeTitle40)
|
||||
// }
|
||||
//
|
||||
// public static var xlBold: UIFont {
|
||||
// return VDSFonts.dsBold.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle48 : VDSTypography.fontSizeTitle32)
|
||||
// }
|
||||
//
|
||||
// public static var xlRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle48 : VDSTypography.fontSizeTitle32)
|
||||
// }
|
||||
//
|
||||
// public static var largeBold: UIFont{
|
||||
// return VDSFonts.dsBold.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle32 : VDSTypography.fontSizeTitle24)
|
||||
// }
|
||||
//
|
||||
// public static var largeRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle32 : VDSTypography.fontSizeTitle24)
|
||||
// }
|
||||
//
|
||||
// public static var mediumBold: UIFont{
|
||||
// return VDSFonts.dsBold.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle24 : VDSTypography.fontSizeTitle20)
|
||||
// }
|
||||
//
|
||||
// public static var mediumRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle24 : VDSTypography.fontSizeTitle20)
|
||||
// }
|
||||
//
|
||||
// public static var smallBold: UIFont{
|
||||
// return VDSFonts.dsBold.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle20 : VDSTypography.fontSizeTitle16)
|
||||
// }
|
||||
//
|
||||
// public static var smallRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle20 : VDSTypography.fontSizeTitle16)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public enum Body: BodyTypograhyProtocol {
|
||||
// public static var largeBold: UIFont {
|
||||
// return VDSFonts.dsBold.font(ofSize: VDSTypography.fontSizeBody16)
|
||||
// }
|
||||
//
|
||||
// public static var largeRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: VDSTypography.fontSizeBody16)
|
||||
// }
|
||||
//
|
||||
// public static var mediumBold: UIFont{
|
||||
// return VDSFonts.dsBold.font(ofSize: VDSTypography.fontSizeBody14)
|
||||
// }
|
||||
//
|
||||
// public static var mediumRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: VDSTypography.fontSizeBody14)
|
||||
// }
|
||||
//
|
||||
// public static var smallBold: UIFont{
|
||||
// return VDSFonts.dsBold.font(ofSize: VDSTypography.fontSizeBody12)
|
||||
// }
|
||||
//
|
||||
// public static var smallRegular: UIFont{
|
||||
// return VDSFonts.dsRegular.font(ofSize: VDSTypography.fontSizeBody12)
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public enum Micro: MicroTypographyProtocol {
|
||||
// public static var bold: UIFont {
|
||||
// return VDSFonts.txBold.font(ofSize: VDSTypography.fontSizeMicro11)
|
||||
// }
|
||||
//
|
||||
// public static var regular: UIFont {
|
||||
// return VDSFonts.txRegular.font(ofSize: VDSTypography.fontSizeMicro11)
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
140
VDS/Typography/VDSFontStyles.swift
Normal file
140
VDS/Typography/VDSFontStyles.swift
Normal file
@ -0,0 +1,140 @@
|
||||
//
|
||||
// VDSFontStyles.swift
|
||||
// VDS
|
||||
//
|
||||
// Created by Matt Bruce on 7/27/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import VDSTypographyTokens
|
||||
|
||||
public struct VDSFontStyles {
|
||||
|
||||
public enum Feature {
|
||||
|
||||
private enum AvailableSize{
|
||||
case xlarge, large, medium, small, xsmall
|
||||
}
|
||||
|
||||
private static func getFont(vdsFont: VDSFonts, size: AvailableSize) -> UIFont {
|
||||
switch size {
|
||||
case .xlarge:
|
||||
return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96)
|
||||
case .large:
|
||||
return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80)
|
||||
case .medium:
|
||||
return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature96 : VDSTypography.fontSizeFeature64)
|
||||
case .small:
|
||||
return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature80 : VDSTypography.fontSizeFeature48)
|
||||
case .xsmall:
|
||||
return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40)
|
||||
}
|
||||
}
|
||||
|
||||
public enum Bold {
|
||||
public static let xlarge = getFont(vdsFont: VDSFonts.dsBold, size: .xlarge)
|
||||
public static let large = getFont(vdsFont: VDSFonts.dsBold, size: .large)
|
||||
public static let medium = getFont(vdsFont: VDSFonts.dsBold, size: .medium)
|
||||
public static let small = getFont(vdsFont: VDSFonts.dsBold, size: .small)
|
||||
public static let xsmall = getFont(vdsFont: VDSFonts.dsBold, size: .xsmall)
|
||||
}
|
||||
|
||||
public enum Regular {
|
||||
public static let xlarge = getFont(vdsFont: VDSFonts.dsRegular, size: .xlarge)
|
||||
public static let large = getFont(vdsFont: VDSFonts.dsRegular, size: .large)
|
||||
public static let medium = getFont(vdsFont: VDSFonts.dsRegular, size: .medium)
|
||||
public static let small = getFont(vdsFont: VDSFonts.dsRegular, size: .small)
|
||||
public static let xsmall = getFont(vdsFont: VDSFonts.dsRegular, size: .xsmall)
|
||||
}
|
||||
}
|
||||
|
||||
public enum Title {
|
||||
|
||||
private enum AvailableSize{
|
||||
case xxlarge, xlarge, large, medium, small
|
||||
}
|
||||
|
||||
private static func getFont(vdsFont: VDSFonts, size: AvailableSize) -> UIFont {
|
||||
switch size {
|
||||
case .xxlarge:
|
||||
return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle64 : VDSTypography.fontSizeTitle40)
|
||||
case .xlarge:
|
||||
return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle48 : VDSTypography.fontSizeTitle32)
|
||||
case .large:
|
||||
return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle32 : VDSTypography.fontSizeTitle24)
|
||||
case .medium:
|
||||
return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle24 : VDSTypography.fontSizeTitle20)
|
||||
case .small:
|
||||
return vdsFont.font(ofSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle20 : VDSTypography.fontSizeTitle16)
|
||||
}
|
||||
}
|
||||
|
||||
public enum Bold {
|
||||
public static let xxlarge = getFont(vdsFont: VDSFonts.dsBold, size: .xxlarge)
|
||||
public static let xlarge = getFont(vdsFont: VDSFonts.dsBold, size: .xlarge)
|
||||
public static let large = getFont(vdsFont: VDSFonts.dsBold, size: .large)
|
||||
public static let medium = getFont(vdsFont: VDSFonts.dsBold, size: .medium)
|
||||
public static let small = getFont(vdsFont: VDSFonts.dsBold, size: .small)
|
||||
}
|
||||
|
||||
public enum Regular {
|
||||
public static let xxlarge = getFont(vdsFont: VDSFonts.dsBold, size: .xxlarge)
|
||||
public static let xlarge = getFont(vdsFont: VDSFonts.dsRegular, size: .xlarge)
|
||||
public static let large = getFont(vdsFont: VDSFonts.dsRegular, size: .large)
|
||||
public static let medium = getFont(vdsFont: VDSFonts.dsRegular, size: .medium)
|
||||
public static let small = getFont(vdsFont: VDSFonts.dsRegular, size: .small)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum Body {
|
||||
|
||||
private enum AvailableSize{
|
||||
case large, medium, small
|
||||
}
|
||||
|
||||
private static func getFont(vdsFont: VDSFonts, size: AvailableSize) -> UIFont {
|
||||
switch size {
|
||||
case .large:
|
||||
return vdsFont.font(ofSize: VDSTypography.fontSizeBody16)
|
||||
case .medium:
|
||||
return vdsFont.font(ofSize: VDSTypography.fontSizeBody14)
|
||||
case .small:
|
||||
return vdsFont.font(ofSize: VDSTypography.fontSizeBody12)
|
||||
}
|
||||
}
|
||||
|
||||
public enum Bold {
|
||||
public static let large = getFont(vdsFont: VDSFonts.dsBold, size: .large)
|
||||
public static let medium = getFont(vdsFont: VDSFonts.dsBold, size: .medium)
|
||||
public static let small = getFont(vdsFont: VDSFonts.dsBold, size: .small)
|
||||
}
|
||||
|
||||
public enum Regular {
|
||||
public static let large = getFont(vdsFont: VDSFonts.dsRegular, size: .large)
|
||||
public static let medium = getFont(vdsFont: VDSFonts.dsRegular, size: .medium)
|
||||
public static let small = getFont(vdsFont: VDSFonts.dsRegular, size: .small)
|
||||
}
|
||||
}
|
||||
|
||||
public enum Micro: MicroTypographyProtocol {
|
||||
private static func getFont(vdsFont: VDSFonts) -> UIFont {
|
||||
return vdsFont.font(ofSize: VDSTypography.fontSizeMicro11)
|
||||
}
|
||||
|
||||
public static var bold: UIFont {
|
||||
return getFont(vdsFont: .txBold)
|
||||
}
|
||||
|
||||
public static var regular: UIFont {
|
||||
return getFont(vdsFont: .txRegular)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension UIDevice {
|
||||
static var isIPad: Bool {
|
||||
UIDevice.current.userInterfaceIdiom == .pad
|
||||
}
|
||||
}
|
||||
32
VDS/Typography/VDSFonts.swift
Normal file
32
VDS/Typography/VDSFonts.swift
Normal file
@ -0,0 +1,32 @@
|
||||
//
|
||||
// Fonts.swift
|
||||
// VDS
|
||||
//
|
||||
// Created by Matt Bruce on 7/27/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum VDSFonts: String, FontProtocol {
|
||||
case dsBold
|
||||
case dsRegular
|
||||
case txBold
|
||||
case txRegular
|
||||
|
||||
public var fontName: String {
|
||||
switch self {
|
||||
case .dsBold:
|
||||
return "VerizonNHGeDS-Bold"
|
||||
case .dsRegular:
|
||||
return "VerizonNHGeDS-Regular"
|
||||
case .txBold:
|
||||
return "VerizonNHGeTX-Bold"
|
||||
case .txRegular:
|
||||
return "VerizonNHGeTX-Regular"
|
||||
}
|
||||
}
|
||||
|
||||
public var fontFileExtension: String {
|
||||
return "otf"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user