diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 85cf356..abfe8d8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,6 +43,7 @@ jobs: run: | sudo apt-get update -q -y sudo apt install libsdl2-dev libjpeg-dev libpng-dev + sudo apt install libcairo2-dev shell: bash - name: default build run: | diff --git a/.gitignore b/.gitignore index fa53b1f..5d13656 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ *.a demo-* .demo-* +font-edit +.font-edit # Swap [._]*.s[a-v][a-z] @@ -28,8 +30,5 @@ __pycache__/ .config.old config.h -# Tools -tools/ttf/twin-ttf - # CI pipeline -expected-format \ No newline at end of file +expected-format diff --git a/Makefile b/Makefile index d7dd21f..e61260f 100644 --- a/Makefile +++ b/Makefile @@ -142,6 +142,20 @@ demo-$(BACKEND)_ldflags-y := \ $(TARGET_LIBS) endif +ifeq ($(CONFIG_TOOLS), y) +target-$(CONFIG_TOOL_FONTEDIT) += font-edit +font-edit_files-y = \ + tools/font-edit/sfit.c \ + tools/font-edit/font-edit.c +font-edit_includes-y := tools/font-edit +font-edit_cflags-y := \ + $(shell pkg-config --cflags cairo) \ + $(shell sdl2-config --cflags) +font-edit_ldflags-y := \ + $(shell pkg-config --libs cairo) \ + $(shell sdl2-config --libs) +endif + CFLAGS += -include config.h check_goal := $(strip $(MAKECMDGOALS)) diff --git a/configs/Kconfig b/configs/Kconfig index 1a601fc..7e281f1 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -123,4 +123,18 @@ config DEMO_IMAGE select LOADER_TVG default y depends on DEMO_APPLICATIONS + +endmenu + +menu "Tools" + +config TOOLS + bool "Build tools" + default y + +config TOOL_FONTEDIT + bool "Build scalable font editor" + default y + depends on TOOLS + endmenu diff --git a/tools/font-edit/Makefile b/tools/font-edit/Makefile deleted file mode 100644 index 1b25526..0000000 --- a/tools/font-edit/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -TARGET = twin-fedit - -CFLAGS = $(shell pkg-config --cflags cairo) $(shell sdl2-config --cflags) -g -Wall -LIBS = $(shell pkg-config --libs cairo) $(shell sdl2-config --libs) - -OBJS = \ - twin-fedit.o \ - sfit.o - -$(TARGET): $(OBJS) - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) - -clean: - rm -f $(TARGET) $(OBJS) diff --git a/tools/font-edit/README.md b/tools/font-edit/README.md index f1d2379..0c40bdc 100644 --- a/tools/font-edit/README.md +++ b/tools/font-edit/README.md @@ -1,5 +1,5 @@ -# twin-fedit -`twin-fedit` is a tool allowing users to edit specific scalable fonts +# font-edit +`font-edit` is a tool allowing users to edit specific scalable fonts which are expected to fit the requirements of embedded systems with larger screens.
@@ -13,14 +13,13 @@ sudo apt-get install libsdl2-dev libcairo2-dev
## Usage
```shell
-make
-./twin-fedit nchars
+./font-edit nchars
```
## Background
-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.
+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.
-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
+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
```
/* 0x31 '1' offset 666 */
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
3. `'l' 10,0`: Starting from `10,-42` and ending at `10,0`, draw a straight line.
4. `'e'`: End the drawing of glyph `1`.
-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.
+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.
## Quick Guide
For each glyph, there are the following shortcut keys used for editing the glyph.
@@ -90,4 +89,4 @@ To delete a point
2. Use d key to delete the selected point.
To undo any operations above
-1. Use u key.
\ No newline at end of file
+1. Use u key.
diff --git a/tools/font-edit/twin-fedit.c b/tools/font-edit/font-edit.c
similarity index 99%
rename from tools/font-edit/twin-fedit.c
rename to tools/font-edit/font-edit.c
index c2e8437..3987a57 100644
--- a/tools/font-edit/twin-fedit.c
+++ b/tools/font-edit/font-edit.c
@@ -21,13 +21,13 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-#include "twin-fedit.h"
-
#include