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

    Gemini Advanced Ease of Use Review: An Honest Hands-On Test

    OpenAI’s Path to AGI: Five Rungs, Half a Trillion Dollars and No Schedule

    Generative AI for Developers Course: How to Tell a Good One From a Long Tutorial

    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
    • AGI
    • 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

    AI Product Photography Tools: What They Nail, What They Miss, and How to Ship Shots That Sell

    AI Tools

    AI Thumbnail Generators: Build Clickable Covers Without a Designer

    AI Tools

    AI Poster Generator: How to Make Posters That Don’t Look Like Everyone Else’s

    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    Gemini Advanced Ease of Use Review: An Honest Hands-On Test

    0 Views

    OpenAI’s Path to AGI: Five Rungs, Half a Trillion Dollars and No Schedule

    0 Views

    Generative AI for Developers Course: How to Tell a Good One From a Long Tutorial

    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

    Gemini Advanced Ease of Use Review: An Honest Hands-On Test

    0 Views

    OpenAI’s Path to AGI: Five Rungs, Half a Trillion Dollars and No Schedule

    0 Views

    Generative AI for Developers Course: How to Tell a Good One From a Long Tutorial

    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.