freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] GSoC-2023-Ahmet 1afa5619b: html font names


From: Werner Lemberg
Subject: [freetype2] GSoC-2023-Ahmet 1afa5619b: html font names
Date: Wed, 5 Jul 2023 07:00:39 -0400 (EDT)

branch: GSoC-2023-Ahmet
commit 1afa5619ba1dcf551d52956ff2f4b1fd103f8a18
Author: goksu <25721443+goeksu@users.noreply.github.com>
Commit: goksu <25721443+goeksu@users.noreply.github.com>

    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('<h2>Results for {}</h2>\n'.format(fontname))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]