Browse Source

rpicamera: convert font into C header during compilation (#1638)

pull/1639/head
Alessandro Ros 2 years ago committed by GitHub
parent
commit
1b9584384c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      README.md
  2. 5
      internal/rpicamera/exe/Makefile
  3. 4
      internal/rpicamera/exe/text.c
  4. 8432
      internal/rpicamera/exe/text_font.h
  5. BIN
      internal/rpicamera/exe/text_font.ttf

1
README.md

@ -578,6 +578,7 @@ The server can be compiled with native support for the Raspberry Pi Camera. Comp @@ -578,6 +578,7 @@ The server can be compiled with native support for the Raspberry Pi Camera. Comp
* Go ≥ 1.20
* `libcamera-dev`
* `libfreetype-dev`
* `xxd`
* `patchelf`
Download the repository, open a terminal in it and run:

5
internal/rpicamera/exe/Makefile

@ -36,7 +36,10 @@ OBJS = \ @@ -36,7 +36,10 @@ OBJS = \
all: exe
%.o: %.c
text_font.h: text_font.ttf
xxd --include $< > text_font.h
%.o: %.c text_font.h
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.cpp

4
internal/rpicamera/exe/text.c

@ -42,8 +42,8 @@ bool text_create(const parameters_t *params, text_t **text) { @@ -42,8 +42,8 @@ bool text_create(const parameters_t *params, text_t **text) {
error = FT_New_Memory_Face(
textp->library,
IBMPlexMono_Medium,
sizeof(IBMPlexMono_Medium),
text_font_ttf,
sizeof(text_font_ttf),
0,
&textp->face);
if (error) {

8432
internal/rpicamera/exe/text_font.h

File diff suppressed because it is too large Load Diff

BIN
internal/rpicamera/exe/text_font.ttf

Binary file not shown.
Loading…
Cancel
Save