Skip to content

Commit d2eb968

Browse files
committed
font-edit: Unify the build system
The 'font-edit' tool previously used a simple Makefile for building, but has now been integrated into the unified build system used across all modules.
1 parent eeb3303 commit d2eb968

File tree

9 files changed

+42
-29
lines changed

9 files changed

+42
-29
lines changed

.github/workflows/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
run: |
4444
sudo apt-get update -q -y
4545
sudo apt install libsdl2-dev libjpeg-dev libpng-dev
46+
sudo apt install libcairo2-dev
4647
shell: bash
4748
- name: default build
4849
run: |

.gitignore

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*.a
55
demo-*
66
.demo-*
7+
font-edit
8+
.font-edit
79

810
# Swap
911
[._]*.s[a-v][a-z]
@@ -28,8 +30,5 @@ __pycache__/
2830
.config.old
2931
config.h
3032

31-
# Tools
32-
tools/ttf/twin-ttf
33-
3433
# CI pipeline
35-
expected-format
34+
expected-format

Makefile

+14
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,20 @@ demo-$(BACKEND)_ldflags-y := \
142142
$(TARGET_LIBS)
143143
endif
144144

145+
ifeq ($(CONFIG_TOOLS), y)
146+
target-$(CONFIG_TOOL_FONTEDIT) += font-edit
147+
font-edit_files-y = \
148+
tools/font-edit/sfit.c \
149+
tools/font-edit/font-edit.c
150+
font-edit_includes-y := tools/font-edit
151+
font-edit_cflags-y := \
152+
$(shell pkg-config --cflags cairo) \
153+
$(shell sdl2-config --cflags)
154+
font-edit_ldflags-y := \
155+
$(shell pkg-config --libs cairo) \
156+
$(shell sdl2-config --libs)
157+
endif
158+
145159
CFLAGS += -include config.h
146160

147161
check_goal := $(strip $(MAKECMDGOALS))

configs/Kconfig

+14
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,18 @@ config DEMO_IMAGE
123123
select LOADER_TVG
124124
default y
125125
depends on DEMO_APPLICATIONS
126+
127+
endmenu
128+
129+
menu "Tools"
130+
131+
config TOOLS
132+
bool "Build tools"
133+
default y
134+
135+
config TOOL_FONTEDIT
136+
bool "Build scalable font editor"
137+
default y
138+
depends on TOOLS
139+
126140
endmenu

tools/font-edit/Makefile

-14
This file was deleted.

tools/font-edit/README.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# twin-fedit
2-
`twin-fedit` is a tool allowing users to edit specific scalable fonts
1+
# font-edit
2+
`font-edit` is a tool allowing users to edit specific scalable fonts
33
which are expected to fit the requirements of embedded systems with larger screens.
44

55
<p align="center">
@@ -13,14 +13,13 @@ sudo apt-get install libsdl2-dev libcairo2-dev
1313

1414
## Usage
1515
```shell
16-
make
17-
./twin-fedit nchars
16+
./font-edit nchars
1817
```
1918

2019
## Background
21-
The glyphs in `twin-fedit` is originated from [Hershey vector fonts](https://en.wikipedia.org/wiki/Hershey_fonts), which were created by Dr. A. V. Hershey while working at the U. S. National Bureau of Standards.
20+
The glyphs in `font-edit` is originated from [Hershey vector fonts](https://en.wikipedia.org/wiki/Hershey_fonts), which were created by Dr. A. V. Hershey while working at the U. S. National Bureau of Standards.
2221

23-
The Hershey vector fonts set of `twin-fedit` is [`nchars`](nchars), for example, the interpolation points and operations used to draw the glyph `1` are as follows
22+
The Hershey vector fonts set of `font-edit` is [`nchars`](nchars), for example, the interpolation points and operations used to draw the glyph `1` are as follows
2423
```
2524
/* 0x31 '1' offset 666 */
2625
0, 10, 42, 0, 2, 3,
@@ -51,7 +50,7 @@ According to the steps outlined above for drawing glyph `1`, it can be split int
5150
3. `'l' 10,0`: Starting from `10,-42` and ending at `10,0`, draw a straight line.
5251
4. `'e'`: End the drawing of glyph `1`.
5352

54-
Each point seen in `twin-fedit` corresponds to an operation. By selecting a point in `twin-fedit`, you can modify the coordinates to edit any glyph.
53+
Each point seen in `font-edit` corresponds to an operation. By selecting a point in `font-edit`, you can modify the coordinates to edit any glyph.
5554

5655
## Quick Guide
5756
For each glyph, there are the following shortcut keys used for editing the glyph.
@@ -90,4 +89,4 @@ To delete a point
9089
2. Use d key to delete the selected point.
9190

9291
To undo any operations above
93-
1. Use u key.
92+
1. Use u key.

tools/font-edit/twin-fedit.c tools/font-edit/font-edit.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
* PERFORMANCE OF THIS SOFTWARE.
2222
*/
2323

24-
#include "twin-fedit.h"
25-
2624
#include <SDL.h>
2725
#include <SDL_keycode.h>
2826
#include <cairo.h>
2927
#include <stdbool.h>
3028

29+
#include "font-edit.h"
30+
3131
static SDL_Window *window;
3232
static cairo_t *cr;
3333
static cairo_surface_t *surface;
File renamed without changes.

tools/font-edit/sfit.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* PERFORMANCE OF THIS SOFTWARE.
2121
*/
2222

23-
#include "twin-fedit.h"
23+
#include "font-edit.h"
2424

2525
static double min(double a, double b)
2626
{

0 commit comments

Comments
 (0)