|
|
@@ -854,6 +854,7 @@ int fonsAddFont(FONScontext* stash, const char* name, const char* path) |
|
|
|
FILE* fp = 0; |
|
|
|
int dataSize = 0; |
|
|
|
unsigned char* data = NULL; |
|
|
|
size_t ignore; |
|
|
|
|
|
|
|
// Read in the font data. |
|
|
|
fp = fopen(path, "rb"); |
|
|
@@ -863,7 +864,7 @@ int fonsAddFont(FONScontext* stash, const char* name, const char* path) |
|
|
|
fseek(fp,0,SEEK_SET); |
|
|
|
data = (unsigned char*)malloc(dataSize); |
|
|
|
if (data == NULL) goto error; |
|
|
|
fread(data, 1, dataSize, fp); |
|
|
|
ignore = fread(data, 1, dataSize, fp); |
|
|
|
fclose(fp); |
|
|
|
fp = 0; |
|
|
|
|
|
|
@@ -873,6 +874,8 @@ error: |
|
|
|
if (data) free(data); |
|
|
|
if (fp) fclose(fp); |
|
|
|
return FONS_INVALID; |
|
|
|
|
|
|
|
FONS_NOTUSED(ignore); |
|
|
|
} |
|
|
|
|
|
|
|
int fonsAddFontMem(FONScontext* stash, const char* name, unsigned char* data, int dataSize, int freeData) |
|
|
|