fonts.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { Figtree, Fraunces } from "next/font/google";
  2. import localFont from "next/font/local";
  3. /**
  4. * Text and interface: SF Pro on Apple devices (nothing to download), Figtree,
  5. * a friendly geometric sans, everywhere else. Not preloaded, so Apple devices
  6. * never fetch it.
  7. */
  8. export const fontText = Figtree({
  9. subsets: ["latin"],
  10. variable: "--ff-text",
  11. display: "swap",
  12. preload: false,
  13. });
  14. /**
  15. * Display: Fraunces, a soft variable serif. Its SOFT axis rounds the letters,
  16. * so the headline can melt like liquid under the cursor, and its optical-size
  17. * axis draws each size as designed: crisp, high-contrast cuts for the big
  18. * headline, sturdier ones for card titles. (Without it every size is drawn
  19. * from the 9 pt master.) About 120 KB, fetched after the first paint.
  20. */
  21. export const fontDisplay = Fraunces({
  22. subsets: ["latin"],
  23. axes: ["SOFT", "opsz"],
  24. variable: "--ff-display",
  25. display: "swap",
  26. // Loaded after the first paint by <FontLoader />.
  27. preload: false,
  28. });
  29. /** The italic "Eric" in the headline: Fraunces Italic subset to four glyphs, all axes (6 KB). */
  30. export const fontName = localFont({
  31. src: "../assets/fonts/fraunces-italic-eric.woff2",
  32. style: "italic",
  33. weight: "100 900",
  34. variable: "--ff-name",
  35. display: "swap",
  36. preload: false,
  37. adjustFontFallback: "Times New Roman",
  38. });
  39. /** What <FontLoader /> asks the browser to load once the page has painted. */
  40. export const deferredFaces = [
  41. `600 1em ${fontDisplay.style.fontFamily.split(",")[0]}`,
  42. `italic 600 1em ${fontName.style.fontFamily.split(",")[0]}`,
  43. ];