Skip to content

feat: Add ability to wrap text to UI elements#911

Closed
lkristensen wants to merge 2 commits intocrosspoint-reader:masterfrom
lkristensen:feature/wrappedText
Closed

feat: Add ability to wrap text to UI elements#911
lkristensen wants to merge 2 commits intocrosspoint-reader:masterfrom
lkristensen:feature/wrappedText

Conversation

@lkristensen
Copy link

Summary

New function "wrappedText" added to the GfxRenderer

Similarly to how truncatedText it will take a text string and a width and return a truncated string, this function will wrap the text into a vector of strings. A maximum number of lines is specified, and the rest of the text (if any) is truncated using truncatedText

The function only wraps on spaces, as rules for how words are split varies by language.

Additional Context

  • Add any other information that might be helpful for the reviewer (e.g., performance implications, potential risks,
    specific areas to focus on).

This was requested by CaptainFrito in 732.

As part of the lyra theme.
Before:
before

After:
after


AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? Used chatgpt to validate that std::vectorstd::string was an appropriate return type

Laust Lund Kristensen added 2 commits February 16, 2026 07:38
New function "wrappedText" added to the GfxRenderer

Similarly to how truncatedText it will take a text string and a width
and return a truncated string, this function will wrap the text into
a vector of strings. A maximum number of lines is specified, and the
rest of the text (if any) is truncated using truncatedText

The function only wraps on spaces, as rules for how words are split
varies by language.
@lkristensen lkristensen mentioned this pull request Feb 18, 2026
ngxson pushed a commit that referenced this pull request Feb 25, 2026
## Summary

* **What is the goal of this PR?** (e.g., Implements the new feature for
file uploading.)


* **What changes are included?**
Conrgegate the changes of #1074 , #1013 , and extended upon #911 by
@lkristensen
New function implemented in GfxRenderer.cpp
```C++
std::vector<std::string> GfxRenderer::wrappedText(const int fontId, const char* text, const int maxWidth,
                                                  const int maxLines, const EpdFontFamily::Style style) const
```
Applied logic to all uses in Lyra, Lyra Extended, and base theme
(continue reading card as pointed out by @znelson


## Additional Context





![IMG_8604](https://github.com/user-attachments/assets/49da71c9-a44f-4cde-b3bf-6773d71601b6)

![IMG_8605](https://github.com/user-attachments/assets/5eab4293-65c1-47fb-b422-8ab53a6b50a2)

![IMG_8606](https://github.com/user-attachments/assets/e0f98d19-0e3f-4294-83a1-e49264378dca)


---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**< YES >**_

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
el pushed a commit to el/crosspoint-reader that referenced this pull request Feb 26, 2026
…oint-reader#1141)

## Summary

* **What is the goal of this PR?** (e.g., Implements the new feature for
file uploading.)


* **What changes are included?**
Conrgegate the changes of crosspoint-reader#1074 , crosspoint-reader#1013 , and extended upon crosspoint-reader#911 by
@lkristensen
New function implemented in GfxRenderer.cpp
```C++
std::vector<std::string> GfxRenderer::wrappedText(const int fontId, const char* text, const int maxWidth,
                                                  const int maxLines, const EpdFontFamily::Style style) const
```
Applied logic to all uses in Lyra, Lyra Extended, and base theme
(continue reading card as pointed out by @znelson


## Additional Context





![IMG_8604](https://github.com/user-attachments/assets/49da71c9-a44f-4cde-b3bf-6773d71601b6)

![IMG_8605](https://github.com/user-attachments/assets/5eab4293-65c1-47fb-b422-8ab53a6b50a2)

![IMG_8606](https://github.com/user-attachments/assets/e0f98d19-0e3f-4294-83a1-e49264378dca)


---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**< YES >**_

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@lkristensen lkristensen closed this Mar 3, 2026
@lkristensen
Copy link
Author

Closed as it has been merged as part of 1074

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant