Close Menu
AI News TodayAI News Today

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    John Ternus hypes ‘huge launch next week’ in first memo as Apple CEO

    Google’s Android update tackles motion sickness, accessibility, and more

    Anthropic launches Claude Fable 5.1 and says it’s up to 45 percent cheaper for agentic work

    Facebook X (Twitter) Instagram
    • About Us
    • Contact Us
    Facebook X (Twitter) Instagram Pinterest Vimeo
    AI News TodayAI News Today
    • Home
    • AI News
    • AI Reviews
    • AI Tools
    • AI Tutorials
    • Chatbots
    • Free AI Tools
    • Artificial Intelligence
    AI News TodayAI News Today
    Home»AI Tools»Pretext
    AI Tools

    Pretext

    By Updated:No Comments2 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Pretext
    Share
    Facebook Twitter LinkedIn Pinterest Email

    29th March 2026 – Link Blog

    Pretext (via) Exciting new browser library from Cheng Lou, previously a React core developer and the original creator of the react-motion animation library.

    Pretext solves the problem of calculating the height of a paragraph of line-wrapped text without touching the DOM. The usual way of doing this is to render the text and measure its dimensions, but this is extremely expensive. Pretext uses an array of clever tricks to make this much, much faster, which enables all sorts of new text rendering effects in browser applications.

    Here’s one demo that shows the kind of things this makes possible:

    The key to how this works is the way it separates calculations into a call to a prepare() function followed by multiple calls to layout().

    The prepare() function splits the input text into segments (effectively words, but it can take things like soft hyphens and non-latin character sequences and emoji into account as well) and measures those using an off-screen canvas, then caches the results. This is comparatively expensive but only runs once.

    The layout() function can then emulate the word-wrapping logic in browsers to figure out how many wrapped lines the text will occupy at a specified width and measure the overall height.

    I had Claude build me this interactive artifact to help me visually understand what’s going on, based on a simplified version of Pretext itself.

    The way this is tested is particularly impressive. The earlier tests rendered a full copy of the Great Gatsby in multiple browsers to confirm that the estimated measurements were correct against a large volume of text. This was later joined by the corpora/ folder using the same technique against lengthy public domain documents in Thai, Chinese, Korean, Japanese, Arabic, and more.

    Pretext
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous Article‘Project Hail Mary’ becomes Amazon MGM’s biggest box office hit
    Next Article YouTube CEO says the best YouTubers will ‘never leave their home’
    • Website

    Related Posts

    AI Tools

    Canva Magic Design: The AI Feature That Does the Heavy Lifting

    AI Tools

    Boomy: The AI Music Tool That Turns Good Ideas into Finished Songs

    AI Tools

    Your JSON Is Valid but Your Data Is Wrong: Five Failure Modes LLM Structured Outputs Won’t Catch

    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    John Ternus hypes ‘huge launch next week’ in first memo as Apple CEO

    0 Views

    Google’s Android update tackles motion sickness, accessibility, and more

    0 Views

    Anthropic launches Claude Fable 5.1 and says it’s up to 45 percent cheaper for agentic work

    0 Views
    Stay In Touch
    • Facebook
    • YouTube
    • TikTok
    • WhatsApp
    • Twitter
    • Instagram
    Latest Reviews
    AI Tutorials

    Quantization from the ground up

    AI Tools

    David Sacks is done as AI czar — here’s what he’s doing instead

    AI Reviews

    Judge sides with Anthropic to temporarily block the Pentagon’s ban

    Subscribe to Updates

    Get the latest tech news from FooBar about tech, design and biz.

    Most Popular

    John Ternus hypes ‘huge launch next week’ in first memo as Apple CEO

    0 Views

    Google’s Android update tackles motion sickness, accessibility, and more

    0 Views

    Anthropic launches Claude Fable 5.1 and says it’s up to 45 percent cheaper for agentic work

    0 Views
    Our Picks

    Quantization from the ground up

    David Sacks is done as AI czar — here’s what he’s doing instead

    Judge sides with Anthropic to temporarily block the Pentagon’s ban

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    Facebook X (Twitter) Instagram Pinterest
    • About Us
    • Contact Us
    • Terms & Conditions
    • Privacy Policy
    • Disclaimer

    © 2026 ainewstoday.co. All rights reserved. Designed by DD.

    Type above and press Enter to search. Press Esc to cancel.