You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hugegraph.apache.org by "VGalaxies (via GitHub)" <gi...@apache.org> on 2025/09/28 09:46:44 UTC
[PR] chore: implement self-hosted fonts for improved privacy and performance [incubator-hugegraph-doc]
VGalaxies opened a new pull request, #418:
URL: https://github.com/apache/incubator-hugegraph-doc/pull/418
close https://github.com/apache/incubator-hugegraph/issues/2854
---
## ๐ Description
This PR implements self-hosted fonts for the HugeGraph documentation website, replacing external CDN font loading with local font files. This change improves website privacy, performance, and reliability by eliminating external dependencies for font loading.
## ๐ง Changes Made
### Font Implementation
- **Added 38 self-hosted font files** supporting 4 font families:
- **Open Sans** (300, 400, 700 weights + italic variants) - Primary UI font
- **Rubik** (300, 400, 500, 600, 700 weights) - Hebrew language support
- **Tajawal** (300, 400, 500, 700 weights) - Arabic language support
- **Vazir** (300, 400, 500, 700 weights) - Persian/Farsi language support
### Configuration Updates
- **Disabled external Google Fonts loading** by setting `$td-enable-google-fonts: false`
- **Removed CDN font imports** from RTL stylesheet for multilingual fonts
- **Added comprehensive @font-face declarations** in `assets/scss/_variables_project.scss`
- **Implemented font-display: swap** for optimal loading performance
### Multilingual Support
- Maintained full support for RTL languages (Arabic, Persian, Hebrew)
- Preserved existing font fallback chains for compatibility
- Ensured consistent typography across all supported languages
## ๐ Benefits
- **๐ Privacy**: No external requests to Google Fonts or other CDNs
- **โก Performance**: Faster loading with local font files and font-display: swap
- **๐ก๏ธ Reliability**: Eliminates dependency on external CDN availability
- **๐ Offline Support**: Fonts work without internet connectivity
- **๐ฑ Consistency**: Same fonts guaranteed across all users and environments
## ๐งช Testing
- [x] Website builds successfully with `hugo server`
- [x] All font weights and styles load correctly
- [x] Multilingual pages display proper fonts (Arabic, Persian, Hebrew)
- [x] No external font requests in browser network tab
- [x] Font fallbacks work as expected
## ๐ File Changes
- **Added**: 38 font files in `assets/fonts/` (WOFF and WOFF2 formats)
- **Modified**: `assets/scss/_variables_project.scss` - Added @font-face declarations
- **Modified**: `themes/docsy/assets/scss/_variables.scss` - Disabled Google Fonts
- **Modified**: `themes/docsy/assets/scss/rtl/_main.scss` - Removed external font imports
## ๐ Related Issues
Addresses website performance and privacy concerns by implementing self-hosted fonts as requested.
---
**Total size**: ~1.8MB of font files added
**Formats supported**: WOFF2 (modern browsers) + WOFF (fallback)
**Languages supported**: English, Arabic, Persian/Farsi, Hebrew
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] chore: implement self-hosted fonts for improved privacy and performance [incubator-hugegraph-doc]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #418:
URL: https://github.com/apache/incubator-hugegraph-doc/pull/418#discussion_r2385903006
##########
assets/scss/_variables_project.scss:
##########
@@ -4,3 +4,179 @@ Add styles or override variables from the theme here.
*/
+// Self-hosted font declarations
+// Open Sans font family
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 300;
+ font-display: swap;
+ src: url('/assets/fonts/OpenSans-Light.woff2') format('woff2'),
Review Comment:
Font path handling may break in subdirectory deployments. Consider using relative paths without leading slash to support different deployment scenarios:
```suggestion
src: url('../fonts/OpenSans-Light.woff2') format('woff2'),
url('../fonts/OpenSans-Light.woff') format('woff');
```
This ensures fonts load correctly whether the site is deployed at root (/) or a subdirectory (/docs/).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] chore: implement self-hosted fonts for improved privacy and performance [incubator-hugegraph-doc]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on PR #418:
URL: https://github.com/apache/incubator-hugegraph-doc/pull/418#issuecomment-3343455661
Test comment via --body parameter
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] chore: implement self-hosted fonts for improved privacy and performance [incubator-hugegraph-doc]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #418:
URL: https://github.com/apache/incubator-hugegraph-doc/pull/418#discussion_r2385903682
##########
themes/docsy/assets/scss/_variables.scss:
##########
@@ -66,7 +66,7 @@ $link-hover-decoration: none !default;
$google_font_name: "Open Sans" !default;
$google_font_family: "Open+Sans:300,300i,400,400i,700,700i" !default;
-$web-font-path: "https://fonts.googleapis.com/css?family=#{$google_font_family}&display=swap";
+// $web-font-path: "https://fonts.googleapis.com/css?family=#{$google_font_family}&display=swap"; // Disabled for self-hosted fonts
Review Comment:
Commented-out code should be removed rather than left as a comment. Consider cleaner removal:
```suggestion
// Removed for self-hosted fonts - see assets/scss/_variables_project.scss
```
This improves maintainability by avoiding commented-out code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] chore: implement self-hosted fonts for improved privacy and performance [incubator-hugegraph-doc]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #418:
URL: https://github.com/apache/incubator-hugegraph-doc/pull/418#discussion_r2385861367
##########
assets/scss/_variables_project.scss:
##########
@@ -4,3 +4,179 @@ Add styles or override variables from the theme here.
*/
+// Self-hosted font declarations
+// Open Sans font family
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 300;
+ font-display: swap;
+ src: url('/assets/fonts/OpenSans-Light.woff2') format('woff2'),
Review Comment:
**Should Fix**: Path consistency issue with font URLs
The font paths use absolute URLs (`/assets/fonts/`) which could break in subdirectory deployments or development environments. Consider using relative paths or Hugo's asset pipeline:
```suggestion
src: url('../fonts/OpenSans-Light.woff2') format('woff2'),
url('../fonts/OpenSans-Light.woff') format('woff');
```
This applies to all 38 @font-face declarations. Using relative paths would ensure the fonts load correctly regardless of the deployment path.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] chore: implement self-hosted fonts for improved privacy and performance [incubator-hugegraph-doc]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #418:
URL: https://github.com/apache/incubator-hugegraph-doc/pull/418#discussion_r2385862576
##########
assets/scss/_variables_project.scss:
##########
@@ -4,3 +4,179 @@ Add styles or override variables from the theme here.
*/
+// Self-hosted font declarations
+// Open Sans font family
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 300;
+ font-display: swap;
+ src: url('/assets/fonts/OpenSans-Light.woff2') format('woff2'),
+ url('/assets/fonts/OpenSans-Light.woff') format('woff');
+}
+
+@font-face {
+ font-family: 'Open Sans';
+ font-style: italic;
+ font-weight: 300;
+ font-display: swap;
+ src: url('/assets/fonts/OpenSans-LightItalic.woff2') format('woff2'),
+ url('/assets/fonts/OpenSans-LightItalic.woff') format('woff');
+}
+
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 400;
+ font-display: swap;
+ src: url('/assets/fonts/OpenSans-Regular.woff2') format('woff2'),
+ url('/assets/fonts/OpenSans-Regular.woff') format('woff');
+}
+
+@font-face {
+ font-family: 'Open Sans';
+ font-style: italic;
+ font-weight: 400;
+ font-display: swap;
+ src: url('/assets/fonts/OpenSans-Italic.woff2') format('woff2'),
+ url('/assets/fonts/OpenSans-Italic.woff') format('woff');
+}
+
+@font-face {
+ font-family: 'Open Sans';
+ font-style: normal;
+ font-weight: 700;
+ font-display: swap;
+ src: url('/assets/fonts/OpenSans-Bold.woff2') format('woff2'),
+ url('/assets/fonts/OpenSans-Bold.woff') format('woff');
+}
+
+@font-face {
+ font-family: 'Open Sans';
+ font-style: italic;
+ font-weight: 700;
+ font-display: swap;
+ src: url('/assets/fonts/OpenSans-BoldItalic.woff2') format('woff2'),
+ url('/assets/fonts/OpenSans-BoldItalic.woff') format('woff');
+}
Review Comment:
**Nice to Have**: Consider font subsetting for performance optimization
For the multilingual fonts (Arabic, Persian, Hebrew), consider using Unicode range subsetting to reduce file sizes for users who don't need these character sets:
```suggestion
@font-face {
font-family: 'Rubik';
font-style: normal;
font-weight: 300;
font-display: swap;
unicode-range: U+0590-05FF, U+FB1D-FB4F; /* Hebrew range */
src: url('/assets/fonts/Rubik-Light.woff2') format('woff2'),
url('/assets/fonts/Rubik-Light.woff') format('woff');
}
```
This would improve loading performance for users who don't need these specific language characters.
##########
assets/scss/_variables_project.scss:
##########
@@ -4,3 +4,179 @@ Add styles or override variables from the theme here.
*/
+// Self-hosted font declarations
Review Comment:
**Nice to Have**: Add documentation for font configuration
Consider adding a comment block at the top of this file documenting:
- Total font file sizes per family
- Browser compatibility notes (WOFF2 vs WOFF fallback strategy)
- Instructions for adding new font families
- Font preloading strategy for critical fonts
This would help future maintainers understand the font hosting setup and make informed decisions about modifications.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] chore: implement self-hosted fonts for improved privacy and performance [incubator-hugegraph-doc]
Posted by "VGalaxies (via GitHub)" <gi...@apache.org>.
VGalaxies merged PR #418:
URL: https://github.com/apache/incubator-hugegraph-doc/pull/418
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] chore: implement self-hosted fonts for improved privacy and performance [incubator-hugegraph-doc]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on PR #418:
URL: https://github.com/apache/incubator-hugegraph-doc/pull/418#issuecomment-3343427624
## PR Review Summary
### โ
Overall Assessment
The implementation for self-hosting fonts is technically sound and achieves the stated goals of improving privacy, performance, and reliability. The PR effectively removes external CDN dependencies.
### ๐ Review Findings
**Critical Problems**: None identified
**Should Fix** (2 items):
1. Font URL paths using absolute paths could break in subdirectory deployments
2. Commented code should be removed rather than disabled
**Nice to Have** (3 items):
1. Unicode range subsetting for multilingual fonts to optimize performance
2. Font preloading strategy for critical fonts
3. Documentation improvements for future maintainers
### ๐งช Additional Testing Recommendations
- Test font loading in subdirectory deployments (e.g., `/docs/` instead of root `/`)
- Verify font rendering in browsers without WOFF2 support
- Test offline mode to confirm fonts load without network access
- Measure performance impact with Lighthouse before/after comparison
### โ
Pre-merge Checklist
- โ No breaking changes to public APIs
- โ Reasonable PR size (~1.8MB font files is acceptable)
- โ Clear rollback path available
- โ Privacy improvement achieved
- โ ๏ธ Consider documenting this change in release notes
The privacy and performance benefits justify the added font files. Main concerns are around path handling for different deployment scenarios. Great work on implementing this improvement! ๐
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] chore: implement self-hosted fonts for improved privacy and performance [incubator-hugegraph-doc]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #418:
URL: https://github.com/apache/incubator-hugegraph-doc/pull/418#discussion_r2385862002
##########
themes/docsy/assets/scss/_variables.scss:
##########
@@ -66,7 +66,7 @@ $link-hover-decoration: none !default;
$google_font_name: "Open Sans" !default;
$google_font_family: "Open+Sans:300,300i,400,400i,700,700i" !default;
-$web-font-path: "https://fonts.googleapis.com/css?family=#{$google_font_family}&display=swap";
+// $web-font-path: "https://fonts.googleapis.com/css?family=#{$google_font_family}&display=swap"; // Disabled for self-hosted fonts
Review Comment:
**Should Fix**: Commented code should be removed instead of disabled
Rather than commenting out the `$web-font-path` variable, it would be cleaner to remove it entirely since it's no longer needed with self-hosted fonts. Dead code comments can cause confusion for future maintainers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] chore: implement self-hosted fonts for improved privacy and performance [incubator-hugegraph-doc]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on code in PR #418:
URL: https://github.com/apache/incubator-hugegraph-doc/pull/418#discussion_r2385911494
##########
themes/docsy/assets/scss/_variables.scss:
##########
@@ -13,7 +13,7 @@ $enable-shadows: true !default;
Review Comment:
Critical: Avoid editing files under themes/. Set $td-enable-google-fonts: false in project override (assets/scss/_variables_project.scss) to prevent breakage on theme upgrades. Revert this change here and keep theme files pristine.
##########
themes/docsy/assets/scss/_variables.scss:
##########
@@ -66,7 +66,7 @@ $link-hover-decoration: none !default;
Review Comment:
Not necessary to comment out $web-font-path here if $td-enable-google-fonts: false is set via project override. Prefer keeping the theme file untouched and place overrides in assets/scss/_variables_project.scss.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] chore: implement self-hosted fonts for improved privacy and performance [incubator-hugegraph-doc]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on PR #418:
URL: https://github.com/apache/incubator-hugegraph-doc/pull/418#issuecomment-3343455127
Test comment body
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org