Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP GlassKit7// File : Sources/SPGlassTokens/GlassTypography.swift8// Module : SPGlassTokens9// Repository : https://git.spboucher.ai/sp-glasskit10// Project Website : https://glass.spboucher.ai11// Created : 2026-12-0212// Last Modified : 2026-12-0213//14// Author : Simon-Pierre Boucher15// Position : Professor of Finance16// Institution : Université du Québec en Outaouais (UQO)17// Organization : SP Boucher18// Website : https://spboucher.ai19// Git : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development : dev@spboucher.ai23// Support : support@spboucher.ai24// Security/Admin : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License : MIT33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import Foundation4243/// Typeface family, limited to the designs of the system font. No font file is ever bundled.44public enum GlassFontDesign: String, Codable, CaseIterable, Sendable {45 case `default`, rounded, serif, monospaced46}4748public enum GlassFontWeight: String, Codable, CaseIterable, Sendable {49 case regular, medium, semibold, bold50}5152/// Text roles used by components. Each maps to a Dynamic Type text style, so sizes follow the user's setting.53public enum GlassTextRole: String, Codable, CaseIterable, Sendable {54 case largeTitle, title, headline, body, callout, caption, monospacedValue55}5657/// Typography tokens: the design and weights of the system font. Sizes belong to Dynamic Type.58public struct GlassTypography: Hashable, Codable, Sendable {59 public var design: GlassFontDesign60 public var headingWeight: GlassFontWeight61 public var bodyWeight: GlassFontWeight6263 public init(design: GlassFontDesign = .default, headingWeight: GlassFontWeight = .semibold, bodyWeight: GlassFontWeight = .regular) {64 self.design = design65 self.headingWeight = headingWeight66 self.bodyWeight = bodyWeight67 }6869 public init(from decoder: any Decoder) throws {70 let c = try decoder.container(keyedBy: CodingKeys.self)71 let d = GlassTypography()72 design = try c.decodeIfPresent(GlassFontDesign.self, forKey: .design) ?? d.design73 headingWeight = try c.decodeIfPresent(GlassFontWeight.self, forKey: .headingWeight) ?? d.headingWeight74 bodyWeight = try c.decodeIfPresent(GlassFontWeight.self, forKey: .bodyWeight) ?? d.bodyWeight75 }7677 public static let standard = GlassTypography()78}79