From 1afa5619ba1dcf551d52956ff2f4b1fd103f8a18 Mon Sep 17 00:00:00 2001 From: goksu <25721443+goeksu@users.noreply.github.com> Date: Wed, 5 Jul 2023 14:00:12 +0300 Subject: [PATCH] html font names --- builds/testing.mk | 4 ++-- src/tools/ftbench/src/tohtml.py | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/builds/testing.mk b/builds/testing.mk index ff82859c7..c7eb267d9 100644 --- a/builds/testing.mk +++ b/builds/testing.mk @@ -3,6 +3,7 @@ FTBENCH_DIR = $(TOP_DIR)/src/tools/ftbench FTBENCH_SRC = $(FTBENCH_DIR)/ftbench.c FTBENCH_BIN = $(OBJ_DIR)/bench.o FTBENCH_FLAG ?= -c 200 +INCLUDES = -I$(TOP_DIR)/include FONTS = $(wildcard $(FTBENCH_DIR)/fonts/*.ttf) BASELINE = $(addprefix $(FTBENCH_DIR)/baseline/, $(notdir $(FONTS:.ttf=.txt))) BENCHMARK = $(addprefix $(FTBENCH_DIR)/benchmark/, $(notdir $(FONTS:.ttf=.txt))) @@ -15,13 +16,12 @@ HTMLFILE = $(TOP_DIR)/benchmark.html # Create directories for baseline and benchmark $(OBJ_DIR) $(BASELINE_DIR) $(BENCHMARK_DIR): - @echo "Creating directory..." @mkdir -p $@ # Build ftbench $(FTBENCH_BIN): $(FTBENCH_SRC) | $(OBJ_DIR) @echo "Building ftbench..." - @$(CC) -I$(TOP_DIR)/include -lfreetype $< -o $@ + $(CC) $(INCLUDES) $< -lfreetype -o $@ # Create a baseline .PHONY: baseline diff --git a/src/tools/ftbench/src/tohtml.py b/src/tools/ftbench/src/tohtml.py index 149265fc5..3d227bf2b 100644 --- a/src/tools/ftbench/src/tohtml.py +++ b/src/tools/ftbench/src/tohtml.py @@ -43,12 +43,17 @@ with open(benchmark_html, 'w') as html_file: # Traverse through the 'baseline' directory for filename in os.listdir(baseline_dir): if filename != 'info.txt': - # If it's not the info file, it's a font file - fontname = filename.split('.')[0] + with open(os.path.join(baseline_dir, filename), 'r') as f: baseline_results = f.readlines() with open(os.path.join(benchmark_dir, filename), 'r') as f: benchmark_results = f.readlines() + + # Get font name from within the .txt file + for line in baseline_results: + if line.startswith("ftbench results for font"): + fontname = line.split('/')[-1].strip("'")[:-2] + # Write results to HTML html_file.write('

Results for {}

\n'.format(fontname))