Skip to content

Add feature cli fit mode#11

Draft
badele wants to merge 8 commits intosuperstarryeyes:mainfrom
badele:feat/cli-fit-mode
Draft

Add feature cli fit mode#11
badele wants to merge 8 commits intosuperstarryeyes:mainfrom
badele:feat/cli-fit-mode

Conversation

@badele
Copy link

@badele badele commented Feb 28, 2026

This PR adds an optional fit mode to the CLI that ranks and previews fonts based on how closely their rendered output matches a target width and/or height, letting users quickly find the best font and scale for a desired dimension, with optional display of measured dimensions and distance to the target.

Centralizes ANSI width measurement for shared sizing logic.
Provides candidate sorting with deterministic width or height priority.
Adds opt-in fit flags for sizing-based font selection and preview.
Adds opt-in fit flags for sizing-based font selection and preview.
@superstarryeyes
Copy link
Owner

interesting. this is certainly a cool idea. i'm just thinking if it's useful enough to merge to the main. what are you using this for yourself?

@badele badele marked this pull request as draft March 2, 2026 15:19
@badele
Copy link
Author

badele commented Mar 2, 2026

@superstarryeyes I’m using this mainly in the context of my own projects, particularly a new format called neotex, which aims to make ANSI files easier to read without requiring a dedicated ANSI viewer: https://github.com/badele/neotex

I’m also working on an ANSI compositor: https://github.com/badele/ansi-compositor

The font-dimension matching feature is important for me because the compositor relies on precise width and height constraints to assemble ANSI content correctly. Being able to automatically find a font that satisfies those constraints simplifies the workflow and avoids manual adjustments.

You can find examples in the repositories, including:

  • A sample configuration file for ansi-compositor,
  • The generated neotex output,
  • And the resulting ANSI rendering exported as PNG.

In short, this feature allows me to maintain consistent layout constraints across tools and ensures predictable rendering.

I’ve switched the PR to draft mode so I can properly test the tool’s viability. This will allow me to provide you with more concrete feedback in the future. Would that be okay for you ?

@superstarryeyes
Copy link
Owner

very interesting projects you have! take your time, draft mode i fine.

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