Script change and Render Mode calling
This commit is contained in:
parent
e7edf130be
commit
a2f066f7a5
|
@ -5,8 +5,6 @@ include $(TOP_DIR)/builds/unix/unix-def.mk
|
|||
|
||||
SRC_SPRITE = make_sprite.c bitmap.c murmur3.c
|
||||
|
||||
OBJS = $(src:.c=.o)
|
||||
|
||||
CFLAGS = -Wall -g
|
||||
CC = gcc
|
||||
INCLUDE = -I $(includedir)/freetype2
|
||||
|
@ -15,7 +13,7 @@ LIBS = -lpng -lharfbuzz -lbz2 -ldl
|
|||
all: tests
|
||||
|
||||
tests: $(SRC_SPRITE)
|
||||
$(CC) $(CFLAGS) $(INCLUDE) -o $@ $(SRC_SPRITE) $(SRC_LIB) $(OBJS) $(LIBS)
|
||||
$(CC) $(CFLAGS) $(INCLUDE) -o $@ $^ $(LIBS)
|
||||
|
||||
.PHONY: clean force
|
||||
clean:
|
||||
|
|
|
@ -42,6 +42,34 @@ HASH_32 * Generate_Hash_x86_32( FT_Bitmap * bitmap,
|
|||
return murmur;
|
||||
}
|
||||
|
||||
/* This function takes the render mode argument and */
|
||||
/* returns the corresponding render_mode */
|
||||
int Get_Render_Mode(const char* mode){
|
||||
/* Using -1 as the error code */
|
||||
int render_mode = -1;
|
||||
|
||||
if ( strcmp(mode,"MONO") == 0 )
|
||||
{
|
||||
render_mode = 0;
|
||||
}else if ( strcmp(mode,"AA") == 0 )
|
||||
{
|
||||
render_mode = 1;
|
||||
}else if ( strcmp(mode,"RGB") == 0 )
|
||||
{
|
||||
render_mode = 2;
|
||||
}else if ( strcmp(mode,"BGR") == 0 )
|
||||
{
|
||||
render_mode = 3;
|
||||
}else if ( strcmp(mode,"VRGB") == 0 )
|
||||
{
|
||||
render_mode = 4;
|
||||
}else if ( strcmp(mode,"VBGR") == 0 )
|
||||
{
|
||||
render_mode = 5;
|
||||
}
|
||||
return render_mode;
|
||||
}
|
||||
|
||||
/* This function takes in the IMAGE data and returns the pointer */
|
||||
/* to the pixel at co-ordinates (x,y). This is used to access the */
|
||||
/* pixel data */
|
||||
|
@ -623,7 +651,7 @@ void Stitch(IMAGE* left, IMAGE* right, IMAGE* result){
|
|||
}
|
||||
|
||||
/* This prints table-headers to a HTML file for the list-view page */
|
||||
void Print_Head( FILE* fp, char* fam, char* style, int size, int dpi){
|
||||
void Print_Head( FILE* fp ){
|
||||
printf(" *** Generating Images *** \n");
|
||||
fprintf(fp,
|
||||
"<html>\n\
|
||||
|
|
|
@ -59,7 +59,8 @@ HASH_128* Generate_Hash_x64_128(FT_Bitmap* bitmap, HASH_128* murmur);
|
|||
int Compare_Hash(HASH_128* hash_b, HASH_128* hash_t);
|
||||
|
||||
/*-----------------------------------------------------------------*/
|
||||
|
||||
/* Returns the render_mode */
|
||||
int Get_Render_Mode(const char* mode);
|
||||
/* Returns a pointer to pixel */
|
||||
/* at (x,y) co-ordinate */
|
||||
PIXEL* Pixel_At (IMAGE * bitmap, int x, int y);
|
||||
|
@ -86,4 +87,4 @@ int Image_Diff( IMAGE* base, IMAGE* test);
|
|||
/* Print the row in list-view webpage */
|
||||
void Print_Row( FILE* fp, int index, char* name, int diff );
|
||||
/* Print the table-headers in list-view webpage */
|
||||
void Print_Head( FILE* fp, char* fam, char* style, int size, int dpi);
|
||||
void Print_Head( FILE* fp );
|
||||
|
|
|
@ -13,8 +13,8 @@ int main(int argc, char const *argv[])
|
|||
const char* base_version;
|
||||
const char* test_version;
|
||||
const char* font_file;
|
||||
int size;
|
||||
int render_mode;
|
||||
const char* mode;
|
||||
int pt_size;
|
||||
int dpi;
|
||||
|
||||
int load_flag; /* FT_LOAD_XXX */
|
||||
|
@ -25,8 +25,8 @@ int main(int argc, char const *argv[])
|
|||
test_version = argv[2];
|
||||
|
||||
font_file = argv[3];
|
||||
size = atoi(argv[4]);
|
||||
render_mode = atoi(argv[5]);
|
||||
pt_size = atoi(argv[4]);
|
||||
mode = argv[5];
|
||||
dpi = atoi(argv[6]);
|
||||
|
||||
FT_Library base_library;
|
||||
|
@ -43,7 +43,9 @@ int main(int argc, char const *argv[])
|
|||
|
||||
FT_Error error;
|
||||
|
||||
int alignment = 4;
|
||||
int render_mode;
|
||||
int alignment = 4;
|
||||
|
||||
int output_file_size = 100 + strlen(argv[3]);
|
||||
char * output_file_name = (char *)calloc( output_file_size,
|
||||
sizeof(char));
|
||||
|
@ -213,6 +215,12 @@ int main(int argc, char const *argv[])
|
|||
"FT_Done_FreeType");
|
||||
|
||||
/*******************************************************************/
|
||||
render_mode = Get_Render_Mode(mode);
|
||||
if (render_mode < 0)
|
||||
{
|
||||
printf("Enter valid Render Mode.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
switch ( render_mode ) {
|
||||
case 0: render_flag = FT_RENDER_MODE_MONO;
|
||||
|
@ -295,7 +303,7 @@ int main(int argc, char const *argv[])
|
|||
}
|
||||
|
||||
error = Base_Set_Char_Size( base_face,
|
||||
size * 64,
|
||||
pt_size * 64,
|
||||
0,
|
||||
dpi,
|
||||
0 );
|
||||
|
@ -304,7 +312,7 @@ int main(int argc, char const *argv[])
|
|||
exit(1);
|
||||
}
|
||||
error = Test_Set_Char_Size( test_face,
|
||||
size * 64,
|
||||
pt_size * 64,
|
||||
0,
|
||||
dpi,
|
||||
0 );
|
||||
|
@ -319,11 +327,11 @@ int main(int argc, char const *argv[])
|
|||
/* Initialising file pointer for the list-view*/
|
||||
if (snprintf( output_file_name,
|
||||
output_file_size,
|
||||
"./html/pages/%d/%s/%d/%d/index.html",
|
||||
"./html/pages/%d/%s/%s/%d/index.html",
|
||||
dpi,
|
||||
font_file,
|
||||
render_mode,
|
||||
size )
|
||||
mode,
|
||||
pt_size )
|
||||
> output_file_size )
|
||||
{
|
||||
printf("Buffer overflow. Increase output_file_size\n");
|
||||
|
@ -338,7 +346,7 @@ int main(int argc, char const *argv[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
Print_Head(fp,base_face->family_name,base_face->style_name,size,dpi);
|
||||
Print_Head( fp );
|
||||
|
||||
/* Need to write code to check the values in FT_Face and compare */
|
||||
for ( i = 0; i < base_face->num_glyphs; ++i)
|
||||
|
@ -461,11 +469,11 @@ int main(int argc, char const *argv[])
|
|||
|
||||
if (snprintf( output_file_name,
|
||||
output_file_size,
|
||||
"./html/pages/%d/%s/%d/%d/images/%s.png",
|
||||
"./html/pages/%d/%s/%s/%d/images/%s.png",
|
||||
dpi,
|
||||
font_file,
|
||||
render_mode,
|
||||
size,
|
||||
mode,
|
||||
pt_size,
|
||||
glyph_name )
|
||||
> output_file_size)
|
||||
{
|
||||
|
@ -478,7 +486,7 @@ int main(int argc, char const *argv[])
|
|||
Print_Row(fp,i,glyph_name,pixel_diff );
|
||||
}
|
||||
}
|
||||
printf("Total : %ld\nFaulty : %d\n",base_face->num_glyphs,
|
||||
printf("Total : %ld\nFaulty : %d\n\n",base_face->num_glyphs,
|
||||
total_count );
|
||||
/* HTML footer */
|
||||
fprintf(fp,
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
#! /bin/bash
|
||||
|
||||
rm -rf ./html/pages
|
||||
rm -f ./html/top.html
|
||||
#####################################################################
|
||||
FT_TEST_DPI=${FT_TEST_DPI:-72 96};
|
||||
FT_TEST_FONT_FILE=${FT_TEST_FONT_FILE:-test.ttf};
|
||||
FT_TEST_RENDER_MODE=${FT_TEST_RENDER_MODE:-AA RGB};
|
||||
FT_TEST_PT_SIZE=${FT_TEST_PT_SIZE:-16 20};
|
||||
FT_TEST_DPI=${FT_TEST_DPI:-72 96}
|
||||
FT_TEST_FONT_FILE=${FT_TEST_FONT_FILE:-test.ttf}
|
||||
FT_TEST_RENDER_MODE=${FT_TEST_RENDER_MODE:-AA RGB}
|
||||
FT_TEST_PT_SIZE=${FT_TEST_PT_SIZE:-16 20}
|
||||
|
||||
FT_TEST_BASE_DIR=${FT_TEST_BASE_DIR:-$HOME/base};
|
||||
FT_TEST_TEST_DIR=${FT_TEST_TEST_DIR:-../..};
|
||||
FT_TEST_BASE_DIR=${FT_TEST_BASE_DIR:-$HOME/base}
|
||||
FT_TEST_TEST_DIR=${FT_TEST_TEST_DIR:-../..}
|
||||
|
||||
FT_TEST_BASE_DLL=${FT_TEST_BASE_DLL:-$FT_TEST_BASE_DIR/objs/.libs/libfreetype.so};
|
||||
FT_TEST_TEST_DLL=$FT_TEST_TEST_DIR/objs/.libs/libfreetype.so
|
||||
#####################################################################
|
||||
declare -A arr
|
||||
arr["MONO"]=0
|
||||
arr+=(["AA"]=1 ["RGB"]=2 ["BGR"]=3 ["VRGB"]=4 ["VBGR"]=5)
|
||||
FT_TEST_BASE_DLL=${FT_TEST_BASE_DLL:-$FT_TEST_BASE_DIR/objs/.libs/libfreetype.so}
|
||||
FT_TEST_TEST_DLL=${FT_TEST_TEST_DLL:-$FT_TEST_TEST_DIR/objs/.libs/libfreetype.so}
|
||||
#####################################################################
|
||||
mkdir ./html/pages
|
||||
touch ./html/top.html;
|
||||
touch ./html/top.html
|
||||
#####################################################################
|
||||
echo '
|
||||
<!DOCTYPE html>
|
||||
|
@ -32,60 +30,56 @@ echo '
|
|||
<iframe id="frame_1" name="frame_1" src="" ></iframe>
|
||||
<iframe id="frame_2" name="frame_2" src="diff.html" ></iframe>
|
||||
<div class="select">
|
||||
'>./html/top.html;
|
||||
'>./html/top.html
|
||||
#####################################################################
|
||||
for i in $FT_TEST_DPI; do
|
||||
mkdir ./html/pages/$i
|
||||
for j in $FT_TEST_FONT_FILE; do
|
||||
mkdir ./html/pages/$i/$j
|
||||
for k in $FT_TEST_RENDER_MODE; do
|
||||
mkdir ./html/pages/$i/$j/${arr[$k]}
|
||||
mkdir ./html/pages/$i/$j/$k
|
||||
for l in $FT_TEST_PT_SIZE; do
|
||||
mkdir ./html/pages/$i/$j/${arr[$k]}/$l
|
||||
mkdir ./html/pages/$i/$j/${arr[$k]}/$l/images
|
||||
./tests $FT_TEST_BASE_DLL $FT_TEST_TEST_DLL $j $l ${arr[$k]} $i
|
||||
mkdir ./html/pages/$i/$j/$k/$l
|
||||
mkdir ./html/pages/$i/$j/$k/$l/images
|
||||
./tests $FT_TEST_BASE_DLL $FT_TEST_TEST_DLL $j $l $k $i
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
#####################################################################
|
||||
echo '<label>DPI        :<select name="dpi" id="dpi" onchange="change()">'>>./html/top.html;
|
||||
echo '<label>DPI        :<select name="dpi" id="dpi" onchange="change()">'>>./html/top.html
|
||||
for i in $FT_TEST_DPI; do
|
||||
echo " <option value= $i > $i </option>">>./html/top.html;
|
||||
echo " <option value= $i > $i </option>">>./html/top.html
|
||||
done
|
||||
echo '</select>
|
||||
</label><br>'>>./html/top.html;
|
||||
</label><br>'>>./html/top.html
|
||||
#####################################################################
|
||||
echo '<label>Font       :<select name="font" id="font" onchange="change()">'>>./html/top.html;
|
||||
echo '<label>Font       :<select name="font" id="font" onchange="change()">'>>./html/top.html
|
||||
for i in $FT_TEST_FONT_FILE; do
|
||||
echo " <option value= $i > $i </option>">>./html/top.html;
|
||||
echo " <option value= $i > $i </option>">>./html/top.html
|
||||
done
|
||||
echo '</select>
|
||||
</label><br>'>>./html/top.html;
|
||||
</label><br>'>>./html/top.html
|
||||
#####################################################################
|
||||
echo '<label>Render Mode:<select name="mode" id="mode" onchange="change()">'>>./html/top.html;
|
||||
echo '<label>Render Mode:<select name="mode" id="mode" onchange="change()">'>>./html/top.html
|
||||
for i in $FT_TEST_RENDER_MODE; do
|
||||
echo " <option value= ${arr[$i]} > $i </option>">>./html/top.html;
|
||||
echo " <option value= $i > $i </option>">>./html/top.html
|
||||
done
|
||||
echo '</select>
|
||||
</label><br>'>>./html/top.html;
|
||||
</label><br>'>>./html/top.html
|
||||
#####################################################################
|
||||
echo '<label>Size       :<select name="size" id="size" onchange="change()">'>>./html/top.html;
|
||||
echo '<label>Size       :<select name="size" id="size" onchange="change()">'>>./html/top.html
|
||||
for i in $FT_TEST_PT_SIZE; do
|
||||
echo " <option value= $i > $i </option>">>./html/top.html;
|
||||
echo " <option value= $i > $i </option>">>./html/top.html
|
||||
done
|
||||
echo '</select>
|
||||
</label><br>'>>./html/top.html;
|
||||
</label><br>'>>./html/top.html
|
||||
#####################################################################
|
||||
echo '</div>
|
||||
</body>
|
||||
</html>'>>./html/top.html;
|
||||
</html>'>>./html/top.html
|
||||
#####################################################################
|
||||
echo "Font : " $FT_TEST_FONT_FILE
|
||||
echo "Size : " $FT_TEST_PT_SIZE
|
||||
echo "Point Size : " $FT_TEST_PT_SIZE
|
||||
echo "Render_Mode: " $FT_TEST_RENDER_MODE
|
||||
echo "DPI : " $FT_TEST_DPI
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue