MCPcopy Create free account
hub / github.com/dborth/fceugx / LoadFont

Function LoadFont

source/fileop.cpp:942–975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

940
941#ifdef HW_RVL
942size_t LoadFont(char * filepath)
943{
944 FILE *file = fopen (filepath, "rb");
945
946 if(!file) {
947 ErrorPrompt("Font file not found!");
948 return 0;
949 }
950
951 fseeko(file,0,SEEK_END);
952 size_t loadSize = ftello(file);
953
954 if(loadSize == 0) {
955 ErrorPrompt("Error loading font!");
956 return 0;
957 }
958
959 if(ext_font_ttf) {
960 mem2_free(ext_font_ttf);
961 }
962
963 ext_font_ttf = (u8 *)mem2_malloc(loadSize);
964
965 if(!ext_font_ttf) {
966 ErrorPrompt("Font file is too large!");
967 fclose(file);
968 return 0;
969 }
970
971 fseeko(file,0,SEEK_SET);
972 fread (ext_font_ttf, 1, loadSize, file);
973 fclose(file);
974 return loadSize;
975}
976
977void LoadBgMusic()
978{

Callers 1

ChangeLanguageFunction · 0.85

Calls 3

ErrorPromptFunction · 0.85
mem2_freeFunction · 0.85
mem2_mallocFunction · 0.85

Tested by

no test coverage detected