void KNFontManager::loadCustomFontFolder(const QString &folderPath) { QDir fontDir(folderPath); //Check the folder is exsist or not, if not exsist, create one. if(fontDir.exists()) { //Get all the files, load all the fonts. QFileInfoList fontFiles=fontDir.entryInfoList(); for(QFileInfoList::const_iterator i=fontFiles.constBegin(); i!=fontFiles.constEnd(); ++i) { //Ignore the dot(.) and dot-dot(..). if((*i).fileName()=="." || (*i).fileName()=="..") { continue; } //If the type of current file is File, then try to load the font. if((*i).isFile()) { loadCustomFont(*i); } } } else { fontDir.mkpath(folderPath); } }
void loadRequiredResources() { int code; /* Load the hud */ initHud(); /* Load the font */ if (strlen(game.customFont) == 0) { code = getCharacterCodeForTestString(); if (code >= 0x4E00) { #if DEV == 1 printf("Code %d appears to be CJK. Using fallback font\n", code); #endif game.font = loadFont("font/DroidSansFallback.ttf", NORMAL_FONT_SIZE); game.largeFont = loadFont("font/DroidSansFallback.ttf", LARGE_FONT_SIZE); } else { game.font = loadFont("font/DejaVuSans.ttf", NORMAL_FONT_SIZE); game.largeFont = loadFont("font/DejaVuSans.ttf", LARGE_FONT_SIZE); } } else { game.font = loadCustomFont(game.customFont, game.fontSizeSmall); game.largeFont = loadCustomFont(game.customFont, game.fontSizeLarge); } }