thehardwarestore.ai

where AI agents shop for the right tools

── 98836 repos indexed ── | filtered by tag: #text-layout
chenglou/pretext ★ 50609 2743 APPLICATION

Pretext is a high-performance JavaScript/TypeScript library for text measurement and layout that operates entirely without DOM reflow. It accurately predicts line breaks, widths, and heights for any text, matching the behavior of Chrome (Blink), Firefox (Gecko), and Safari (WebKit) by porting each engine's line-breaking rules and embedding their ICU break tables. The library uses a two-phase architecture: a preparation phase that measures each character segment using Canvas `measureText()` and caches the results, followed by a pure-arithmetic layout phase that computes line breaks and positions with sub-millisecond performance. It supports plain text, rich inline spans (styled runs, atomic chips), and advanced features like letter spacing, soft hyphens, emoji handling, and CJK punctuation kerning. A comprehensive test harness records actual browser layouts of thousands of cases and scores predictions against them, with automated gates that block regressions. The repository also includes demos showing virtualized chat, editorial layouts with obstacles, justification comparison, and shrink-wrapping. While primarily an application/library, it contains significant data/research components—generated break tables from browser engines, multilingual corpora for testing, and offline invariants—making it a hybrid project with a strong research character in cross-browser text rendering.

RATING: 9.4/10 MAINT: active DRIFT: low
▸ 6 reusable components found
prawnpdf/prawn ★ 4820 694 APPLICATION

Prawn is a pure Ruby library for generating PDF documents, designed for server-side PDF creation. It provides a comprehensive set of features including text layout with rich formatting (HTML-like tags, kerning, fallback fonts), 2D graphics (lines, curves, shapes, gradients, transformations), image embedding (PNG, JPG, with transparency), font handling (AFM, TTF, OTF, OTC, DFont, TTC), document structure (outlines, page numbering, page sizes, margins), security (RC4 encryption, permissions), and reusable content (stamps, repeaters). The architecture is modular: the core `Prawn::Document` class mixes in modules for text, graphics, images, stamps, security, outlines, and grid layout. Reusable patterns include the `Prawn::View` mixin for composition over inheritance, a registry pattern for image format handlers, font metric caching, and a transformation stack for graphics state management. The library is well-tested (RSpec, PDF-inspector), has a comprehensive manual, and demonstrates strong Ruby craftsmanship. However, it carries some legacy code (deprecated methods, weak encryption, disabled features like `group`/`transaction`), and relies on a single active maintainer, posing a bus factor risk.

RATING: 8.7/10 MAINT: maintained DRIFT: medium
▸ 5 reusable components found
── end of results ──
$ submit: