* Exposing load_user_fonts() and some other font.c functions,

even when FORKED_FONTS is not set.
* No longer undef'ing SDL_thread stuff when FORKED_FONTS is
  used if we're ALSO not using SDL_Pango, since that now
  uses a thread to let fontconfig generate its cache, and
  still let Tux Paint be responsive to the OS and user.
  (SF.net bug #2944951)
* Spawning a thread and rendering a dummy string with SDL_Pango,
  to allow fontconfig to generate its cache.
  (SF.net bug #2944951)
* Setting up 'busy' mouse cursor (watch-shaped) earlier
  (so it can happen while fontconfig cache thread runs).
* Not spawning forked font scanner (FORKED_FONTS) as early, so
  fontconfig can generate its cache first.
  (I wasn't sure if calling an SDL_thread after a fork()
  occured was safe or not; admittedly, I discovered that
  SDL_thread spawning wasn't working due to the re-#defines
  of those functions when FORKED_FONTS was set; see above.)

All of this only tested on Ubuntu 9.04.  Forced disabling of FORKED_FONTS
by editing fonts.h, and Tux Paint still worked (it just took longer at
the splash screen while the fonts were loaded).  Needs testing on various
Windows, Mac OS X and BeOS.
This commit is contained in:
William Kendrick 2010-04-27 22:04:43 +00:00
parent 0c63f14092
commit be2b5537b3
5 changed files with 196 additions and 66 deletions

View file

@ -56,6 +56,9 @@
* Move into 'fonts.c' and the code in 'tuxpaint.c'
* that uses this lot should be put into 'fonts.c' as well.
*/
#ifdef NO_SDLPANGO
/* Only kill SDL_thread stuff when we're not using Pango, because we need it to let fontconfig make its cache (takes a long time the first time) -bjk 2010.04.27 */
#define SDL_CreateThread(fn,vp) (void*)(long)(fn(vp))
#define SDL_WaitThread(tid,rcp) do{(void)tid;(void)rcp;}while(0)
#define SDL_Thread int
@ -66,6 +69,8 @@
#define SDL_mutexV(lock) // release lock
#endif
#endif
extern SDL_Thread *font_thread;
extern volatile long font_thread_done;
@ -188,4 +193,6 @@ TuxPaint_Font *load_locale_font(TuxPaint_Font * fallback, int size);
void sdl_color_to_pango_color(SDL_Color sdl_color, SDLPango_Matrix *pango_color);
#endif
int load_user_fonts(SDL_Surface * screen, void *vp, const char *restrict const locale);
#endif