From 523b810d6a9c60342c7f5d74f36fe66f3f2057e9 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sun, 27 Sep 2026 08:44:42 +0100 Subject: Draw glyphs and icons from one symbol format, by exact pixel area Symbol files (VEGASYM1) hold glyphs and icons as quadratic curves, verified once per symbol and then read in place. vega-symbols builds them from fonts (through FreeType, losslessly: twice the font's units keeps TrueType's implied points whole) and from solid SVG paths (arcs included), refusing by name what an icon asks for that symbols cannot hold. The reference rasterizer computes each pixel's covered area exactly: every curve's integral of clamp(1 - x) dy inside the pixel, split where it crosses the pixel's sides. The Slug-style two-ray average first tried missed FreeType by 15.4 levels on average at 12 px; exact area is within 1.2-3.5 at 8-16 px, and where it differs most it matches 64x64 supersampling, not FreeType. Reaching an outline costs 4.6-29x less than through FreeType, but the files are 2.1-6.6x larger than glyf or CFF: design 002 has the numbers and the next question (points shared along contours, lines without control points). --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index bc73568..8cbdff8 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ PURE_SOURCES = $(PURE)/module.c $(PURE)/module-list.c $(PURE)/module-save.c $(PU SOURCES = src/screen.c src/draw.c src/width.c src/web.c src/main.c .PHONY: all check -all: $(BUILD)/vega +all: $(BUILD)/vega $(BUILD)/vega-symbols $(BUILD): mkdir -p $@ @@ -19,7 +19,13 @@ $(BUILD): $(BUILD)/vega: $(SOURCES) src/vega.h $(PURE_SOURCES) | $(BUILD) $(CC) $(CPPFLAGS) $(CFLAGS) -I$(PURE) $(SOURCES) $(PURE_SOURCES) $(LDFLAGS) -lm $(LDLIBS) -o $@ -check: $(BUILD)/vega +# Building symbol files reads fonts through FreeType; reading them does not. +FREETYPE_CFLAGS ?= $(shell pkg-config --cflags freetype2) +FREETYPE_LIBS ?= $(shell pkg-config --libs freetype2) +$(BUILD)/vega-symbols: src/symbols-tool.c src/symbols.c src/symbols.h | $(BUILD) + $(CC) $(CPPFLAGS) $(CFLAGS) $(FREETYPE_CFLAGS) src/symbols-tool.c src/symbols.c $(LDFLAGS) $(FREETYPE_LIBS) -lm $(LDLIBS) -o $@ + +check: $(BUILD)/vega $(BUILD)/vega-symbols $(MAKE) -C $(AUP) build/aup $(MAKE) -C $(PURE) build/pure-serve - python3 tests/check.py --vega $(BUILD)/vega --aup $(AUP)/build/aup --serve $(PURE)/build/pure-serve + python3 tests/check.py --vega $(BUILD)/vega --symbols $(BUILD)/vega-symbols --aup $(AUP)/build/aup --serve $(PURE)/build/pure-serve -- cgit v1.2.3