Move font to shared
This commit is contained in:
@@ -36,6 +36,8 @@ Once the upload completes, create a new release on GitLab and attach the URL of
|
||||
|
||||
This project is licensed under the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
For the license of bundled images and fonts, see [shared/cursor] and [shared/fonts].
|
||||
|
||||
[#buffybox:matrix.org]: https://matrix.to/#/#buffybox:matrix.org
|
||||
[buffyboard]: ./buffyboard
|
||||
[git-archive-all]: https://github.com/Kentzo/git-archive-all
|
||||
@@ -43,5 +45,7 @@ This project is licensed under the GNU General Public License as published by th
|
||||
[shared]: ./shared
|
||||
[squeek2lvgl]: ./squeek2lvgl
|
||||
[Squeekboard]: https://gitlab.gnome.org/World/Phosh/squeekboard
|
||||
[shared/cursor]: ./shared/cursor
|
||||
[shared/fonts]: ./shared/fonts
|
||||
[unl0kr]: ./unl0kr
|
||||
[unl0kr#42]: https://gitlab.com/cherrypicker/unl0kr/-/issues/42
|
||||
|
@@ -100,29 +100,6 @@ $ sudo ./_build/buffyboard
|
||||
|
||||
With meson <0.55 use `ninja` instead of `meson compile`.
|
||||
|
||||
## Fonts
|
||||
|
||||
In order to work with [LVGL], fonts need to be converted to bitmaps, stored as C arrays. Buffyboard currently uses a combination of the [OpenSans] font for text and the [FontAwesome] font for pictograms. For both fonts only limited character ranges are included to reduce the binary size. To (re)generate the C file containing the combined font, run the following command
|
||||
|
||||
```
|
||||
$ ./regenerate-fonts.sh
|
||||
```
|
||||
|
||||
Below is a short explanation of the different unicode ranges used above.
|
||||
|
||||
- [OpenSans]
|
||||
- Basic Latin (`0x0020-0x007F`)
|
||||
- Latin-1 supplement (`0x00A0-0x00FF`)
|
||||
- Latin extended A (`0x0100-0x017F`)
|
||||
- Greek and Coptic (`0x0370-0x03FF`)
|
||||
- General punctuation (`0x2000-0x206F`)
|
||||
- Currency symbols (`0x20A0-0x20CF`)
|
||||
- Mathematical operators (`0x2200-0x22FF`)
|
||||
- [FontAwesome]
|
||||
- Standard `LV_SYMBOL_*` glyphs (`0xF001,0xF008,0xF00B,0xF00C,0xF00D,0xF011,0xF013,0xF015,0xF019,0xF01C,0xF021,0xF026,0xF027,0xF028,0xF03E,0xF0E0,0xF304,0xF043,0xF048,0xF04B,0xF04C,0xF04D,0xF051,0xF052,0xF053,0xF054,0xF067,0xF068,0xF06E,0xF070,0xF071,0xF074,0xF077,0xF078,0xF079,0xF07B,0xF093,0xF095,0xF0C4,0xF0C5,0xF0C7,0xF0C9,0xF0E7,0xF0EA,0xF0F3,0xF11C,0xF124,0xF158,0xF1EB,0xF240,0xF241,0xF242,0xF243,0xF244,0xF287,0xF293,0xF2ED,0xF55A,0xF7C2,0xF8A2`)
|
||||
- [adjust](https://fontawesome.com/v5/icons/adjust) (`0xF042`)
|
||||
- [arrow-alt-circle-up](https://fontawesome.com/v5/icons/arrow-alt-circle-up) (`0xF35B`)
|
||||
|
||||
## Keyboard layouts
|
||||
|
||||
Buffyboard uses [squeekboard layouts] converted to C via [squeek2lvgl]. To regenerate the layouts, ensure that you have pipenv installed (e.g. via `pip install --user pipenv`) and then run
|
||||
@@ -141,22 +118,12 @@ The mouse cursor image was taken from [lv_sim_emscripten].
|
||||
|
||||
Buffyboard was inspired by [fbkeyboard].
|
||||
|
||||
# License
|
||||
|
||||
Buffyboard is licensed under the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
The [OpenSans] font is licensed under the Apache License 2.0.
|
||||
|
||||
The [FontAwesome] font is licensed under the Open Font License version 1.1.
|
||||
|
||||
# Footnotes
|
||||
|
||||
[^1]: If you still don't know what vampires have to do with all of this, the train of thought is: Linux frame**buffer** 👉 **buffy**board 👉 ... wait for it ... 👉 [**Buffy** the Vampire Slayer]. There you have it. I never claimed I was funny. 😅
|
||||
|
||||
[**Buffy** the Vampire Slayer]: https://en.wikipedia.org/wiki/Buffy_the_Vampire_Slayer
|
||||
[FontAwesome]: https://fontawesome.com/
|
||||
[LVGL]: https://lvgl.io
|
||||
[OpenSans]: https://fonts.google.com/specimen/Open+Sans
|
||||
[arrow-alt-circle-up]: https://fontawesome.com/v5.15/icons/arrow-alt-circle-up?style=solid
|
||||
[buffyboard.conf]: ./buffyboard.conf
|
||||
[fbkeyboard]: https://github.com/bakonyiferenc/fbkeyboard
|
||||
|
@@ -392,10 +392,10 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
||||
/*Optionally declare custom fonts here.
|
||||
*You can use these fonts as default font too and they will be available globally.
|
||||
*E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/
|
||||
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(font_32)
|
||||
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(bb_font_32)
|
||||
|
||||
/*Always set a default font*/
|
||||
#define LV_FONT_DEFAULT &font_32
|
||||
#define LV_FONT_DEFAULT &bb_font_32
|
||||
|
||||
/*Enable handling large font and/or fonts with a lot of characters.
|
||||
*The limit depends on the font size, font face and bpp.
|
||||
|
@@ -15,7 +15,6 @@ add_project_arguments('-DBB_VERSION="@0@"'.format(meson.project_version()), lang
|
||||
buffyboard_sources = [
|
||||
'command_line.c',
|
||||
'config.c',
|
||||
'font_32.c',
|
||||
'main.c',
|
||||
'sq2lv_layouts.c',
|
||||
'terminal.c',
|
||||
@@ -24,6 +23,7 @@ buffyboard_sources = [
|
||||
|
||||
shared_sources = [
|
||||
'../shared/cursor/cursor.c',
|
||||
'../shared/fonts/font_32.c',
|
||||
'../shared/indev.c',
|
||||
'../shared/log.c',
|
||||
'../shared/theme.c',
|
||||
|
@@ -1,24 +0,0 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
# Copyright 2022 Johannes Marbach
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
|
||||
npx lv_font_conv --bpp 4 --size 32 --no-compress -o font_32.c --format lvgl \
|
||||
--font OpenSans-Regular.ttf \
|
||||
--range '0x0020-0x007F' \
|
||||
--range '0x00A0-0x00FF' \
|
||||
--range '0x0100-0x017F' \
|
||||
--range '0x0370-0x03FF' \
|
||||
--range '0x2000-0x206F' \
|
||||
--range '0x20A0-0x20CF' \
|
||||
--range '0x2200-0x22FF' \
|
||||
--font FontAwesome5-Solid+Brands+Regular.woff \
|
||||
--range '0xF001,0xF008,0xF00B,0xF00C,0xF00D,0xF011,0xF013,0xF015,0xF019,0xF01C,0xF021,0xF026,0xF027,0xF028,0xF03E,0xF0E0,0xF304,0xF043,0xF048,0xF04B,0xF04C,0xF04D,0xF051,0xF052,0xF053,0xF054,0xF067,0xF068,0xF06E,0xF070,0xF071,0xF074,0xF077,0xF078,0xF079,0xF07B,0xF093,0xF095,0xF0C4,0xF0C5,0xF0C7,0xF0C9,0xF0E7,0xF0EA,0xF0F3,0xF11C,0xF124,0xF158,0xF1EB,0xF240,0xF241,0xF242,0xF243,0xF244,0xF287,0xF293,0xF2ED,0xF55A,0xF7C2,0xF8A2' \
|
||||
--range '0xF042' \
|
||||
--range '0xF35B'
|
||||
|
||||
# Fix type qualifier for compatibility with LV_FONT_DECLARE
|
||||
sed 's/^lv_font_t font_32/const lv_font_t font_32/g' font_32.c \
|
||||
> font_32.c.tmp
|
||||
mv font_32.c.tmp font_32.c
|
35
shared/fonts/README.md
Normal file
35
shared/fonts/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
Fonts
|
||||
=====
|
||||
|
||||
In order to work with [LVGL], fonts need to be converted to bitmaps, stored as C arrays. BuffyBox currently uses a combination of the [OpenSans] font for text and the [FontAwesome] font for pictograms. For both fonts only limited character ranges are included to reduce the binary size. To (re)generate the C file containing the combined font, run the following command
|
||||
|
||||
```
|
||||
$ ./regenerate.sh
|
||||
```
|
||||
|
||||
Below is a short explanation of the different unicode ranges used above.
|
||||
|
||||
- [OpenSans]
|
||||
- Basic Latin (`0x0020-0x007F`)
|
||||
- Latin-1 supplement (`0x00A0-0x00FF`)
|
||||
- Latin extended A (`0x0100-0x017F`)
|
||||
- Greek and Coptic (`0x0370-0x03FF`)
|
||||
- General punctuation (`0x2000-0x206F`)
|
||||
- Currency symbols (`0x20A0-0x20CF`)
|
||||
- Mathematical operators (`0x2200-0x22FF`)
|
||||
- [FontAwesome]
|
||||
- Standard `LV_SYMBOL_*` glyphs (`0xF001,0xF008,0xF00B,0xF00C,0xF00D,0xF011,0xF013,0xF015,0xF019,0xF01C,0xF021,0xF026,0xF027,0xF028,0xF03E,0xF0E0,0xF304,0xF043,0xF048,0xF04B,0xF04C,0xF04D,0xF051,0xF052,0xF053,0xF054,0xF067,0xF068,0xF06E,0xF070,0xF071,0xF074,0xF077,0xF078,0xF079,0xF07B,0xF093,0xF095,0xF0C4,0xF0C5,0xF0C7,0xF0C9,0xF0E7,0xF0EA,0xF0F3,0xF11C,0xF124,0xF158,0xF1EB,0xF240,0xF241,0xF242,0xF243,0xF244,0xF287,0xF293,0xF2ED,0xF55A,0xF7C2,0xF8A2`)
|
||||
- [adjust] (`0xF042`)
|
||||
- [arrow-alt-circle-up] (`0xF35B`)
|
||||
|
||||
## License
|
||||
|
||||
The [OpenSans] font is licensed under the Apache License 2.0.
|
||||
|
||||
The [FontAwesome] font is licensed under the Open Font License version 1.1.
|
||||
|
||||
[LVGL]: https://lvgl.io
|
||||
[FontAwesome]: https://fontawesome.com/
|
||||
[OpenSans]: https://fonts.google.com/specimen/Open+Sans
|
||||
[adjust](https://fontawesome.com/v5/icons/adjust)
|
||||
[arrow-alt-circle-up](https://fontawesome.com/v5/icons/arrow-alt-circle-up)
|
@@ -15499,9 +15499,9 @@ static lv_font_fmt_txt_dsc_t font_dsc = {
|
||||
|
||||
/*Initialize a public general font descriptor*/
|
||||
#if LV_VERSION_CHECK(8, 0, 0)
|
||||
const lv_font_t font_32 = {
|
||||
const lv_font_t bb_font_32 = {
|
||||
#else
|
||||
const lv_font_t font_32 = {
|
||||
const lv_font_t bb_font_32 = {
|
||||
#endif
|
||||
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
|
||||
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
|
@@ -18,7 +18,8 @@ npx lv_font_conv --bpp 4 --size 32 --no-compress -o font_32.c --format lvgl \
|
||||
--range '0xF042' \
|
||||
--range '0xF35B'
|
||||
|
||||
# Fix type qualifier for compatibility with LV_FONT_DECLARE
|
||||
sed 's/^lv_font_t font_32/const lv_font_t font_32/g' font_32.c \
|
||||
# Fix type qualifier for compatibility with LV_FONT_DECLARE and add prefix
|
||||
sed 's/^lv_font_t /const lv_font_t /g' font_32.c \
|
||||
| sed 's/lv_font_t font_32/lv_font_t bb_font_32/g' \
|
||||
> font_32.c.tmp
|
||||
mv font_32.c.tmp font_32.c
|
@@ -86,7 +86,7 @@ static void keyboard_draw_task_added_cb(lv_event_t *event);
|
||||
|
||||
static void init_styles(const bb_theme *theme) {
|
||||
reset_style(&(styles.widget));
|
||||
lv_style_set_text_font(&(styles.widget), &font_32);
|
||||
lv_style_set_text_font(&(styles.widget), &bb_font_32);
|
||||
|
||||
reset_style(&(styles.window));
|
||||
lv_style_set_bg_opa(&(styles.window), LV_OPA_COVER);
|
||||
@@ -376,9 +376,9 @@ void bb_theme_apply(const bb_theme *theme) {
|
||||
}
|
||||
|
||||
lv_theme.disp = NULL;
|
||||
lv_theme.font_small = &font_32;
|
||||
lv_theme.font_normal = &font_32;
|
||||
lv_theme.font_large = &font_32;
|
||||
lv_theme.font_small = &bb_font_32;
|
||||
lv_theme.font_normal = &bb_font_32;
|
||||
lv_theme.font_large = &bb_font_32;
|
||||
lv_theme.apply_cb = apply_theme_cb;
|
||||
|
||||
current_theme = *theme;
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -129,29 +129,6 @@ Note that if [libdrm] is installed, the DRM backend will be compiled in automati
|
||||
$ meson _build -Dwith-drm=disabled
|
||||
```
|
||||
|
||||
## Fonts
|
||||
|
||||
In order to work with [LVGL], fonts need to be converted to bitmaps, stored as C arrays. Unl0kr currently uses a combination of the [OpenSans] font for text and the [FontAwesome] font for pictograms. For both fonts only limited character ranges are included to reduce the binary size. To (re)generate the C file containing the combined font, run the following command
|
||||
|
||||
```
|
||||
$ ./regenerate-fonts.sh
|
||||
```
|
||||
|
||||
Below is a short explanation of the different unicode ranges used above.
|
||||
|
||||
- [OpenSans]
|
||||
- Basic Latin (`0x0020-0x007F`)
|
||||
- Latin-1 supplement (`0x00A0-0x00FF`)
|
||||
- Latin extended A (`0x0100-0x017F`)
|
||||
- Greek and Coptic (`0x0370-0x03FF`)
|
||||
- General punctuation (`0x2000-0x206F`)
|
||||
- Currency symbols (`0x20A0-0x20CF`)
|
||||
- Mathematical operators (`0x2200-0x22FF`)
|
||||
- [FontAwesome]
|
||||
- Standard `LV_SYMBOL_*` glyphs (`0xF001,0xF008,0xF00B,0xF00C,0xF00D,0xF011,0xF013,0xF015,0xF019,0xF01C,0xF021,0xF026,0xF027,0xF028,0xF03E,0xF0E0,0xF304,0xF043,0xF048,0xF04B,0xF04C,0xF04D,0xF051,0xF052,0xF053,0xF054,0xF067,0xF068,0xF06E,0xF070,0xF071,0xF074,0xF077,0xF078,0xF079,0xF07B,0xF093,0xF095,0xF0C4,0xF0C5,0xF0C7,0xF0C9,0xF0E7,0xF0EA,0xF0F3,0xF11C,0xF124,0xF158,0xF1EB,0xF240,0xF241,0xF242,0xF243,0xF244,0xF287,0xF293,0xF2ED,0xF55A,0xF7C2,0xF8A2`)
|
||||
- [adjust](https://fontawesome.com/v5/icons/adjust) (`0xF042`)
|
||||
- [arrow-alt-circle-up](https://fontawesome.com/v5/icons/arrow-alt-circle-up) (`0xF35B`)
|
||||
|
||||
## Keyboard layouts
|
||||
|
||||
Unl0kr uses [squeekboard layouts] converted to C via [squeek2lvgl]. To regenerate the layouts, ensure that you have pipenv installed (e.g. via `pip install --user pipenv`) and then run
|
||||
@@ -184,17 +161,7 @@ $ sudo ffmpeg -f fbdev -i /dev/fb0 -r 24 -c:v libx264 -b:v 500k demo.avi
|
||||
|
||||
The [lv_port_linux_frame_buffer] project served as a starting point for the codebase.
|
||||
|
||||
# License
|
||||
|
||||
Unl0kr is licensed under the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
The [OpenSans] font is licensed under the Apache License 2.0.
|
||||
|
||||
The [FontAwesome] font is licensed under the Open Font License version 1.1.
|
||||
|
||||
[FontAwesome]: https://fontawesome.com
|
||||
[LVGL]: https://lvgl.io
|
||||
[OpenSans]: https://fonts.google.com/specimen/Open+Sans
|
||||
[adjust]: https://fontawesome.com/v5.15/icons/adjust?style=solid
|
||||
[arrow-alt-circle-up]: https://fontawesome.com/v5.15/icons/arrow-alt-circle-up?style=solid
|
||||
[inih]: https://github.com/benhoyt/inih
|
||||
|
15523
unl0kr/font_32.c
15523
unl0kr/font_32.c
File diff suppressed because it is too large
Load Diff
@@ -286,10 +286,10 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
||||
/*Optionally declare custom fonts here.
|
||||
*You can use these fonts as default font too and they will be available globally.
|
||||
*E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/
|
||||
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(font_32)
|
||||
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(bb_font_32)
|
||||
|
||||
/*Always set a default font*/
|
||||
#define LV_FONT_DEFAULT &font_32
|
||||
#define LV_FONT_DEFAULT &bb_font_32
|
||||
|
||||
/*Enable handling large font and/or fonts with a lot of characters.
|
||||
*The limit depends on the font size, font face and bpp.
|
||||
|
@@ -16,7 +16,6 @@ unl0kr_sources = [
|
||||
'backends.c',
|
||||
'command_line.c',
|
||||
'config.c',
|
||||
'font_32.c',
|
||||
'main.c',
|
||||
'sq2lv_layouts.c',
|
||||
'terminal.c',
|
||||
@@ -24,6 +23,7 @@ unl0kr_sources = [
|
||||
|
||||
shared_sources = [
|
||||
'../shared/cursor/cursor.c',
|
||||
'../shared/fonts/font_32.c',
|
||||
'../shared/indev.c',
|
||||
'../shared/log.c',
|
||||
'../shared/theme.c',
|
||||
|
Reference in New Issue
Block a user