moving more code past start of font scanning
This commit is contained in:
parent
c6d3259e2c
commit
9a00845f50
4 changed files with 44 additions and 22 deletions
10
src/fonts.c
10
src/fonts.c
|
|
@ -140,7 +140,7 @@ int text_state = 0;
|
|||
unsigned text_size = 4; // initial text size
|
||||
|
||||
|
||||
void loadfonts_locale_filter(SDL_Surface * screen, const char *const dir, char * locale);
|
||||
static void loadfonts_locale_filter(SDL_Surface * screen, const char *const dir, const char *restrict locale);
|
||||
|
||||
|
||||
/* Unfortunately, there is a bug in SDL_ttf-2.0.6, the current version
|
||||
|
|
@ -440,7 +440,7 @@ void reliable_read(int fd, void *buf, size_t count)
|
|||
}
|
||||
|
||||
|
||||
void run_font_scanner(SDL_Surface * screen, char * locale)
|
||||
void run_font_scanner(SDL_Surface * screen, const char *restrict locale)
|
||||
{
|
||||
int sv[2];
|
||||
int size, i;
|
||||
|
|
@ -459,6 +459,8 @@ void run_font_scanner(SDL_Surface * screen, char * locale)
|
|||
nice(42); // be nice, letting the main thread get the CPU
|
||||
sched_yield(); // try to let the parent run right now
|
||||
prctl(PR_SET_PDEATHSIG, 9); // get killed if parent exits
|
||||
if(getppid()==1)
|
||||
_exit(99); // parent is already init, and won't be dying :-)
|
||||
font_socket_fd = sv[1];
|
||||
close(sv[0]);
|
||||
progress_bar_disabled = 1;
|
||||
|
|
@ -681,7 +683,7 @@ void receive_some_font_info(SDL_Surface * screen)
|
|||
#endif
|
||||
|
||||
|
||||
int load_user_fonts(SDL_Surface * screen, void *vp, char * locale)
|
||||
int load_user_fonts(SDL_Surface * screen, void *vp, const char *restrict locale)
|
||||
{
|
||||
char *homedirdir;
|
||||
|
||||
|
|
@ -1393,7 +1395,7 @@ void loadfonts(SDL_Surface * screen, const char *const dir)
|
|||
loadfonts_locale_filter(screen, dir, NULL);
|
||||
}
|
||||
|
||||
void loadfonts_locale_filter(SDL_Surface * screen, const char *const dir, char * locale)
|
||||
void loadfonts_locale_filter(SDL_Surface * screen, const char *const dir, const char *restrict locale)
|
||||
{
|
||||
char buf[TP_FTW_PATHSIZE];
|
||||
unsigned dirlen = strlen(dir);
|
||||
|
|
|
|||
|
|
@ -108,12 +108,12 @@ int TuxPaint_Font_FontHeight(TuxPaint_Font * tpf);
|
|||
|
||||
TuxPaint_Font *try_alternate_font(int size);
|
||||
TuxPaint_Font *load_locale_font(TuxPaint_Font * fallback, int size);
|
||||
int load_user_fonts(SDL_Surface * screen, void *vp, char * locale);
|
||||
int load_user_fonts(SDL_Surface * screen, void *vp, const char *restrict locale);
|
||||
|
||||
#ifdef FORKED_FONTS
|
||||
void reliable_write(int fd, const void *buf, size_t count);
|
||||
void reliable_read(int fd, void *buf, size_t count);
|
||||
void run_font_scanner(SDL_Surface * screen, char * locale);
|
||||
void run_font_scanner(SDL_Surface * screen, const char *restrict locale);
|
||||
void receive_some_font_info(SDL_Surface * screen);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
%{
|
||||
|
||||
#include "parse.h"
|
||||
#include "../src/parse.h"
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -37,24 +37,53 @@ struct cfg
|
|||
|
||||
static void imm_version(void)
|
||||
{
|
||||
// show_version(0);
|
||||
}
|
||||
|
||||
static void imm_verbose_version(void)
|
||||
{
|
||||
// show_version(1);
|
||||
}
|
||||
|
||||
static void imm_usage(void)
|
||||
{
|
||||
// show_usage(stdout,"tuxpaint");
|
||||
}
|
||||
|
||||
static void imm_help(void)
|
||||
{
|
||||
// show_version(0);
|
||||
// show_usage(stdout,"tuxpaint");
|
||||
}
|
||||
|
||||
static void imm_copying(void)
|
||||
{
|
||||
// show_version(0);
|
||||
printf("\n"
|
||||
"This program is free software; you can redistribute it\n"
|
||||
"and/or modify it under the terms of the GNU General Public\n"
|
||||
"License as published by the Free Software Foundation;\n"
|
||||
"either version 2 of the License, or (at your option) any\n"
|
||||
"later version.\n"
|
||||
"\n"
|
||||
"This program is distributed in the hope that it will be\n"
|
||||
"useful and entertaining, but WITHOUT ANY WARRANTY; without\n"
|
||||
"even the implied warranty of MERCHANTABILITY or FITNESS\n"
|
||||
"FOR A PARTICULAR PURPOSE. See the GNU General Public\n"
|
||||
"License for more details.\n"
|
||||
"\n"
|
||||
"You should have received a copy of the GNU General Public\n"
|
||||
"License along with this program; if not, write to the Free\n"
|
||||
"Software Foundation, Inc., 59 Temple Place, Suite 330,\n"
|
||||
"Boston, MA 02111-1307 USA\n" "\n");
|
||||
}
|
||||
|
||||
// We get this from gperf:
|
||||
//__inline static unsigned int hash (register const char *str, register unsigned int len)
|
||||
//__inline __attribute__((__gnu_inline__)) const struct cfg *in_word_set (register const char *str, register unsigned int len);
|
||||
//
|
||||
// We use sed (see Makefile) to make those functions static.
|
||||
|
||||
%}
|
||||
|
||||
struct cfg
|
||||
|
|
|
|||
|
|
@ -19184,6 +19184,12 @@ static void setup(char *argv[])
|
|||
|
||||
|
||||
|
||||
setup_language(getfilename(argv[0]), &button_label_y_nudge);
|
||||
/* printf("cur locale = %d (%s)\n", get_current_language(), lang_prefixes[get_current_language()]); */
|
||||
|
||||
#ifdef FORKED_FONTS
|
||||
run_font_scanner(screen, lang_prefixes[get_current_language()]);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
@ -19194,27 +19200,12 @@ static void setup(char *argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
setup_language(getfilename(argv[0]), &button_label_y_nudge);
|
||||
/* printf("cur locale = %d (%s)\n", get_current_language(), lang_prefixes[get_current_language()]); */
|
||||
|
||||
im_init(&im_data, get_current_language());
|
||||
|
||||
#ifndef NO_SDLPANGO
|
||||
SDLPango_Init();
|
||||
#endif
|
||||
|
||||
|
||||
/* NOTE: Moved run_font_scanner() call from main(), to here,
|
||||
so that the gettext() calls used while testing fonts
|
||||
actually DO something (per tuxpaint-devel discussion, April 2007)
|
||||
-bjk 2007.06.05 */
|
||||
|
||||
#ifdef FORKED_FONTS
|
||||
run_font_scanner(screen, lang_prefixes[get_current_language()]);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
putenv((char *) "SDL_VIDEO_X11_WMCLASS=TuxPaint.TuxPaint");
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue