You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.3 KiB
65 lines
2.3 KiB
//
|
|
// Fonts.swift
|
|
// TournamentStats
|
|
//
|
|
// Created by Laurent Morvillier on 15/08/2019.
|
|
// Copyright © 2019 Stax River. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
class Fonts {
|
|
|
|
fileprivate enum FontName {
|
|
case graph
|
|
case regular
|
|
case bold
|
|
|
|
var name: String {
|
|
switch self {
|
|
case .graph:
|
|
return "Menlo-Bold"
|
|
case .regular:
|
|
return "HelveticaNeue"
|
|
case .bold:
|
|
return "HelveticaNeue-Bold"
|
|
}
|
|
}
|
|
}
|
|
|
|
static let color: UIColor = UIColor.white
|
|
static let titleColor: UIColor = UIColor.white //UIColor(r: 31, g: 222, b: 255, a: 1.0)
|
|
static let graphTextColor: UIColor = UIColor(white: 0.8, alpha: 1.0)
|
|
|
|
static var monospaced: UIFont { return Fonts.monospaced(size: 18) }
|
|
static var bigNumbers: UIFont { return Fonts.monospaced(size: 48) }
|
|
static let graph: UIFont = UIFont(name: FontName.graph.name, size: 18.0)!
|
|
|
|
static let small: UIFont = UIFont(name: FontName.regular.name, size: 16.0)!
|
|
static let regular: UIFont = UIFont(name: FontName.regular.name, size: 18.0)!
|
|
static let bold: UIFont = UIFont(name: FontName.bold.name, size: 18.0)!
|
|
|
|
static let mainTitle: UIFont = UIFont(name: FontName.bold.name, size: 72.0)!
|
|
static let title: UIFont = UIFont(name: FontName.bold.name, size: 36.0)!
|
|
static let subTitle: UIFont = UIFont(name: FontName.regular.name, size: 28.0)!
|
|
static let cellTitle: UIFont = UIFont(name: FontName.regular.name, size: 20.0)!
|
|
|
|
static let chartEntries: UIFont = UIFont(name: FontName.bold.name, size: 28.0)!
|
|
static let chartLegend: UIFont = UIFont(name: FontName.regular.name, size: 18.0)!
|
|
|
|
fileprivate static func monospaced(size: CGFloat = 18.0, weight: UIFont.Weight = .regular) -> UIFont {
|
|
let features = [
|
|
[
|
|
UIFontDescriptor.FeatureKey.featureIdentifier: kNumberSpacingType,
|
|
UIFontDescriptor.FeatureKey.typeIdentifier: kMonospacedNumbersSelector
|
|
]
|
|
]
|
|
|
|
let fontDescriptor = UIFont.systemFont(ofSize: size, weight: weight).fontDescriptor.addingAttributes(
|
|
[UIFontDescriptor.AttributeName.featureSettings: features]
|
|
)
|
|
return UIFont(descriptor: fontDescriptor, size: size)
|
|
}
|
|
|
|
}
|
|
|