Font Switching Guide
This guide explains how to switch between different font configurations in your Jekyll portfolio site.
Available Font Sets
1. Noto Sans (Default)
- Body Font: Noto Sans
- Heading Font: Roboto Slab
- Source: Google Fonts
- Status: Ready to use
2. Freight Sans Pro
- Body Font: Freight Sans Pro
- Heading Font: Freight Sans Pro
- Source: Local font files
- Status: Ready to use
How to Switch Fonts
Using the Font Switcher Script
The easiest way to switch fonts is using the provided Python script:
# Switch to Noto Sans (default)
python tools/font-switcher.py noto
# Switch to Freight Sans Pro
python tools/font-switcher.py freight
# Check current font configuration
python tools/font-switcher.py status
Manual Configuration
You can also manually edit _config.yml and change the font_set value:
# For Noto Sans
font_set: noto
# For Freight Sans Pro
font_set: freight
Setting Up Freight Sans Pro
To use Freight Sans Pro, you need to:
-
Font Files: The Freight Sans Pro font files are already included in the
assets/fonts/directory. - Switch to Freight Sans Pro:
python tools/font-switcher.py freight - Rebuild the site:
bundle exec jekyll build bundle exec jekyll serve
Font Configuration Details
Configuration Files
_config.yml: Contains the font switching logic and font definitionsassets/css/font-switcher.css: Contains the CSS for Freight Sans Pro font faces and overrides_includes/my-head.html: Conditionally loads the font switcher CSStools/font-switcher.py: Utility script for easy font switching
How It Works
- The
font_setconfiguration in_config.ymldetermines which font to use - When
font_setis set tofreight, the site:- Loads the
font-switcher.cssfile - Applies the
font-freightclass to the HTML element - Uses Freight Sans Pro for all text elements
- Loads the
- When
font_setis set tonoto(or any other value), the site uses the default Noto Sans configuration
Adding New Fonts
To add a new font set:
- Update
_config.yml: Add the new font configuration - Update
assets/css/font-switcher.css: Add the font-face declarations and CSS overrides - Update
_includes/my-head.html: Add the conditional loading logic - Update
tools/font-switcher.py: Add the new font option to the script
Troubleshooting
Font Not Loading
- Check that the font files exist in the
assets/fonts/directory - Verify the font file paths in
font-switcher.css - Check browser developer tools for any 404 errors
- Ensure the font files are accessible and not corrupted
Font Not Applying
- Ensure the
font_setvalue is correct in_config.yml - Check that the CSS is being loaded (inspect the page source)
- Verify that the
font-freightclass is applied to the HTML element
Build Errors
- Make sure all YAML syntax is correct
- Check that all referenced files exist
- Verify that the font switcher script has execute permissions
Notes
- Freight Sans Pro is a commercial font that requires proper licensing
- The font switching system is designed to be easily extensible for additional fonts
- All font configurations are preserved in the config file for easy switching
- The system uses CSS classes and custom properties for maximum compatibility
- Local font files provide better performance and offline support