awesome-repositories.com
Blog
awesome-repositories.com

Découvrez les meilleurs dépôts open-source grâce à notre recherche par IA.

ExplorerRecherches sélectionnéesAlternatives open sourceLogiciels auto-hébergésBlogPlan du site
ProjetÀ proposNotre méthodologiePresseServeur MCP
Mentions légalesConfidentialitéConditions d'utilisation
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
chenglou avatar

chenglou/pretext

0
View on GitHub↗
48,480 stars·2,701 forks·TypeScript·MIT·6 vueschenglou.me/pretext↗

Pretext

Pretext is a canvas-based text layout engine designed to calculate precise text dimensions and line breaks for custom rendering. It serves as a rich text measurement tool and a cross-browser typography normalizer, enabling the determination of pixel-perfect widths and heights for mixed inline content without relying on browser CSS.

The project distinguishes itself through its ability to handle complex typography and dynamic layouts. It implements language-specific segmentation rules for CJK and Hangul scripts and corrects emoji width variances between DOM and canvas rendering. Additionally, it can flow text around variable-width obstacles and manage atomic inline elements, such as chips and mentions, as single indivisible units during the measurement process.

The engine covers a broad range of layout capabilities, including multilingual text formatting, manual line-breaking control, and the processing of soft hyphens. It utilizes a two-phase layout calculation and segment caching to determine paragraph height, container width, and line-by-line layouts for use in graphics engines.

Features

  • Canvas Rendering Engines - Implements a canvas rendering engine to calculate precise text metrics and dimensions.
  • Text Rendering - Provides a canvas-based engine to calculate precise dimensions and line breaks for custom text rendering.
  • Multilingual Text Processing - Applies language-specific preprocessing and glue rules for various scripts to ensure correct segmentation.
  • Linguistic Text Segmenters - Processes language-specific line-breaking rules for CJK and Hangul scripts to ensure correct visual segmentation.
  • Variable Width Flow Engines - Calculates line breaks incrementally using a cursor to flow text around obstacles or change width per line.
  • Linguistic Wrapping Rules - Controls text wrapping using language-specific segmentation rules for CJK and Hangul scripts.
  • Complex Script Renderers - Processes multilingual text, including bidirectional runs and shaping-sensitive scripts, to ensure correct visual display.
  • Canvas Text Layout Engines - Uses HTML5 Canvas to calculate precise text dimensions and line breaks for custom rendering.
  • Incremental Text Flow - Calculates line breaks sequentially to allow text to wrap around variable-width obstacles.
  • Line Layout Generators - Breaks text into individual lines with corresponding widths and content for custom rendering in graphics engines.
  • Multilingual Typography Formatters - Processes complex scripts and language-specific rules to ensure correct text segmentation and visual display.
  • Obstacle-Aware Positioning - Places text lines and characters accurately while accounting for streaming content and physical obstacles.
  • Text Dimension Measurement - Determines the exact width and height of text segments using a two-phase measurement process.
  • Dynamic Text Wrapping Engines - Controls how text flows and breaks around obstacles or within variable-width containers using custom line-breaking logic.
  • Text Wrapping Controls - Manages line-breaking behavior by preserving hard breaks, ordinary spaces, and standard tab stops.
  • Layout Measurement Utilities - Calculates line statistics and natural widths to iterate through line ranges for custom rendering.
  • Manual Typography Orchestrators - Manages manual text wrapping and flow around variable-width obstacles without relying on browser CSS.
  • Text Dimension Calculators - Provides precise pixel-perfect width and height calculations for text segments without relying on browser CSS.
  • Rich Inline Layouts - Measures and segments text containing mixed fonts or atomic chips while maintaining specific whitespace and boundary rules.
  • Rich Text Dimension Calculators - Determines the exact width and height of mixed inline content like chips and mentions while managing whitespace.
  • Rich Text Measurement Utilities - Calculates the pixel width and height of mixed inline content including atomic components and emojis.
  • Linguistic Wrapping Rules - Controls how text wraps using specific word-break rules for CJK and Hangul languages.
  • Cross-Browser Typography Normalizers - Standardizes the measurement of emojis and special characters to ensure consistent layout across different web browsers.
  • Paragraph Height Calculators - Computes the total height and line count of a paragraph based on maximum width and line height.
  • Metric Caching - Stores widths and properties of processed text segments to avoid redundant measurements.
  • Multi-Phase Layout Calculation - Determines final text dimensions by first measuring individual segments and then applying layout rules.
  • Emoji Width Normalizers - Detects and corrects emoji width variances between DOM and canvas rendering for consistent layout.
  • Atomic Inline Elements - Treats rich text components like chips as indivisible units during the line-breaking and measurement process.
  • Width Normalization - Detects and caches width variances between DOM and canvas rendering for consistent emoji sizing.
  • Container Width Optimizers - Analyzes line ranges to find the widest single line and shrink-wrap a container tightly around the text.
  • Rich Text Formatting Extensions - Processes mixed content like mentions or chips while managing whitespace collapse and letter spacing.
  • Rich Text Renderers - Calculates widths for mixed inline elements like chips while managing boundary whitespace.
  • Hyphenation Logic - Implements logic to process optional break points and render trailing hyphens only when text wraps.

