Browse Source

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

pull/1639/head
Alessandro Ros 3 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
* Go ≥ 1.20 * Go ≥ 1.20
* `libcamera-dev` * `libcamera-dev`
* `libfreetype-dev` * `libfreetype-dev`
* `xxd`
* `patchelf` * `patchelf`
Download the repository, open a terminal in it and run: Download the repository, open a terminal in it and run:

5
internal/rpicamera/exe/Makefile

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

4
internal/rpicamera/exe/text.c

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