Skip to content

fix: low resolution username and year#69

Merged
chrisreddington merged 7 commits intogithub:mainfrom
chriswblake:cwb/fix-low-resolution-username-and-year
Jan 23, 2025
Merged

fix: low resolution username and year#69
chrisreddington merged 7 commits intogithub:mainfrom
chriswblake:cwb/fix-low-resolution-username-and-year

Conversation

@chriswblake
Copy link
Member

@chriswblake chriswblake commented Jan 21, 2025

This pull request fixes the issue of low resolution username and year.

It includes significant changes to the text and image rendering functionalities in the stl/geometry/text.go file. The changes involve refactoring the code to simplify and enhance the rendering process, removing redundant configurations, and introducing an adjustable resolution parameter baseWidthVoxelResolution.

Refactoring and simplification:

  • Removed the textRenderConfig and imageRenderConfig structs and their associated configurations, simplifying the parameters for text and image rendering functions.
  • Refactored the renderText function to align text on the skyline face using justification and offset percentages instead of fixed context dimensions. Added detailed comments to explain the parameters and return values.
  • Introduced a new helper function createVoxelOnFace to create voxels on the skyline base's face, improving modularity and readability.

Before

image

After

image

@chriswblake
Copy link
Member Author

@chrisreddington, I've verified the following.

  • All unit tests run.
  • Default option works. gh skyline
  • Full option works. gh skyline --full

If there is anything else I need to check, let me know.

I think the text looks thinner because of the applied resolution. If the thicker letters were intentional, I can look into making that adjustable.

@chriswblake
Copy link
Member Author

chriswblake commented Jan 21, 2025

FYI, I hardcoded the baseWidthVoxelResolution at 2000 voxels. I fealt that that was more than enough without bloating the file size.
Here are 2 examples.

2000 voxels (30mb)
image

4000 voxels wide (77mb)
image

@chrisreddington
Copy link
Collaborator

Thanks for taking a look at this @chriswblake! I've tried exporting a few models. The single year exports seem fine, but I cannot export a multi-year model - Do you have the same issue locally? (e.g. gh skyline --full or gh skyline --year 2020-2025) - Thanks!

@chriswblake
Copy link
Member Author

@chrisreddington,
Seems to work fine for me. I am running it in the dev container.

gh skyline
image

gh skyline --full
image

gh skyline --year 2020-2025
image

gh skyline --user chrisreddington
image

gh skyline --full --user chrisreddington
image

gh skyline --year 2020-2025 --user chrisreddington
image

@chriswblake
Copy link
Member Author

@chrisreddington,
FYI, I just created a fresh Codespace and retried the above. They all worked.

@chrisreddington
Copy link
Collaborator

@chrisreddington, FYI, I just created a fresh Codespace and retried the above. They all worked.

Fascinating, I've tried again with a fresh Codespace and still get the same thing. Let me do some digging...

@chrisreddington chrisreddington merged commit ef21f80 into github:main Jan 23, 2025
2 checks passed
@chriswblake
Copy link
Member Author

Yay! 🥳

@chriswblake chriswblake deleted the cwb/fix-low-resolution-username-and-year branch January 23, 2025 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants