Skip to content

Commit

Permalink
fix(fonts): make full range of chars available to use
Browse files Browse the repository at this point in the history
  • Loading branch information
slimit75 committed Mar 11, 2024
1 parent 8d571f0 commit f28145a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/fonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ void xpd_font_cache(xpd_font_face_t *font, int size, char letter) {

#define XSTR(x) STR(x)
#define STR(x) #x
#pragma message "The value of CHAR_MAX: " XSTR(CHAR_MAX)
#pragma message "The value of CHAR_MIN: " XSTR(CHAR_MIN)
#pragma message "The value of XPD_CHAR_MAX: " XSTR(XPD_CHAR_MAX)

for (int i = 0; (i < CHAR_MAX) && (i <= font->letters_idx); i++) {
for (int i = 0; (i < XPD_CHAR_MAX) && (i <= font->letters_idx); i++) {
if (font->letters[i].size == size && font->letters[i].letter == letter) {
not_loaded = false;
break;
Expand Down
4 changes: 3 additions & 1 deletion src/xpdraw/fonts.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
extern "C" {
#endif

#define XPD_CHAR_MAX (CHAR_MAX - CHAR_MIN)

typedef enum {
xpdAlignLeft,
xpdAlignCenter,
Expand All @@ -45,7 +47,7 @@ typedef struct {

typedef struct {
FT_Face ftFace;
xpd_font_letter_t letters[CHAR_MAX];
xpd_font_letter_t letters[XPD_CHAR_MAX];
int letters_idx;
} xpd_font_face_t;

Expand Down

0 comments on commit f28145a

Please sign in to comment.