Astro automatically optimizes font loading to improve page speed. What is the default behavior of Astro regarding font optimization?
Think about how browsers prioritize font loading to avoid invisible text.
Astro preloads fonts with <link rel="preload"> and applies font-display: swap to ensure text is visible while fonts load, improving user experience.
Astro supports automatic Google Fonts optimization. Which config snippet correctly enables this feature?
Look for correct capitalization and property names in the integration.
The correct integration uses googleFonts with the option optimize: true inside the integrations array.
Consider this Astro component snippet that tries to optimize a custom font:
<link rel="stylesheet" href="https://example.com/fonts/custom-font.css" />
Font optimization does not work as expected. What is the most likely cause?
Think about which font sources Astro can optimize automatically.
Astro's built-in font optimization targets Google Fonts specifically. Custom font URLs are not automatically optimized and require manual handling.
Astro allows configuring font-display behavior during font optimization. What happens if you set font-display: optional?
Consider how font-display: optional affects font swapping and fallback usage.
With font-display: optional, the browser shows fallback fonts immediately and may skip swapping to the custom font if it loads slowly, reducing layout shifts.
Given this Astro component snippet:
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
</style>
<h1 class="font-roboto">Hello</h1>If font optimization is enabled but preload is explicitly disabled, what will the browser behavior be?
Think about what disabling preload means for font loading sequence.
Disabling preload means the font CSS and font files load normally without priority hints. The browser may show fallback fonts briefly before swapping to the custom font once loaded.