fonts.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. The optical-size
  17. * axis is left out to keep the file small (about 60 KB).
  18. */
  19. export const fontDisplay = Fraunces({
  20. subsets: ["latin"],
  21. axes: ["SOFT"],
  22. variable: "--ff-display",
  23. display: "swap",
  24. // Loaded after the first paint by <FontLoader />.
  25. preload: false,
  26. });
  27. /** The italic "Eric" in the headline: Fraunces Italic subset to four glyphs (4 KB). */
  28. export const fontName = localFont({
  29. src: "../assets/fonts/fraunces-italic-eric.woff2",
  30. style: "italic",
  31. weight: "100 900",
  32. variable: "--ff-name",
  33. display: "swap",
  34. preload: false,
  35. adjustFontFallback: "Times New Roman",
  36. });
  37. /** What <FontLoader /> asks the browser to load once the page has painted. */
  38. export const deferredFaces = [
  39. `600 1em ${fontDisplay.style.fontFamily.split(",")[0]}`,
  40. `italic 600 1em ${fontName.style.fontFamily.split(",")[0]}`,
  41. ];