/** * Returns 1 (true) if the font object passed as a parameter * exists and is added successfully to the manager loading the font directly from * a configuration file, generated with an editor that can export the XML AngelCode format * @param pNewFont Pointer to a font. * @param pFile Name of the configuration file of the font generated by an editor that exports the AngelCode XML format. * @param pType Font type (see ::IND_Type). * @param pQuality Font quality (see ::IND_Quality). */ bool IND_FontManager::addAngelcodeFont(IND_Font *pNewFont, const char *pFile, IND_Type pType, IND_Quality pQuality) { g_debug->header("Parsing and loading AngelCode font", DebugApi::LogHeaderBegin); g_debug->header("File name:", DebugApi::LogHeaderInfo); g_debug->dataChar(pFile, 1); if (!_ok) { writeMessage(); return 0; } if(!parseAngelCodeFont(pNewFont,pFile, pType, pQuality)) return 0; // ----- Puts the object into the manager ----- addToList(pNewFont); // ----- g_debug ----- g_debug->header("AngelCode font parsed and loaded", DebugApi::LogHeaderEnd); return 1; }
BMFont::BMFont(const char *file_name) { int n; //init for (int i = 0; i < 8; i++) { pages[i].id = i; strcpy(pages[i].file, ""); } for (int i = 0; i < BMFONT_CHAR_COUNT; i++) { chars[i].id = i; chars[i].x = 0; chars[i].y = 0; chars[i].width = 0; chars[i].height = 0; chars[i].xoffset = 0; chars[i].yoffset = 0; chars[i].xadvance = 0; chars[i].page = 0; chars[i].chnl = 0; memset(chars[i].kernings, 0, sizeof(int) * BMFONT_CHAR_COUNT); } //copy file name and replace slash strcpy(fontName, file_name); n = strlen(fontName); for (int i = 0; i < n; i++) { if (fontName[i] == '\\') fontName[i] = '/'; } //parse font parseAngelCodeFont(file_name); }