"use client" import { useState } from "react" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Switch } from "@/components/ui/switch" import { Label } from "@/components/ui/label" import { fontStacks } from "@/lib/typography" import { cn } from "@/lib/utils" export function AdvancedTypographySection() { const [openType, setOpenType] = useState(true) const [kerning, setKerning] = useState(true) const [ligatures, setLigatures] = useState(true) const [textBalance, setTextBalance] = useState(true) const [fontSmoothing, setFontSmoothing] = useState(true) const [selectedTab, setSelectedTab] = useState("headlines") // Sample text for headlines const headlines = [ "Typography is the Voice of Your Design", "Creating Visual Hierarchy with Type", "The Art of Readable Interfaces", "Finding the Perfect Font Pairing", "Typography that Speaks to Your Users", ] // Sample text for paragraphs const paragraphs = [ "Good typography establishes a strong visual hierarchy for the meaning of your content. It guides the reader through the content, showing what's important, what's related, and how to navigate the information. When done well, typography enhances readability, accessibility, and the overall user experience.", "The choice of typeface can dramatically affect how your content is perceived. Serif fonts often convey tradition, reliability, and comfort, while sans-serif fonts tend to feel more modern, clean, and straightforward. The right typeface should align with your brand's personality and the message you want to communicate.", "Typography isn't just about choosing fonts—it's about how you use them. Line height, letter spacing, and font size all play crucial roles in creating readable text. The goal is to make reading effortless, allowing users to focus on the content rather than struggling to decipher it.", ] // Get the current font stack const currentFontStack = fontStacks.sans.modern return (

Advanced Typography

Fine-tuning typography can dramatically improve the polish and readability of your interface. These advanced features help create a more professional and refined typographic experience.

OpenType Features

Enable advanced typographic features like stylistic alternates

Adjust spacing between specific character pairs

Combine characters into single glyphs

Improve line breaks for better readability

Enhance text rendering on screens

Typography Preview

Headlines Paragraphs Special Cases {headlines.map((headline, index) => (

{headline}

{index === 0 && "← This headline demonstrates the selected typography features"}

))}
{paragraphs.map((paragraph, index) => (

{paragraph}

))}

Ligatures Example

With Ligatures

efficient, affiliate, offline, fluffy

Without Ligatures

efficient, affiliate, offline, fluffy

Kerning Example

With Kerning

AWAY Typography

Without Kerning

AWAY Typography

Text Balance Example

With Text Balance

Creating Beautiful Typography for Digital Interfaces

Without Text Balance

Creating Beautiful Typography for Digital Interfaces

Advanced Typography Tips

  • Enable OpenType features for professional-looking text with stylistic alternates and proper ligatures
  • Use proper kerning to ensure even spacing between letter pairs like "AV" or "WA"
  • Apply text-balance for better line breaks in headlines and important text
  • Enable font-smoothing for crisper text rendering, especially on high-resolution displays
  • Consider using variable fonts for more precise control over font weight and width
  • Maintain a consistent vertical rhythm by using a baseline grid
  • Use proper typographic punctuation like em dashes (—) and smart quotes (" ")
) }