Explain text wrap modes in README

This commit is contained in:
Nic Barker 2024-09-18 11:52:11 +12:00 committed by GitHub
parent 6600aa6678
commit 4bd9cd1956
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -963,6 +963,11 @@ Clay_TextElementConfig {
uint16_t fontSize;
uint16_t letterSpacing;
uint16_t lineSpacing;
Clay_TextElementConfigWrapMode wrapMode {
CLAY_TEXT_WRAP_WORDS (default),
CLAY_TEXT_WRAP_NEWLINES,
CLAY_TEXT_WRAP_NONE,
};
#ifdef CLAY_EXTEND_CONFIG_TEXT
// Contents of CLAY_EXTEND_CONFIG_TEXT will be pasted here
@ -1019,6 +1024,22 @@ Font size is generally thought of as `x pixels tall`, but interpretation is left
`.lineSpacing` results in **vertical** white space between lines of text (from both `\n` characters and text wrapping) and will affect layout of parents and siblings.
---
**`.wrapMode`**
`CLAY_TEXT_CONFIG(.wrapMode = CLAY_TEXT_WRAP_NONE)`
`.wrapMode` specifies under what conditions text should [wrap](https://en.wikipedia.org/wiki/Line_wrap_and_word_wrap).
Available options are:
- `CLAY_TEXT_WRAP_WORDS` (default) - Text will wrap on whitespace characters as container width shrinks, preserving whole words.
- `CLAY_TEXT_WRAP_NEWLINES` - will only wrap when encountering newline characters.
- `CLAY_TEXT_WRAP_NONE` - Text will never wrap even if its container is compressed beyond the text measured width.
---
**Example Usage**
```C
// A 24px, red text element that says "John Smith"