Skip to content

Additional options and C++ output support - #7

Open
alexwarg wants to merge 11 commits into
jdmorise:masterfrom
alexwarg:master
Open

Additional options and C++ output support#7
alexwarg wants to merge 11 commits into
jdmorise:masterfrom
alexwarg:master

Conversation

@alexwarg

Copy link
Copy Markdown

The changes are to provide a wider variety of options for bitmap and code generation. As well as generating C++ header files with structures for different fonts.
In addition the C++ headers allow for fonts with variable bitmap width while providing information for left and right padding of glyphs.

Alexander Warg added 11 commits March 11, 2026 20:01
Allow generation of all files into one flat directory with --nosubdirs.
With --nospaces file names will get spaces replaced by underscores.
The new option --vertical allows to generate the bytes for the bitmap in
vertical first order. Normally bytes are ordered in rows from left to
right. With this option enabled bytes are ordered each column top-down
and all rows left to right at once.

This allows for vertical addressing mode in OLED display which sometimes
simplifies left and right padding when drawing directly to the display
without an additional frame buffer.
The option --usebbox switches from fixed form-factor bitmaps with a fix
width to height ratio to using the fonts bounding boxes for calculating
each glyph size according to the font.

This allows for a better rendering and kerning result.
The new option --hex generates the bitmap data in the for of 2 digit hex
numbers in a nice grid instead of a one-line decimal array.
Compactify code generation.
With the new option --cpp the output is C++ header files with a struct
with static constexpr data members for all the data. This avoids global
namespace pollution with 'bitmap...' variables and allows also
additional metadata for the fonts, like narrower bitmaps for wider
glyphs etc.
This fixes an undefined variable with the --fh option
This is actually two 8bit rows on monochrome OLEDs
The new --autosize option in combination with the usebbox option allows
to scale the selected font to fill the full desired height of the bitmap
font keeping the given margin equally split top and bottom.
The algorithm takes the full list of characters and keeps relative size
and position correct. However, the font might end up smaller or bigger
if some glyphs that go below the base line are missing or added (such as
y, p, q etc.).

The rest is cleanup of the C++ code generation and.
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.

1 participant