Add separate custom font support for heading and body#3857
Closed
HarshankPatel9038 wants to merge 6 commits intoShopify:mainfrom
Closed
Add separate custom font support for heading and body#3857HarshankPatel9038 wants to merge 6 commits intoShopify:mainfrom
HarshankPatel9038 wants to merge 6 commits intoShopify:mainfrom
Conversation
HarshankPatel9038
commented
Sep 23, 2025
- Added checkboxes to enable custom heading and custom body fonts independently.
- Updated settings_schema.json with font URL and family fields for both heading and body.
- Improved font loader logic to handle all common font variants (100–900, normal & italic).
- Supports both local .woff2 fonts and Google Fonts URLs.
- This makes theme font customization more flexible, maintainable, and clear for merchants.
Author
|
Update ThemeThis PR introduces a reusable and unified custom font loading system for both heading and body fonts. Merchants can now enable custom fonts independently for headings and body text, using either local .woff2 files (with auto-generated weight/style variants) or external Google Fonts links. |
Updated with some italic variants
The existing custom font implementation in Dawn only supported a single WOFF2 file or a small subset of naming conventions. Merchants who uploaded full font families—including italic styles—were often unable to use italic emphasis in typography throughout the storefront. Even when italic font files existed in /assets, the theme failed to detect and register them because the filename-matching logic only supported a narrow pattern. This PR introduces support for a much broader set of font naming conventions that are commonly used by font vendors. The logic now attempts to map multiple combinations of font weight and style by cycling through several filename candidates for each expected variant. This includes common patterns such as: FontFamily-Regular.woff2 FontFamily-RegularItalic.woff2 FontFamily-Regular-Italic.woff2 FontFamily-Italic.woff2 FontFamily-BoldItalic.woff2 FontFamily-Bold-Italic.woff2 etc. The theme loops through all supported font weights (100–900) and both normal and italic styles, automatically generating multiple @font-face definitions conditioned on whether the relevant file exists. This means: No manual configuration is required from merchants. No assumptions are made about naming convention of font files. If a variant file does not exist, it is simply skipped — no 404 requests are generated. With this enhancement, merchants benefit from: Correct typography rendering when emphasizing text with italic styles. Greater flexibility to upload complete font families. More professional-looking results for stores with brand typography requirements. This change maintains backward compatibility and does not affect merchants who do not upload custom fonts.
|
This pull request has been marked as stale due to inactivity for 60 days. If no further activity occurs, it will be closed in 7 days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.