1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! # Font Loading and Registration
//!
//! Handles embedding and registering custom fonts with Kael for consistent typography
//! across the component library. Fonts are embedded at compile time for reliable distribution.
//! ## Font Families
//!
//! - **Inter**: Primary UI font family (sans-serif) - clean, modern, highly legible
//! - **JetBrains Mono**: Monospace font for code, terminals, and technical content
//!
//! ## Font Weights
//!
//! - **Regular (400)**: Default weight for body text and labels
//! - **Medium (500)**: Slightly heavier for emphasis and buttons
//! - **SemiBold (600)**: For headings and important UI elements
//! - **Bold (700)**: For strong emphasis and primary actions
//!
//! ## Design Decisions
//!
//! - **Compile-time Embedding**: Fonts are included in the binary for consistent rendering
//! - **Limited Weights**: Only essential weights to minimize binary size
//! - **Cross-platform**: Fonts chosen for excellent rendering across all platforms
//! - **Performance**: Fonts loaded once at startup, cached by Kael's text system
//! - **Fallback**: System fonts used if custom fonts fail to load
//!
//! ## Usage
//!
//! Fonts are automatically registered when calling `kael_ui::init(cx)`.
//! Access font families through the theme system or utility functions.
//!
//! ```rust,ignore
//! // Access via theme (recommended)
//! let theme = use_theme();
//! div().font_family(theme.tokens.font_family.clone())
//!
//! // Direct access to font families
//! ui_font_family() // -> "Inter"
//! mono_font_family() // -> "JetBrains Mono"
//! ```
//!
use *;
/// Font family names used throughout the UI
pub const UI_FONT_FAMILY: &str = "Inter";
pub const UI_MONO_FONT_FAMILY: &str = "JetBrains Mono";
// Embed font files at compile time
// Note: You'll need to place font files in assets/fonts/ directory
// Example fonts (you can replace these with your preferred fonts):
// - Inter: https://rsms.me/inter/
// - JetBrains Mono: https://www.jetbrains.com/lp/mono/
// Regular weights
const INTER_REGULAR: & = include_bytes!;
const INTER_MEDIUM: & = include_bytes!;
const INTER_SEMIBOLD: & = include_bytes!;
const INTER_BOLD: & = include_bytes!;
// Monospace
const JETBRAINS_MONO_REGULAR: & = include_bytes!;
const JETBRAINS_MONO_BOLD: & = include_bytes!;
/// Register all embedded fonts with Kael
///
/// This should be called during application initialization before any UI is rendered.
///
/// # Example
/// ```ignore
/// use kael_ui::fonts;
///
/// Application::new().run(|cx| {
/// fonts::register_fonts(cx);
/// // ... rest of initialization
/// });
/// ```
/// Get the default UI font family
/// Get the default monospace font family