3
3
#include " encoding_tables.h"
4
4
#include < algorithm>
5
5
#include < time.h>
6
- #include < sys/dir.h>
7
- #include < sys/unistd.h>
8
6
#include < set>
9
7
10
8
#include < nds.h>
@@ -195,7 +193,7 @@ FT_Error ftcFaceRequester(FTC_FaceID faceID, FT_Library lib, FT_Pointer reqData,
195
193
else file = p + *st;
196
194
197
195
FT_Error ft_err = FT_New_Face (ft_lib, file.c_str (), 0 , aface);
198
- if (ft_err) bsod (" Can't load font." );
196
+ if (ft_err) bsod (" renderer.ftcFaceRequester: Can't load font." );
199
197
FT_Select_Charmap (face, FT_ENCODING_UNICODE);
200
198
return ft_err;
201
199
}
@@ -213,7 +211,7 @@ void initFonts()
213
211
FT_Library_SetLcdFilter (ft_lib, FT_LCD_FILTER_DEFAULT) ||
214
212
FTC_Manager_New (ft_lib, 3 , 0 , 0 , ftcFaceRequester, 0 , &ftcManager) ||
215
213
FTC_SBitCache_New (ftcManager, &ftcSBitCache)
216
- ) bsod (" Freetype error." );
214
+ ) bsod (" renderer.init_fonts: Freetype error." );
217
215
FTC_Manager_LookupFace (ftcManager, &settings::font, &face);
218
216
FTC_Manager_LookupFace (ftcManager, &settings::font_bold, &faceB);
219
217
FTC_Manager_LookupFace (ftcManager, &settings::font_italic, &faceI);
@@ -383,21 +381,20 @@ void printClock(scr_id scr, bool forced)
383
381
384
382
void changeFont ()
385
383
{
386
- char fname[MAXNAMLEN];
387
384
DIR* dir = opendir (" /data/ikureader/fonts/" );
388
- if (dir == NULL ) bsod (" Cannot open fonts directory." );
385
+ if (dir == NULL ) bsod (" renderer.change_font: Cannot open fonts directory." );
389
386
struct dirent * ent;
390
387
std::set<string> files;
391
388
while ((ent = readdir (dir)) != NULL )
392
- if (ent->d_type != DT_DIR) if (extention (fname ) == " ttf" ) files.insert (noExt (fname ));
389
+ if (ent->d_type != DT_DIR) if (extention (ent-> d_name ) == " ttf" ) files.insert (noExt (ent-> d_name ));
393
390
closedir (dir);
394
391
std::set<string> fonts;
395
392
396
393
for (std::set<string>::iterator it = files.begin (); it != files.end (); ++it)
397
394
if (files.find (*it + ' b' ) != files.end () && files.find (*it + ' i' ) != files.end ())
398
395
fonts.insert (*it);
399
396
400
- if (fonts.empty ()) bsod (" No fonts found." );
397
+ if (fonts.empty ()) bsod (" renderer.change_font: No fonts found." );
401
398
402
399
std::set<string>::iterator current = ++fonts.find (noExt (settings::font));
403
400
if (current == fonts.end ()) current = fonts.begin ();
@@ -408,6 +405,7 @@ void changeFont()
408
405
FTC_Manager_Done (ftcManager);
409
406
FT_Done_FreeType (ft_lib);
410
407
initFonts ();
408
+ save ();
411
409
}
412
410
413
411
void TFlashClock :: show(scr_id scr)
0 commit comments