html font names
This commit is contained in:
parent
e536bca36f
commit
1afa5619ba
@ -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
|
||||
|
@ -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('<h2>Results for {}</h2>\n'.format(fontname))
|
||||
|
Loading…
x
Reference in New Issue
Block a user