diff --git a/css/fonts.css b/css/fonts.css index d57dc75..82a8c5f 100644 --- a/css/fonts.css +++ b/css/fonts.css @@ -1,35 +1,142 @@ +/* ========================= + Local Fonts + ========================= */ + +/* OSWALD */ +@font-face { + font-family: 'Oswald'; + src: url('../fonts/oswald-400.woff2') format('woff2'); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'Oswald'; + src: url('../fonts/oswald-500.woff2') format('woff2'); + font-weight: 500; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: 'Oswald'; + src: url('../fonts/oswald-700.woff2') format('woff2'); + font-weight: 700; + font-style: normal; + font-display: swap; +} + + +/* ROBOTO */ +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 400; + font-stretch: 100%; + font-display: swap; + src: url('../fonts/roboto-400.woff2') format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, + U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, + U+2000-206F, U+20AC, U+2122, U+2191, U+2193, + U+2212, U+2215, U+FEFF, U+FFFD; +} + +/* ROBOTO 500 */ +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 500; + font-stretch: 100%; + font-display: swap; + src: url('../fonts/roboto-500.woff2') format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, + U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, + U+2000-206F, U+20AC, U+2122, U+2191, U+2193, + U+2212, U+2215, U+FEFF, U+FFFD; +} + +/* ROBOTO 700 */ +@font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 700; + font-stretch: 100%; + font-display: swap; + src: url('../fonts/roboto-700.woff2') format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, + U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, + U+2000-206F, U+20AC, U+2122, U+2191, U+2193, + U+2212, U+2215, U+FEFF, U+FFFD; +} + + /* ========================= Typography System (Static) ========================= */ :root { - --primary-font: 'Oswald', sans-serif; + --primary-font: 'Oswald', var(--zeitfresser-heading-fallback); --secondary-font: 'Roboto', sans-serif; --site-identity-font-size: 40px; + --font-weight: 400; --line-height: 1.6; } -/* Base */ -body { + +/* ========================= + Base Typography + ========================= */ + +body, +p, +div, +span, +article, +section, +li, +input, +textarea, +button { font-family: var(--secondary-font); font-weight: var(--font-weight); line-height: var(--line-height); } -/* Headlines */ + +/* ========================= + Headlines (Hierarchy Fix) + ========================= */ + h1, h2, h3, h4, h5, h6, .entry-title { font-family: var(--primary-font); - font-weight: var(--font-weight); + font-weight: 500; + line-height: 1.3; } -/* Site Title */ + +/* ========================= + Site Title (Branding) + ========================= */ + .site-title, .site-title a { font-family: var(--primary-font); font-size: var(--site-identity-font-size); - font-weight: var(--font-weight); + font-weight: 700; line-height: 1.2; -} \ No newline at end of file +} + + +/* ========================= + Secondary Text + ========================= */ + +.site-description, +.entry-content, +.news-snippet .excerpt { + font-family: var(--secondary-font); +} diff --git a/fonts/oswald-400.woff2 b/fonts/oswald-400.woff2 new file mode 100644 index 0000000..3387150 Binary files /dev/null and b/fonts/oswald-400.woff2 differ diff --git a/fonts/oswald-500.woff2 b/fonts/oswald-500.woff2 new file mode 100644 index 0000000..e0f4369 Binary files /dev/null and b/fonts/oswald-500.woff2 differ diff --git a/fonts/oswald-700.woff2 b/fonts/oswald-700.woff2 new file mode 100644 index 0000000..e1290c1 Binary files /dev/null and b/fonts/oswald-700.woff2 differ diff --git a/fonts/roboto-400.woff2 b/fonts/roboto-400.woff2 new file mode 100644 index 0000000..77e4259 Binary files /dev/null and b/fonts/roboto-400.woff2 differ diff --git a/fonts/roboto-500.woff2 b/fonts/roboto-500.woff2 new file mode 100644 index 0000000..171a2f6 Binary files /dev/null and b/fonts/roboto-500.woff2 differ diff --git a/fonts/roboto-700.woff2 b/fonts/roboto-700.woff2 new file mode 100644 index 0000000..85b8ace Binary files /dev/null and b/fonts/roboto-700.woff2 differ diff --git a/functions.php b/functions.php index df9f303..cbc5975 100644 --- a/functions.php +++ b/functions.php @@ -200,19 +200,6 @@ function zeitfresser_enqueue_static_colors() { ); } add_action( 'wp_enqueue_scripts', 'zeitfresser_enqueue_static_colors', 20 ); - - /** - * Load Google Fonts (required for static font setup) - */ -function zeitfresser_enqueue_google_fonts() { - wp_enqueue_style( - 'zeitfresser-google-fonts', - 'https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;700&family=Roboto:wght@400;500;700&display=swap', - array(), - null - ); -} -add_action('wp_enqueue_scripts', 'zeitfresser_enqueue_google_fonts'); function zeitfresser_enqueue_static_fonts() { wp_enqueue_style( @@ -281,18 +268,20 @@ function zeitfresser_cleanup_wp_head() { add_action( 'init', 'zeitfresser_cleanup_wp_head' ); /** - * Ensure Google Fonts domains are allowed and preconnected + * Preload local fonts for better performance */ -add_filter('wp_resource_hints', function($urls, $relation_type) { - if ($relation_type === 'preconnect') { - $urls[] = 'https://fonts.googleapis.com'; - $urls[] = array( - 'href' => 'https://fonts.gstatic.com', - 'crossorigin' => 'anonymous', - ); - } - return $urls; -}, 10, 2); +function zeitfresser_preload_fonts() { + ?> + + + + + + + +