ftbench demo with seperate makefile
This commit is contained in:
parent
562f348192
commit
9dd15018c2
|
@ -5,3 +5,4 @@ src/dlg/dlg.c
|
|||
subprojects/*
|
||||
!subprojects/*.wrap
|
||||
/tests/data/*
|
||||
.DS_Store
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
# Variables
|
||||
FTBENCH_SRC = ftbench.c
|
||||
FTBENCH_BIN = bench.out
|
||||
FTBENCH_FLAGS = $(shell pkg-config --cflags freetype2) -lfreetype
|
||||
FONTS = $(wildcard fonts/*.ttf)
|
||||
BASELINES = $(addprefix baselines/, $(notdir $(FONTS)))
|
||||
BENCHMARKS = $(addprefix benchmarks/, $(notdir $(FONTS)))
|
||||
|
||||
# Default target
|
||||
all: $(FTBENCH_BIN)
|
||||
|
||||
# Build ftbench
|
||||
$(FTBENCH_BIN): $(FTBENCH_SRC)
|
||||
gcc $(FTBENCH_FLAGS) $(FTBENCH_SRC) -o $(FTBENCH_BIN)
|
||||
|
||||
# Create directories for baselines and benchmarks
|
||||
baselines/ benchmarks/:
|
||||
mkdir -p $@
|
||||
|
||||
# Create a baseline
|
||||
.PHONY: baseline
|
||||
baseline: $(FTBENCH_BIN) baselines/
|
||||
$(foreach font, $(FONTS), \
|
||||
./$(FTBENCH_BIN) $(font) > baselines/$(notdir $(font)).txt; \
|
||||
)
|
||||
|
||||
# Benchmark and compare to baseline
|
||||
.PHONY: benchmark
|
||||
benchmark: $(FTBENCH_BIN) benchmarks/
|
||||
$(foreach font, $(FONTS), \
|
||||
./$(FTBENCH_BIN) $(font) > benchmarks/$(notdir $(font)).txt; \
|
||||
)
|
||||
$(foreach font, $(FONTS), \
|
||||
diff baselines/$(notdir $(font)).txt benchmarks/$(notdir $(font)).txt; \
|
||||
)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(FTBENCH_BIN)
|
||||
rm -rf baselines/ benchmarks/
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Define the Unicode range
|
||||
unicodes="U+0021-007E"
|
||||
|
||||
# Loop over all .ttf files in the current directory
|
||||
for fontfile in *.ttf
|
||||
do
|
||||
# Generate the output filename
|
||||
output="${fontfile%.ttf}_subset.ttf"
|
||||
|
||||
# Run the pyftsubset command
|
||||
pyftsubset "$fontfile" --unicodes=$unicodes --output-file="$output"
|
||||
done
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This is a cheap replacement for getopt() because that routine is not
|
||||
* available on some platforms and behaves differently on other platforms.
|
||||
*
|
||||
* This code is hereby expressly placed in the public domain.
|
||||
* mleisher@crl.nmsu.edu (Mark Leisher)
|
||||
* 10 October 1997
|
||||
*/
|
||||
|
||||
#ifndef MLGETOPT_H_
|
||||
#define MLGETOPT_H_
|
||||
|
||||
#ifdef VMS
|
||||
#include <stdio.h>
|
||||
#define getopt local_getopt
|
||||
#define optind local_optind
|
||||
#define opterr local_opterr
|
||||
#define optarg local_optarg
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int opterr;
|
||||
extern int optind;
|
||||
extern char* optarg;
|
||||
|
||||
extern int getopt(
|
||||
#ifdef __STDC__
|
||||
int argc,
|
||||
char* const* argv,
|
||||
const char* pattern
|
||||
#endif
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MLGETOPT_H_ */
|
||||
|
||||
|
||||
/* End */
|
Loading…
Reference in New Issue