Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move letters off the grid to make text more readable #656

Open
wants to merge 6 commits into
base: release
Choose a base branch
from

Conversation

Nathan-Fenner
Copy link
Contributor

This PR augments the cellDisplayBuffer struct with a new field, CellTextInfo textInfo that tracks information about the text qualities of the cell. When drawing text to the screen, textInfo.textMode is set to a non-zero value:

  • 0: Not text
  • 1: Left-aligned text
  • 2: Centered text

The platform can read this information, and adjust the placement of letters to make text more readable:

BeforeAfter
Screenshot 2024-01-20 at 7 10 09 PM Screenshot 2024-01-20 at 7 08 48 PM

As shown in the screenshot above, most interfaces and log messages now make use of this fancier text-printing info.

I think I've ironed out all of the bugs, but it's possible that there's still some screens which display incorrectly.


Platforms must be modified to accept the extra CellTextInfo parameter in their plotChar implementation - though it can simply be ignored if the platform doesn't want to or can't support moving the letters around. The actual display logic change is pretty small - see tiles.c for what the platform actually does to make use of this new metadata.

dest.x += offsetForEnd / 2;
}

// int diff = abs(tile->foreRed - tile->backRed) + abs(tile->foreGreen - tile->backGreen) + abs(tile->foreBlue - tile->backBlue);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • This is some debugging logic, I'll remove it

@Nathan-Fenner Nathan-Fenner mentioned this pull request Feb 5, 2024
Copy link
Owner

@tmewett tmewett left a comment

Choose a reason for hiding this comment

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

I don't have the foresight to know how this will be received - it definitely alters the aesthetics of things, but it is easier to read. And the implementation is quite minimal! So nice work. I think we'll give it a go

Comment on lines +1288 to +1289
/// 1 : Left-aligned text [startColumn must be set]
/// 2 : Middle-aligned text [startColumn and endColumn must be set]
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
/// 1 : Left-aligned text [startColumn must be set]
/// 2 : Middle-aligned text [startColumn and endColumn must be set]
/// 1 : Left-aligned text [firstColumn must be set]
/// 2 : Middle-aligned text [firstColumn and lastColumn must be set]

/// 0 : Normal terminal output
/// 1 : Left-aligned text [startColumn must be set]
/// 2 : Middle-aligned text [startColumn and endColumn must be set]
int8_t mode;
Copy link
Owner

Choose a reason for hiding this comment

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

Q: what about an enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, that would be a good idea, I was being lazy.

I'll fix this after I rebase the PR to fix the conflicts.

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.

None yet

2 participants