Add text-transform to Text - #59
Merged
Merged
Conversation
Text gains a TextTransform (none, uppercase, lowercase, capitalize), set from the `text-transform` style attribute, `textTransform` in JSON, or Text::setTransform. The transform applies to a display copy of the string that render and naturalSize use, so Text::text stays as set. Only ASCII letters change: multi-byte UTF-8, color escapes and resolved `:icon:` escapes pass through, so icon names keep their case. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
applyTransform currently uses ctype-style SDL APIs on potentially signed char bytes (risking undefined behavior and incorrect handling of non-ASCII/UTF-8), and the public header docs for :icon: escaping don’t match the implementation.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a TextTransform feature to Text so case transformation (none/uppercase/lowercase/capitalize) can be driven by CSS (text-transform), JSON (textTransform), or API (Text::setTransform), while preserving the original Text::text.
Changes:
- Introduces
TextTransformenum + name mapping for style/JSON binding. - Implements a transformed “display copy” used by
renderandnaturalSize, updated when text/transform/icons change. - Adds unit coverage for transform behavior with escapes and sizing.
File summaries
| File | Description |
|---|---|
| Tests/ObjectivelyMVC/Text.c | Adds test coverage for transform behavior with color/icon escapes and sizing. |
| Sources/ObjectivelyMVC/Text.h | Declares TextTransform, exported enum names, and new Text::setTransform API. |
| Sources/ObjectivelyMVC/Text.c | Implements transform application, style/JSON binding, and uses transformed text in render/measurement paths. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The transform binds through int locals like the other enum inlets, a style without text-transform resets to none rather than sticking, awakeWithDictionary invalidates after rebinding text, description shows the display string, and an icon escape no longer starts a word under capitalize. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
jdolan
added a commit
to jdolan/quetoo
that referenced
this pull request
Sep 6, 2026
Vitals, powerups, pickups and weapon slots sit on translucent cards in the menu panel palette; numbers are bold; captions are small, uppercase and smoky. The weapon bar's selection marker image gives way to a highlighted slot card, and the clock becomes a captioned counter beside frags and deaths, dropping the server's leading ^7 so the stylesheet's colour applies. CounterView gains a textForFrame seam for non-numeric values. Uppercase captions need text-transform from jdolan/ObjectivelyMVC#59; until the pin moves, MVC ignores the attribute and captions render as written. Part of #1026. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jdolan
added a commit
that referenced
this pull request
Sep 7, 2026
* Close the loop dropped from applyTransform in #59 The squash of #59 lost the for loop's closing brace, so main did not compile. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * Load SVG images, rasterized at a scale Image recognizes SVG by declared type or by sniffing and rasterizes it through SDL_image's nanosvg. Image::imageWithSVG and initWithSVG take a scale, pixels per point such as the window's pixel density, so a vector asset drawn into a frame of its intrinsic size stays sharp on a high density display; Image::scale records it and Image::size reports points, so views sized to an image are unaffected. Raster images keep a scale of 1. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * Remove versioned test. * PR feedback --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Text gains a
TextTransform(none, uppercase, lowercase, capitalize), set from thetext-transformstyle attribute,textTransformin JSON, orText::setTransform.The transform applies to a display copy of the string that
renderandnaturalSizeuse, soText::textstays as set. Only ASCII letters change: multi-byte UTF-8, color escapes and resolved:icon:escapes pass through, so icon names keep their case. Capitalize treats a color escape as transparent and an icon as a word boundary.Motivation: the Quetoo HUD restyle (jdolan/quetoo#1026) wants uppercase captions declared in CSS rather than shouting in the source strings.
🤖 Generated with Claude Code