Historique des stars

Graphique de l'historique des stars pour chenglou/pretextGraphique de l'historique des stars pour chenglou/pretext

Recherche par IA

Explorez plus de dépôts awesome

Décrivez vos besoins en langage naturel — l'IA classe des milliers de projets open source sélectionnés par pertinence.

Start searching with AI

Questions fréquentes

Que fait chenglou/pretext ?

Pretext is a canvas-based text layout engine designed to calculate precise text dimensions and line breaks for custom rendering. It serves as a rich text measurement tool and a cross-browser typography normalizer, enabling the determination of pixel-perfect widths and heights for mixed inline content without relying on browser CSS.

Quelles sont les fonctionnalités principales de chenglou/pretext ?

Les fonctionnalités principales de chenglou/pretext sont : Canvas Rendering Engines, Text Rendering, Multilingual Text Processing, Linguistic Text Segmenters, Variable Width Flow Engines, Linguistic Wrapping Rules, Complex Script Renderers, Canvas Text Layout Engines.

Quelles sont les alternatives open-source à chenglou/pretext ?

Les alternatives open-source à chenglou/pretext incluent : flipboard/react-canvas — react-canvas is a library for drawing user interface elements to a hardware-accelerated canvas instead of the standard… sixlabors/imagesharp — ImageSharp is a .NET image processing library and manipulation framework used for decoding, encoding, and modifying… google/skia — Skia is a high-performance 2D graphics rendering library used for drawing text, geometries, and images on digital… fogleman/gg — gg is a Go 2D graphics library and vector graphics engine designed for programmatic image generation. It provides a… ibireme/yytext — YYText is an iOS rich text framework used for rendering and editing complex attributed text. It features an… shopify/react-native-skia — react-native-skia is a cross-platform graphics framework that provides a high-performance 2D graphics engine for…

Alternatives open source à Pretext

Projets open source similaires, classés selon le nombre de fonctionnalités partagées avec Pretext.
  • flipboard/react-canvasAvatar de Flipboard

    Flipboard/react-canvas

    13,203Voir sur GitHub↗

    react-canvas is a library for drawing user interface elements to a hardware-accelerated canvas instead of the standard document tree. It provides a system for rendering components to a canvas to improve rendering speed and frame rates. The project includes a layer manager to organize visual elements and cache expensive drawing operations. It features a text engine capable of rendering multi-line text with precise character metric measurements and truncation, as well as a virtualized list system that processes only visible items to maintain smooth scrolling. Interaction is handled through a c

    JavaScript
    Voir sur GitHub↗13,203
  • sixlabors/imagesharpAvatar de SixLabors

    SixLabors/ImageSharp

    7,954Voir sur GitHub↗

    ImageSharp is a .NET image processing library and manipulation framework used for decoding, encoding, and modifying digital images. It functions as a comprehensive toolkit for resizing, cropping, and applying pixel-level filters while managing color profiles and pixel data across various file formats. The project integrates a 2D vector graphics engine and a typography rendering engine to draw geometric shapes, paths, and complex stylized text onto images. It also includes a geometry boolean operation library for calculating intersections, unions, and differences between complex polygons and c

    C#bmpc-sharpdrawing
    Voir sur GitHub↗7,954
  • fogleman/ggAvatar de fogleman

    fogleman/gg

    4,778Voir sur GitHub↗

    gg is a Go 2D graphics library and vector graphics engine designed for programmatic image generation. It provides a canvas rendering API to create custom 2D shapes, paths, and visual assets, which can be exported as PNG and JPG files. The toolkit enables the construction of complex geometry using Bezier curves and custom paths. It supports a variety of rendering operations, including filling and stroking paths, applying linear and radial gradients, and utilizing surface patterns. The library covers a broad range of capabilities, including text rendering with word wrapping and dimension measu

    Go
    Voir sur GitHub↗4,778
  • google/skiaAvatar de google

    google/skia

    10,762Voir sur GitHub↗

    Skia is a high-performance 2D graphics rendering library used for drawing text, geometries, and images on digital surfaces. It functions as a hardware-accelerated graphics engine that offloads drawing operations to the GPU, a vector graphics processor for SVG and complex paths, and a typography engine for shaping and drawing characters with Unicode support. The project provides a cross-platform image codec for encoding and decoding standard image formats into raw pixel data across multiple operating systems. It also enables the development of user interfaces that maintain visual consistency a

    C++
    Voir sur GitHub↗10,762
  • Voir les 30 alternatives à Pretext→