Add letter spacing control to adjust character positioning#72
Add letter spacing control to adjust character positioning#72
Conversation
Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
|
|
@copilot thanks but not quite right. It was meant to be relative additive, I think you implement absolute. It’s supposed to be just a bump to whatever existing kerning |
Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
Fixed in commit 2852ddf. Changed from absolute cumulative positioning to relative additive spacing that preserves existing kerning. Before: Each character moved by Screenshots showing the corrected behavior:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot haha charindex * spacing but it’s still absolute in your implementation. It needs to add to the existing origin of each |
Co-authored-by: danmarshall <11507384+danmarshall@users.noreply.github.com>
You're absolutely right! Fixed in commit aea7405. Now directly modifying Key change: Results: Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Letter Spacing Feature Implementation ✅
letterSpacingproperty to AppState interface with default value of 0Screenshots
Default (Letter Spacing = 0)
With Increased Spacing (Letter Spacing = 20)
With Negative Spacing (Letter Spacing = -10)
Implementation Details
The letter spacing feature adds space between characters by adjusting the origin of each character model in the MakerJS phase:
State Management: Added
letterSpacing: numberto AppState with default value of 0UI Control: Added a slider (range -50 to 100) with accompanying number input for precise control. Both inputs have min/max constraints and the number input includes validation to clamp values within the valid range.
Character Positioning: In
fontUtils.ts, the spacing is applied as truly relative additive by directly modifying each character's origin property:origin[0] += 1 * letterSpacing(adds to existing x position)origin[0] += 2 * letterSpacing(adds to existing x position)Multi-line Support: Letter spacing is applied independently to each line of text
Custom Font Support: Fixed renderSvg condition to work with custom uploaded fonts even when Google Fonts API is unavailable
Testing
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.