diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 14:18:36 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-12 13:22:02 -0300 |
| commit | 534e82b5617f584f7165c52d3025d7d584d90349 (patch) | |
| tree | 5f5ffeb0ae145d5c1cf1845efbadccf145c36f2e /vendor | |
| parent | 45f705a5e590c3dfddc0a544e66beb9bf6205a4d (diff) | |
| download | sketchbook-534e82b5617f584f7165c52d3025d7d584d90349.tar.gz sketchbook-534e82b5617f584f7165c52d3025d7d584d90349.zip | |
sketchbook: JetBrains Mono bundled as three more faces (.code, .code_bold, .code_italic), for programs
Diffstat (limited to 'vendor')
| -rw-r--r-- | vendor/fonts/JetBrainsMono-Bold.ttf | bin | 0 -> 277828 bytes | |||
| -rw-r--r-- | vendor/fonts/JetBrainsMono-Italic.ttf | bin | 0 -> 276840 bytes | |||
| -rw-r--r-- | vendor/fonts/JetBrainsMono-Regular.ttf | bin | 0 -> 273900 bytes | |||
| -rw-r--r-- | vendor/fonts/LICENSE-JetBrainsMono | 93 | ||||
| -rw-r--r-- | vendor/fonts/README.md | 8 | ||||
| -rw-r--r-- | vendor/text.c | 15 | ||||
| -rw-r--r-- | vendor/text.h | 2 |
7 files changed, 115 insertions, 3 deletions
diff --git a/vendor/fonts/JetBrainsMono-Bold.ttf b/vendor/fonts/JetBrainsMono-Bold.ttf Binary files differnew file mode 100644 index 0000000..8c93043 --- /dev/null +++ b/vendor/fonts/JetBrainsMono-Bold.ttf diff --git a/vendor/fonts/JetBrainsMono-Italic.ttf b/vendor/fonts/JetBrainsMono-Italic.ttf Binary files differnew file mode 100644 index 0000000..ccc9d6a --- /dev/null +++ b/vendor/fonts/JetBrainsMono-Italic.ttf diff --git a/vendor/fonts/JetBrainsMono-Regular.ttf b/vendor/fonts/JetBrainsMono-Regular.ttf Binary files differnew file mode 100644 index 0000000..dff66cc --- /dev/null +++ b/vendor/fonts/JetBrainsMono-Regular.ttf diff --git a/vendor/fonts/LICENSE-JetBrainsMono b/vendor/fonts/LICENSE-JetBrainsMono new file mode 100644 index 0000000..8bee414 --- /dev/null +++ b/vendor/fonts/LICENSE-JetBrainsMono @@ -0,0 +1,93 @@ +Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/vendor/fonts/README.md b/vendor/fonts/README.md index 3c49784..34b26a0 100644 --- a/vendor/fonts/README.md +++ b/vendor/fonts/README.md @@ -17,7 +17,13 @@ Five more faces of the same family are bundled the same way, for Each is a font description of its own (`sk_text_draw_face`); the sans faces fall back to installed sans families instead of mono ones. -The font is embedded in the binary with C23 `#embed`. It is registered in a +Three faces of **JetBrains Mono** follow them (`.code`, `.code_bold`, +`.code_italic`): `JetBrainsMono-Regular.ttf`, `-Bold.ttf` and +`-Italic.ttf` as the `ttf-jetbrains-mono` package installs them, under the +SIL Open Font License in `LICENSE-JetBrainsMono`. They fall back as the +mono faces do. + +The fonts are embedded in the binary with C23 `#embed`. It is registered in a private Fontconfig config through a Linux memfd, so moving the executable does not require a font installation or the source checkout. Installed outline fonts provide Unicode fallback, in the order listed in `vendor/text.c`; actual glyph 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, diff --git a/vendor/text.h b/vendor/text.h index a421961..71cf0d1 100644 --- a/vendor/text.h +++ b/vendor/text.h @@ -11,7 +11,7 @@ bool sk_text_draw(SDL_Renderer *, float x, float y, float scale, bool sk_text_measure(SDL_Renderer *, float scale, const char *utf8, size_t len, float *width, float *height); /* The same in another face of the bundled Go family (`abi.Face`'s order). */ -enum { SK_TEXT_MONO, SK_TEXT_MONO_BOLD, SK_TEXT_MONO_ITALIC, SK_TEXT_SANS, SK_TEXT_SANS_MEDIUM, SK_TEXT_SANS_BOLD, SK_TEXT_FACES }; +enum { SK_TEXT_MONO, SK_TEXT_MONO_BOLD, SK_TEXT_MONO_ITALIC, SK_TEXT_SANS, SK_TEXT_SANS_MEDIUM, SK_TEXT_SANS_BOLD, SK_TEXT_CODE, SK_TEXT_CODE_BOLD, SK_TEXT_CODE_ITALIC, SK_TEXT_FACES }; bool sk_text_draw_face(SDL_Renderer *, int face, float x, float y, float scale, const char *utf8, size_t len, Uint8 r, Uint8 g, Uint8 b, Uint8 a); bool sk_text_measure_face(SDL_Renderer *, int face, float scale, const char *utf8, size_t len, |
