diff options
Diffstat (limited to 'vendor/text.c')
| -rw-r--r-- | vendor/text.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/vendor/text.c b/vendor/text.c index c1548d6..f901f90 100644 --- a/vendor/text.c +++ b/vendor/text.c @@ -36,6 +36,16 @@ static const unsigned char go_medium[] = { static const unsigned char go_bold[] = { #embed "fonts/Go-Bold.ttf" }; +/* JetBrains Mono, for code: the same 0.6 em advance as Go Mono. */ +static const unsigned char jb_mono[] = { +#embed "fonts/JetBrainsMono-Regular.ttf" +}; +static const unsigned char jb_mono_bold[] = { +#embed "fonts/JetBrainsMono-Bold.ttf" +}; +static const unsigned char jb_mono_italic[] = { +#embed "fonts/JetBrainsMono-Italic.ttf" +}; static const struct { const unsigned char *bytes; size_t len; const char *family, *style; } faces[SK_TEXT_FACES] = { {go_mono, sizeof(go_mono), "Go Mono", ""}, {go_mono_bold, sizeof(go_mono_bold), "Go Mono", " Bold"}, @@ -43,6 +53,9 @@ static const struct { const unsigned char *bytes; size_t len; const char *family {go_regular, sizeof(go_regular), "Go", ""}, {go_medium, sizeof(go_medium), "Go Medium", ""}, {go_bold, sizeof(go_bold), "Go", " Bold"}, + {jb_mono, sizeof(jb_mono), "JetBrains Mono", ""}, + {jb_mono_bold, sizeof(jb_mono_bold), "JetBrains Mono", " Bold"}, + {jb_mono_italic, sizeof(jb_mono_italic), "JetBrains Mono", " Italic"}, }; typedef struct { @@ -117,7 +130,7 @@ static TextCache *cache_for(SDL_Renderer *renderer) { mono one. The sans faces fall back the same way after their own. */ const char *first = getenv("SKETCHBOOK_FONT"); for (int i = 0; i < SK_TEXT_FACES; ++i) { - const bool mono = i <= SK_TEXT_MONO_ITALIC; + const bool mono = i <= SK_TEXT_MONO_ITALIC || i >= SK_TEXT_CODE; char families[640]; snprintf(families, sizeof(families), "%s%s%s, %sNoto Sans Arabic, Noto Sans Hebrew, IBM Plex Sans JP, Noto Color Emoji, Noto Sans Symbols 2, DejaVu Sans, %s%s", mono && first ? first : "", mono && first ? ", " : "", faces[i].family, |
