Skip to content

Add text-transform to Text - #59

Merged
jdolan merged 4 commits into
mainfrom
text-transform
Sep 6, 2026
Merged

Add text-transform to Text#59
jdolan merged 4 commits into
mainfrom
text-transform

Conversation

@jdolan

@jdolan jdolan commented Sep 6, 2026

Copy link
Copy Markdown
Owner

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. 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

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>
Copilot AI lite review requested due to automatic review settings September 6, 2026 20:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 TextTransform enum + name mapping for style/JSON binding.
  • Implements a transformed “display copy” used by render and naturalSize, 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.

Comment thread Sources/ObjectivelyMVC/Text.c Outdated
Comment thread Sources/ObjectivelyMVC/Text.h Outdated
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>
jdolan and others added 2 commits September 6, 2026 16:38
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
jdolan merged commit 57a31d1 into main Sep 6, 2026
0 of 3 checks passed
@jdolan
jdolan deleted the text-transform branch September 6, 2026 20:39
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>
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.

2 participants