summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKushal K S V S <kkushal32@gmail.com>2017-08-03 10:36:08 -0700
committerKushal K S V S <kkushal32@gmail.com>2017-08-03 10:36:08 -0700
commit59bafd90482dd258dd02d032fbaa99b1c259f3b5 (patch)
tree43c3687791461f3a0965dc6683ea7c7cef21d78c
parent871c8d985fc2b6b315aa1a32e5ce3684c2a6ed7a (diff)
downloadfreetype2-59bafd90482dd258dd02d032fbaa99b1c259f3b5.tar.gz
script to compile and run
-rw-r--r--include/freetype/config/ftoption.h2
-rw-r--r--tests/make_png/Makefile5
-rw-r--r--tests/make_png/README80
-rw-r--r--tests/make_png/bitmap.c16
-rw-r--r--tests/make_png/bitmap.h3
-rw-r--r--tests/make_png/make_sprite.c6
-rw-r--r--tests/make_png/runme.sh30
-rw-r--r--tests/make_png/test.ttfbin0 -> 27296 bytes
8 files changed, 91 insertions, 51 deletions
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=<path>
+
+ 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 <a> <b> <font_file> <pt_size> <render_mode>
+ 3. Run the executable
+ -------------------------------------
+
+ ./sprite <a> <b> <font_file> <pt_size> <render_mode>
+
+ <a> is the libfreetype.so from the base vesion.
+ <b> is the libfreetype.so from the test vesion.
- (<a> is the libfreetype.so from the base vesion )
- (<b> is the libfreetype.so from the test vesion )
+ ( <a> and <b> are in <base/test version's installation folder>/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,
"<tr>\n\
<td>%04d</td>\n\
<td>%s</td>\n\
<td>%04d</td>\n\
- <td id=\"hash\">%08x%08x%08x%08x<br>%08x%08x%08x%08x</td>\n\
- <td><img id=\"sprite\" src=\"images/sprite_%04d.png\"></td>\n\
- </tr>\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);
+ <td id=\"image_row\"><img id=\"sprite\" src=\"images/sprite_%04d.png\"></td>\n\
+ </tr>\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
@@ -339,9 +339,6 @@ int main(int argc, char const *argv[])
<a href=\"#\">Difference</a>\n\
</th>\n\
<th>\n\
- 128-bit Hash-values\n\
- </th>\n\
- <th>\n\
Images\n\
</th>\n\
</tr>\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
--- /dev/null
+++ b/tests/make_png/test.ttf
Binary files differ