From 59bafd90482dd258dd02d032fbaa99b1c259f3b5 Mon Sep 17 00:00:00 2001 From: Kushal K S V S Date: Thu, 3 Aug 2017 10:36:08 -0700 Subject: script to compile and run --- include/freetype/config/ftoption.h | 2 +- tests/make_png/Makefile | 5 +-- tests/make_png/README | 80 ++++++++++++++++++++++++------------- tests/make_png/bitmap.c | 16 ++------ tests/make_png/bitmap.h | 3 +- tests/make_png/make_sprite.c | 6 +-- tests/make_png/runme.sh | 30 ++++++++++++++ tests/make_png/test.ttf | Bin 0 -> 27296 bytes 8 files changed, 91 insertions(+), 51 deletions(-) create mode 100644 tests/make_png/runme.sh create mode 100644 tests/make_png/test.ttf diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 935e20d8d..80bb0fc51 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -122,7 +122,7 @@ FT_BEGIN_HEADER /* This is done to allow FreeType clients to run unmodified, forcing */ /* them to display normal gray-level anti-aliased glyphs. */ /* */ -/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ +#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING /*************************************************************************/ diff --git a/tests/make_png/Makefile b/tests/make_png/Makefile index 70187bf38..b742dbff7 100644 --- a/tests/make_png/Makefile +++ b/tests/make_png/Makefile @@ -4,12 +4,12 @@ SHELL = /bin/sh SRC_SPRITE = make_sprite.c bitmap.c murmur3.c -SRC_LIB = ../../objs/libfreetype.a +SRC_LIB = ./base/lib/libfreetype.a OBJS = $(src:.c=.o) CFLAGS = -Wall -g CC = gcc -INCLUDE = -I ../../include/ +INCLUDE = -I ./base/include/freetype2/ LIBS = -lpng -lharfbuzz -lbz2 -ldl DPI = 72 @@ -25,4 +25,3 @@ clean: - diff --git a/tests/make_png/README b/tests/make_png/README index fd426acbf..d880bbcf7 100644 --- a/tests/make_png/README +++ b/tests/make_png/README @@ -1,48 +1,72 @@ -NOTE: First make freetype library (in the ../../ directory) - make devel - make TODO: Generate HTML page for detailed comparison -/*******************************************************************/ +--------------------------------------------------------------------- -To generate sprite sheets in the /images folder and to generate the -"index.html" (List-View) of the glyphs. +INSTRUCTIONS -By clicking on the Headers of the respective columns,they can be -arranged (in increasing/decreasing order) based on --> Glyph-Index --> Name --> Difference Metric (right now it is the number of pixels that are - different between the base and the test glyph) +NOTE: One version of FreeType is referred as "base" version and the + other as the "test" version. -It displays the whole sprite sheet right now (will be used later) -Hashes will be diplayed (To be implemented) + 1. Get the two versions ready + ------------------------------------- + Make two folders named "test" and "base" preferably in the home + directory. -First compile and install two versions of the FreeType libray -in different folders (with SUBPIXEL_RENDERING enabled in ftoption.h) + Next, download an older version of FreeType (For example : 2.6.5) + ( This being the "test" version of the two) + Go to 'include/freetype/ftoption.h' and uncomment this line + #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING + + 2. Install the two versions + ------------------------------------- + Go to the "test" version's folder and change the default + installation directory to the "test" folder created. -1) make sprite - (set resoluton in DPI by passing argument + ./configure --prefix= + + Compile and install the library + + make + make install + + Repeat step 2. for the "base" version as well. + + 3. Compile the code + ------------------------------------- + Return to this folder and make the binary + + make + + (set resolution in DPI by passing argument example: make DPI=100, if not specified,default is 72) -2) Usage ./sprite + 3. Run the executable + ------------------------------------- + + ./sprite + + is the libfreetype.so from the base vesion. + is the libfreetype.so from the test vesion. - ( is the libfreetype.so from the base vesion ) - ( is the libfreetype.so from the test vesion ) + ( and are in /lib/ ) + ( The path to these should be absolute. ) - The path to the "shared library" in usage should be absolute. + Open index.html for "list-view" +--------------------------------------------------------------------- - Sprite Sheets will be saved as sprite_$(glyph_index).png +FEATURES - Render modes similar to generating PNG(s). + Generates sprite sheets in the ./images folder. -NOTE: If the dimensions of the two glyphs to be compared are -different, comparison is done after aligning the glyphs. -This alignment will effect the 'Difference Metric' based on the -number of rows/columns added. + Generates "list-view" web-page i.e index.html + By clicking on the Headers of the respective columns,they can be + arranged (in increasing/decreasing order) based on + -> Glyph-Index + -> Name + -> Difference Metric diff --git a/tests/make_png/bitmap.c b/tests/make_png/bitmap.c index 6e1ff6df2..4ee3e564b 100644 --- a/tests/make_png/bitmap.c +++ b/tests/make_png/bitmap.c @@ -446,23 +446,15 @@ int Compare_Hash(HASH_128* hash_b, HASH_128* hash_t){ return 0; } -void Print_Row( FILE* fp, int index, char* name, int diff, - HASH_128* hash_b, HASH_128* hash_t){ +void Print_Row( FILE* fp, int index, char* name, int diff ) +{ fprintf(fp, "\n\ %04d\n\ %s\n\ %04d\n\ - %08x%08x%08x%08x
%08x%08x%08x%08x\n\ - \n\ - \n", index, name, diff,hash_b->hash[0], - hash_b->hash[1], - hash_b->hash[2], - hash_b->hash[3], - hash_t->hash[0], - hash_t->hash[1], - hash_t->hash[2], - hash_t->hash[3], index); + \n\ + \n", index, name, diff, index); } int First_Column(IMAGE* input){ diff --git a/tests/make_png/bitmap.h b/tests/make_png/bitmap.h index 51e05cdec..c7fb26b2c 100644 --- a/tests/make_png/bitmap.h +++ b/tests/make_png/bitmap.h @@ -80,8 +80,7 @@ int Add_effect(IMAGE* base, IMAGE* test, IMAGE* out, int Effect_ID); /* Stitch 2 PNG files */ void Stitch(IMAGE* left, IMAGE* right, IMAGE* result); /* Print the row in list-view webpage */ -void Print_Row( FILE* fp, int index, char* name, int diff, - HASH_128* hash_b, HASH_128* hash_t); +void Print_Row( FILE* fp, int index, char* name, int diff ); /* Finding the first non-empty (non-white) column */ int First_Column(IMAGE* input); /* Finding the first non-empty (non-white) row */ diff --git a/tests/make_png/make_sprite.c b/tests/make_png/make_sprite.c index ceb95b5ca..603aa2b54 100644 --- a/tests/make_png/make_sprite.c +++ b/tests/make_png/make_sprite.c @@ -338,9 +338,6 @@ int main(int argc, char const *argv[]) \n\
Difference\n\ \n\ - \n\ - 128-bit Hash-values\n\ - \n\ \n\ Images\n\ \n\ @@ -468,8 +465,7 @@ int main(int argc, char const *argv[]) 50 ); } - Print_Row(fp,i,glyph_name,pixel_diff, base_murmur, - test_murmur ); + Print_Row(fp,i,glyph_name,pixel_diff ); } } diff --git a/tests/make_png/runme.sh b/tests/make_png/runme.sh new file mode 100644 index 000000000..9761ad7a2 --- /dev/null +++ b/tests/make_png/runme.sh @@ -0,0 +1,30 @@ +TEST_DIR=$1 +BASE_DIR=$PWD + +cd $TEST_DIR/include/freetype/config/ +sed -i 's/\/\* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING \*\//#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING /g' ftoption.h + +cd $TEST_DIR +./autogen.sh +./configure --prefix=$BASE_DIR/test/ +make +make install + +cd $BASE_DIR/../.. +./autogen.sh +./configure --prefix=$BASE_DIR/base/ +make +make install + +cd $BASE_DIR +make + +BASE_LIB=./base/lib/libfreetype.so +TEST_LIB=./test/lib/libfreetype.so + +FONT_FILE=$2 +PT_SIZE=$3 +RENDER_MODE=$4 + +./sprite $BASE_LIB $TEST_LIB $FONT_FILE $PT_SIZE $RENDER_MODE + diff --git a/tests/make_png/test.ttf b/tests/make_png/test.ttf new file mode 100644 index 000000000..d03485f0c Binary files /dev/null and b/tests/make_png/test.ttf differ -- cgit v1.2.1