Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
6ae6cd9c42
commit
9cd84e1cac
4
PRD.md
4
PRD.md
@ -31,7 +31,7 @@ TheNoiseClock is a SwiftUI-based iOS application that combines a customizable di
|
|||||||
- **Opacity controls**: Separate opacity for clock digits and overlays
|
- **Opacity controls**: Separate opacity for clock digits and overlays
|
||||||
- **Random color mode**: Automatically changes digit color every minute
|
- **Random color mode**: Automatically changes digit color every minute
|
||||||
- **Preset themes**: Quick "Night" (black/white) and "Day" (white/black) themes
|
- **Preset themes**: Quick "Night" (black/white) and "Day" (white/black) themes
|
||||||
- **Font family selection**: Choose from System, San Francisco, Monaco, Courier fonts
|
- **Font family selection**: Choose from System, Helvetica, Arial, Times New Roman, Georgia, Verdana, Monaco, Courier fonts
|
||||||
- **Font weight options**: Ultra Light, Thin, Light, Regular, Medium, Semibold, Bold, Heavy, Black
|
- **Font weight options**: Ultra Light, Thin, Light, Regular, Medium, Semibold, Bold, Heavy, Black
|
||||||
- **Font design choices**: Default, Serif, Rounded, Monospaced designs
|
- **Font design choices**: Default, Serif, Rounded, Monospaced designs
|
||||||
- **Live font preview**: Real-time preview of font changes in settings
|
- **Live font preview**: Real-time preview of font changes in settings
|
||||||
@ -111,7 +111,7 @@ TheNoiseClock is a SwiftUI-based iOS application that combines a customizable di
|
|||||||
- **Perfect centering**: Each digit is centered within its fixed-width container
|
- **Perfect centering**: Each digit is centered within its fixed-width container
|
||||||
|
|
||||||
### Font Customization System
|
### Font Customization System
|
||||||
- **Font family selection**: System, San Francisco, Monaco, Courier options
|
- **Font family selection**: System, Helvetica, Arial, Times New Roman, Georgia, Verdana, Monaco, Courier options
|
||||||
- **Weight variations**: 9 weight options from Ultra Light to Black
|
- **Weight variations**: 9 weight options from Ultra Light to Black
|
||||||
- **Design choices**: Default, Serif, Rounded, Monospaced designs
|
- **Design choices**: Default, Serif, Rounded, Monospaced designs
|
||||||
- **Live preview**: Real-time font preview in settings interface
|
- **Live preview**: Real-time font preview in settings interface
|
||||||
|
|||||||
@ -128,10 +128,18 @@ enum FontUtils {
|
|||||||
/// - Returns: SwiftUI Font
|
/// - Returns: SwiftUI Font
|
||||||
static func fontFamily(_ family: String) -> Font {
|
static func fontFamily(_ family: String) -> Font {
|
||||||
switch family {
|
switch family {
|
||||||
case "San Francisco":
|
|
||||||
return .system(.body, design: .default)
|
|
||||||
case "System":
|
case "System":
|
||||||
return .system(.body, design: .default)
|
return .system(.body, design: .default)
|
||||||
|
case "Helvetica":
|
||||||
|
return .custom("Helvetica", size: 17)
|
||||||
|
case "Arial":
|
||||||
|
return .custom("Arial", size: 17)
|
||||||
|
case "Times New Roman":
|
||||||
|
return .custom("Times New Roman", size: 17)
|
||||||
|
case "Georgia":
|
||||||
|
return .custom("Georgia", size: 17)
|
||||||
|
case "Verdana":
|
||||||
|
return .custom("Verdana", size: 17)
|
||||||
case "Monaco":
|
case "Monaco":
|
||||||
return .system(.body, design: .monospaced)
|
return .system(.body, design: .monospaced)
|
||||||
case "Courier":
|
case "Courier":
|
||||||
@ -200,11 +208,19 @@ enum FontUtils {
|
|||||||
weight: String,
|
weight: String,
|
||||||
design: String
|
design: String
|
||||||
) -> Font {
|
) -> Font {
|
||||||
return .system(
|
// For system fonts, use the system font with design
|
||||||
size: size,
|
if family == "System" || family == "Monaco" || family == "Courier" {
|
||||||
weight: fontWeight(weight),
|
return .system(
|
||||||
design: fontDesign(design)
|
size: size,
|
||||||
)
|
weight: fontWeight(weight),
|
||||||
|
design: fontDesign(design)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// For custom fonts, create with weight
|
||||||
|
let fontWeight = fontWeight(weight)
|
||||||
|
return .custom(family, size: size)
|
||||||
|
.weight(fontWeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calculate the maximum width for any two-digit combination
|
/// Calculate the maximum width for any two-digit combination
|
||||||
@ -305,10 +321,16 @@ enum FontUtils {
|
|||||||
uiDesign = .default
|
uiDesign = .default
|
||||||
}
|
}
|
||||||
|
|
||||||
let descriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body)
|
// For system fonts, use system font descriptor with design
|
||||||
.withDesign(uiDesign) ?? UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body)
|
if family == "System" || family == "Monaco" || family == "Courier" {
|
||||||
|
let descriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body)
|
||||||
|
.withDesign(uiDesign) ?? UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body)
|
||||||
|
|
||||||
return UIFont(descriptor: descriptor.addingAttributes([.traits: [UIFontDescriptor.TraitKey.weight: uiWeight]]), size: size)
|
return UIFont(descriptor: descriptor.addingAttributes([.traits: [UIFontDescriptor.TraitKey.weight: uiWeight]]), size: size)
|
||||||
|
}
|
||||||
|
|
||||||
|
// For custom fonts, create with family name and weight
|
||||||
|
return UIFont(name: family, size: size) ?? UIFont.systemFont(ofSize: size, weight: uiWeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Measure text size with given font
|
/// Measure text size with given font
|
||||||
|
|||||||
@ -55,7 +55,7 @@ struct ClockSettingsView: View {
|
|||||||
private struct FontSection: View {
|
private struct FontSection: View {
|
||||||
@Binding var style: ClockStyle
|
@Binding var style: ClockStyle
|
||||||
|
|
||||||
private let fontFamilies = ["System", "San Francisco", "Monaco", "Courier"]
|
private let fontFamilies = ["System", "Arial", "Courier", "Georgia", "Helvetica", "Monaco", "Times New Roman", "Verdana"]
|
||||||
private let fontWeights = ["Ultra Light", "Thin", "Light", "Regular", "Medium", "Semibold", "Bold", "Heavy", "Black"]
|
private let fontWeights = ["Ultra Light", "Thin", "Light", "Regular", "Medium", "Semibold", "Bold", "Heavy", "Black"]
|
||||||
private let fontDesigns = ["Default", "Serif", "Rounded", "Monospaced"]
|
private let fontDesigns = ["Default", "Serif", "Rounded", "Monospaced"]
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user