From 7b9c8e88bacedcb968e90cde0d9412cd379cdb98 Mon Sep 17 00:00:00 2001 From: Kushal K S V S Date: Thu, 22 Mar 2018 16:25:26 +0530 Subject: [PATCH] Adding functions to differentiate Font Type --- .DS_Store | Bin 10244 -> 10244 bytes tests/bitmap.c | 41 ++++++++++++++++++++++++++++++++++++++--- tests/bitmap.h | 4 ++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/.DS_Store b/.DS_Store index 4fcda8343690cc9b52c48e9003a0c2238c9bbb48..4b65ed6a26b05037b686b8e07af639b487466012 100644 GIT binary patch delta 142 zcmZn(XbIS0D8{&XvXPh?tEhyKl=S9UF$u=Wb>iNt9*mxhK@4EP#0a4oWS}&ZVvOGW XL0p_;VgvVPb_Fdq3e1`OL0ldHytWl0 delta 179 zcmZn(XbIS0D8{&NvXPh?tAwPGw9MvMF$qRaWrs=y1`wEBD(UhZ+Lsy> diff --git a/tests/bitmap.c b/tests/bitmap.c index 98917527e..77a50a461 100644 --- a/tests/bitmap.c +++ b/tests/bitmap.c @@ -659,8 +659,8 @@ void Print_Head( FILE* fp ){ \n\ Glyph_Diff\n\ \n\ - \n\ - \n\ + \n\ + \n\ \n\ \n\ \n\ @@ -703,7 +703,7 @@ void Print_Row( FILE* fp, int index, char* name, int diff ) } /* To calculate the Difference-Metric used in the list-view page */ -int Image_Diff( IMAGE* base, IMAGE* test){ +int Image_Diff(IMAGE* base, IMAGE* test){ int diff = 0; @@ -718,4 +718,39 @@ int Image_Diff( IMAGE* base, IMAGE* test){ return diff; } + +/* This function takes font file name and returns the font name */ +/* Returns a string */ +char* Get_Font_File_Name(const char* font_file_full_name){ + int file_name_length = strlen(font_file_full_name); + char* name = (char*)malloc(file_name_length*sizeof(char)); + + int count = 0; + while(font_file_full_name[count] != '.'){ + name[count] = font_file_full_name[count]; + count++; + } + name[count] = '\0'; /* Ending the String */ + + return name; +} + +/* This function takes font file name and returns the file extension*/ +/* Returns a string */ +char* Get_Font_File_Type(const char* font_file_full_name){ + int file_name_length = strlen(font_file_full_name); + char* extension = (char*)malloc(file_name_length*sizeof(char)); + + int count = 0; + while(font_file_full_name[count++] != '.'){} + + int i = 0; + while(count < file_name_length){ + extension[i++] = font_file_full_name[count++]; + } + extension[i] = '\0'; /* Ending the String */ + + return extension; +} + /* For more information on the list-view page, go to README */ diff --git a/tests/bitmap.h b/tests/bitmap.h index ed3e0f1c0..457da7e4c 100644 --- a/tests/bitmap.h +++ b/tests/bitmap.h @@ -88,3 +88,7 @@ int Image_Diff( IMAGE* base, IMAGE* test); void Print_Row( FILE* fp, int index, char* name, int diff ); /* Print the table-headers in list-view webpage */ void Print_Head( FILE* fp ); +/* Returns the name of the font file without the extension */ +char* Get_Font_File_Name(const char* font_file_full_name); +/* Returns the file extension of the font file */ +char* Get_Font_File_Type(const char* font_file_full_name);