script to compile and run

This commit is contained in:
Kushal K S V S 2017-08-03 10:36:08 -07:00
parent d66639a95c
commit 40c3ab9041
8 changed files with 92 additions and 52 deletions

View File

@ -118,7 +118,7 @@ FT_BEGIN_HEADER
/* rendering technology that produces excellent output without LCD */
/* filtering. */
/* */
/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
/*************************************************************************/

View File

@ -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:

View File

@ -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
-------------------------------------
(<a> is the libfreetype.so from the base vesion )
(<b> is the libfreetype.so from the test vesion )
./sprite <a> <b> <font_file> <pt_size> <render_mode>
The path to the "shared library" in usage should be absolute.
<a> is the libfreetype.so from the base vesion.
<b> is the libfreetype.so from the test vesion.
Sprite Sheets will be saved as sprite_$(glyph_index).png
( <a> and <b> are in <base/test version's installation folder>/lib/ )
( The path to these should be absolute. )
Render modes similar to generating PNG(s).
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.
Open index.html for "list-view"
---------------------------------------------------------------------
FEATURES
Generates sprite sheets in the ./images folder.
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

View File

@ -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){

View File

@ -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 */

View File

@ -338,9 +338,6 @@ int main(int argc, char const *argv[])
<th onclick=\"sort_t(data,2,asc3);asc3*=-1;asc1=1;asc2=1;\">\n\
<a href=\"#\">Difference</a>\n\
</th>\n\
<th>\n\
128-bit Hash-values\n\
</th>\n\
<th>\n\
Images\n\
</th>\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 );
}
}

30
tests/make_png/runme.sh Normal file
View File

@ -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

BIN
tests/make_png/test.ttf Normal file

Binary file not shown.