From 56cf7e3fb81b15ad0d71d0ad8dadab7c2637c2fc Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 10 Sep 2024 11:17:29 -0400 Subject: [PATCH] Update README.md --- README.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0a78aaf..0d6c672 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,20 @@ [![Go Reference](https://pkg.go.dev/badge/git.tebibyte.media/tomo/typeset.svg)](https://pkg.go.dev/git.tebibyte.media/tomo/typeset) -Typeset provides utilities for text layout, wrapping, and rendering. +Typeset provides utilities for text layout, wrapping, and rendering. It is +designed to avoid redundant work and minimize memory allocations wherever +posible in situations where the bounds of a section of text may change +frequently and its content semi-frequently. Text layout is performed by the +TypeSetter struct, which operates in a three-phase process: -The state of a text layout is stored in a TypeSetter, and it can be drawn to any -draw.Image using a Drawer which "extends" TypeSetter. +1. Tokenization +2. Measurement +3. Layout, alignment + +The results of these phases are memoized. When the state of the TypeSetter is +queried, it will run through only the required phases before returning a value. + +The contents of a TypeSetter can be drawn onto any draw.Image using the Draw +function included within this package, but it is entirely possible to create a +custom draw function that iterates over TypeSetter.Runes that uses some other +method of drawing that's faster than five gazillion virtual method calls.