mirror of
https://github.com/nicbarker/clay.git
synced 2025-01-23 18:06:04 +00:00
Explain text wrap modes in README
This commit is contained in:
parent
6600aa6678
commit
4bd9cd1956
21
README.md
21
README.md
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user