Ahmet Göksu pushed to branch GSoC-2023-Ahmet at FreeType / FreeType
Commits:
-
1afa5619
by goksu at 2023-07-05T14:00:12+03:00
2 changed files:
Changes:
... | ... | @@ -3,6 +3,7 @@ FTBENCH_DIR = $(TOP_DIR)/src/tools/ftbench |
3 | 3 | FTBENCH_SRC = $(FTBENCH_DIR)/ftbench.c
|
4 | 4 | FTBENCH_BIN = $(OBJ_DIR)/bench.o
|
5 | 5 | FTBENCH_FLAG ?= -c 200
|
6 | +INCLUDES = -I$(TOP_DIR)/include
|
|
6 | 7 | FONTS = $(wildcard $(FTBENCH_DIR)/fonts/*.ttf)
|
7 | 8 | BASELINE = $(addprefix $(FTBENCH_DIR)/baseline/, $(notdir $(FONTS:.ttf=.txt)))
|
8 | 9 | BENCHMARK = $(addprefix $(FTBENCH_DIR)/benchmark/, $(notdir $(FONTS:.ttf=.txt)))
|
... | ... | @@ -15,13 +16,12 @@ HTMLFILE = $(TOP_DIR)/benchmark.html |
15 | 16 | |
16 | 17 | # Create directories for baseline and benchmark
|
17 | 18 | $(OBJ_DIR) $(BASELINE_DIR) $(BENCHMARK_DIR):
|
18 | - @echo "Creating directory..."
|
|
19 | 19 | @mkdir -p $@
|
20 | 20 | |
21 | 21 | # Build ftbench
|
22 | 22 | $(FTBENCH_BIN): $(FTBENCH_SRC) | $(OBJ_DIR)
|
23 | 23 | @echo "Building ftbench..."
|
24 | - @$(CC) -I$(TOP_DIR)/include -lfreetype $< -o $@
|
|
24 | + $(CC) $(INCLUDES) $< -lfreetype -o $@
|
|
25 | 25 | |
26 | 26 | # Create a baseline
|
27 | 27 | .PHONY: baseline
|
... | ... | @@ -43,12 +43,17 @@ with open(benchmark_html, 'w') as html_file: |
43 | 43 | # Traverse through the 'baseline' directory
|
44 | 44 | for filename in os.listdir(baseline_dir):
|
45 | 45 | if filename != 'info.txt':
|
46 | - # If it's not the info file, it's a font file
|
|
47 | - fontname = filename.split('.')[0]
|
|
46 | +
|
|
48 | 47 | with open(os.path.join(baseline_dir, filename), 'r') as f:
|
49 | 48 | baseline_results = f.readlines()
|
50 | 49 | with open(os.path.join(benchmark_dir, filename), 'r') as f:
|
51 | 50 | benchmark_results = f.readlines()
|
51 | +
|
|
52 | + # Get font name from within the .txt file
|
|
53 | + for line in baseline_results:
|
|
54 | + if line.startswith("ftbench results for font"):
|
|
55 | + fontname = line.split('/')[-1].strip("'")[:-2]
|
|
56 | + |
|
52 | 57 | |
53 | 58 | # Write results to HTML
|
54 | 59 | html_file.write('<h2>Results for {}</h2>\n'.format(fontname))
|