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

Fixed Adafruit_GFX font size limitation - the 8-bit signed values prevented large fonts from working #448

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fontconvert/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
all: fontconvert

CC = gcc
CFLAGS = -Wall -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I/usr/include
LIBS = -lfreetype
CFLAGS = -Wall -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I/usr/include -I/opt/homebrew/include/freetype2
LIBS = -L/opt/homebrew/lib -lfreetype
Comment on lines +4 to +5
Copy link
Contributor

@BillyDonahue BillyDonahue Jun 6, 2024

Choose a reason for hiding this comment

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

These paths apply to your machine.

The right way to figure out where freetype2 is, would be to have the Makefile invoke and save the output of:
freetype-config --libs and freetype-config --cflags.

On my machine, I get different answers.

$ freetype-config --libs
-L/opt/homebrew/opt/freetype/lib -lfreetype
$ freetype-config --cflags
-I/opt/homebrew/opt/freetype/include/freetype2 -I/opt/homebrew/opt/libpng/include/libpng16

But Makefile tweaks are a different PR I think.


fontconvert: fontconvert.c
$(CC) $(CFLAGS) $< $(LIBS) -o $@
Expand Down
12 changes: 6 additions & 6 deletions gfxfont.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
/// Font data stored PER GLYPH
typedef struct {
uint16_t bitmapOffset; ///< Pointer into GFXfont->bitmap
uint8_t width; ///< Bitmap dimensions in pixels
uint8_t height; ///< Bitmap dimensions in pixels
uint8_t xAdvance; ///< Distance to advance cursor (x axis)
int8_t xOffset; ///< X dist from cursor pos to UL corner
int8_t yOffset; ///< Y dist from cursor pos to UL corner
uint16_t width; ///< Bitmap dimensions in pixels
uint16_t height; ///< Bitmap dimensions in pixels
uint16_t xAdvance; ///< Distance to advance cursor (x axis)
int16_t xOffset; ///< X dist from cursor pos to UL corner
int16_t yOffset; ///< Y dist from cursor pos to UL corner
} GFXglyph;

/// Data stored for FONT AS A WHOLE
Expand All @@ -23,7 +23,7 @@ typedef struct {
GFXglyph *glyph; ///< Glyph array
uint16_t first; ///< ASCII extents (first char)
uint16_t last; ///< ASCII extents (last char)
uint8_t yAdvance; ///< Newline distance (y axis)
uint16_t yAdvance; ///< Newline distance (y axis)
} GFXfont;

#endif // _GFXFONT_H_
Loading