indent fonts.c fonts.h
This commit is contained in:
parent
b37621c2f0
commit
81ff48ccbc
2 changed files with 804 additions and 782 deletions
24
src/fonts.c
24
src/fonts.c
|
|
@ -189,6 +189,7 @@ TuxPaint_Font *load_locale_font(TuxPaint_Font * fallback, int size)
|
|||
else
|
||||
{
|
||||
char str[128];
|
||||
|
||||
snprintf(str, sizeof(str), "%sfonts/locale/%s.ttf", DATA_PREFIX, lang_prefix);
|
||||
|
||||
ret = TuxPaint_Font_OpenFont("", str, size);
|
||||
|
|
@ -238,7 +239,8 @@ void TuxPaint_Font_CloseFont(TuxPaint_Font * tpf)
|
|||
#ifdef DEBUG
|
||||
printf("TuxPaint_Font_CloseFont step 1 (%p)\n", tpf); //EP
|
||||
#endif
|
||||
if (!tpf) return; //EP
|
||||
if (!tpf)
|
||||
return; //EP
|
||||
|
||||
#ifndef NO_SDLPANGO
|
||||
#ifdef DEBUG
|
||||
|
|
@ -265,7 +267,8 @@ void TuxPaint_Font_CloseFont(TuxPaint_Font * tpf)
|
|||
tpf->ttf_font = NULL;
|
||||
}
|
||||
|
||||
if (tpf->desc != NULL) {
|
||||
if (tpf->desc != NULL)
|
||||
{
|
||||
free(tpf->desc);
|
||||
tpf->desc = NULL;
|
||||
}
|
||||
|
|
@ -277,6 +280,7 @@ TuxPaint_Font *TuxPaint_Font_OpenFont(const char *pangodesc, const char *ttffile
|
|||
{
|
||||
TuxPaint_Font *tpf = NULL;
|
||||
int i;
|
||||
|
||||
#ifndef NO_SDLPANGO
|
||||
char desc[1024];
|
||||
#endif
|
||||
|
|
@ -381,9 +385,11 @@ TuxPaint_Font *TuxPaint_Font_OpenFont(const char *pangodesc, const char *ttffile
|
|||
void reliable_write(int fd, const void *buf, size_t count)
|
||||
{
|
||||
struct pollfd p;
|
||||
|
||||
do
|
||||
{
|
||||
ssize_t rc = write(fd, buf, count);
|
||||
|
||||
if (rc == -1)
|
||||
{
|
||||
switch (errno)
|
||||
|
|
@ -412,9 +418,11 @@ void reliable_write(int fd, const void *buf, size_t count)
|
|||
static void reliable_read(int fd, void *buf, size_t count)
|
||||
{
|
||||
struct pollfd p;
|
||||
|
||||
do
|
||||
{
|
||||
ssize_t rc = read(fd, buf, count);
|
||||
|
||||
if (rc == -1)
|
||||
{
|
||||
switch (errno)
|
||||
|
|
@ -570,6 +578,7 @@ static void groupfonts_range(style_info ** base, int count)
|
|||
while (i--)
|
||||
{
|
||||
int b = boldmap[base[i]->boldness];
|
||||
|
||||
if (b == -1)
|
||||
{
|
||||
#if 0
|
||||
|
|
@ -717,6 +726,7 @@ static void parse_font_style(style_info * si)
|
|||
{
|
||||
size_t len = strlen(si->family);
|
||||
char *name = malloc(len + strlen(" Condensed") + 1);
|
||||
|
||||
sp += strlen("Condensed");
|
||||
memcpy(name, si->family, len);
|
||||
strcpy(name + len, " Condensed");
|
||||
|
|
@ -818,9 +828,11 @@ static void dupe_markdown_range(family_info ** base, int count)
|
|||
int bestscore = -999;
|
||||
int bestslot = 0;
|
||||
int i = count;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
int score = base[i]->score;
|
||||
|
||||
if (score <= bestscore)
|
||||
continue;
|
||||
bestscore = score;
|
||||
|
|
@ -852,6 +864,7 @@ static void groupfonts(void)
|
|||
for (;;)
|
||||
{
|
||||
int high = low;
|
||||
|
||||
if (low >= num_font_styles)
|
||||
break;
|
||||
for (;;)
|
||||
|
|
@ -882,6 +895,7 @@ static void groupfonts(void)
|
|||
for (;;)
|
||||
{
|
||||
int high = low;
|
||||
|
||||
if (low >= num_font_families)
|
||||
break;
|
||||
for (;;)
|
||||
|
|
@ -964,6 +978,7 @@ static void loadfonts(SDL_Surface * screen, const char *const dir)
|
|||
dev_t volume = dev_for_path("/boot");
|
||||
char buffer[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
||||
status_t result;
|
||||
|
||||
result = find_directory(B_SYSTEM_FONTS_DIRECTORY, volume, false, buffer, sizeof(buffer));
|
||||
loadfonts(screen, buffer);
|
||||
result = find_directory(B_COMMON_FONTS_DIRECTORY, volume, false, buffer, sizeof(buffer));
|
||||
|
|
@ -1051,6 +1066,7 @@ void run_font_scanner(SDL_Surface * screen, const char *restrict const locale)
|
|||
while (i--)
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = user_font_families[i]->directory;
|
||||
if (s)
|
||||
size += strlen(s);
|
||||
|
|
@ -1222,6 +1238,7 @@ void receive_some_font_info(SDL_Surface * screen)
|
|||
while (i--)
|
||||
{
|
||||
unsigned len;
|
||||
|
||||
user_font_families[i] = fip + i;
|
||||
|
||||
len = strlen(walk);
|
||||
|
|
@ -1453,6 +1470,7 @@ static int do_surfcmp(const SDL_Surface * const *const v1, const SDL_Surface * c
|
|||
{
|
||||
const char *const c1 = (char *const)s1->pixels;
|
||||
const char *const c2 = (char *const)s2->pixels;
|
||||
|
||||
width = s1->format->BytesPerPixel * s1->w;
|
||||
if (width == s1->pitch)
|
||||
return memcmp(c1, c2, width * s1->h);
|
||||
|
|
@ -1473,6 +1491,7 @@ static int do_surfcmp(const SDL_Surface * const *const v1, const SDL_Surface * c
|
|||
static int surfcmp(const void *s1, const void *s2)
|
||||
{
|
||||
int diff = do_surfcmp(s1, s2);
|
||||
|
||||
if (!diff)
|
||||
was_bad_font = 1;
|
||||
return diff;
|
||||
|
|
@ -1488,6 +1507,7 @@ int charset_works(TuxPaint_Font * font, const char *s)
|
|||
SDL_Surface **surfs = malloc(strlen(s) * sizeof surfs[0]);
|
||||
unsigned count = 0;
|
||||
int ret = 0;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
char c[8];
|
||||
|
|
|
|||
|
|
@ -91,14 +91,16 @@ TTF_Font *BUGFIX_TTF_OpenFont206(const char *const file, int ptsize);
|
|||
|
||||
/* Stuff that wraps either SDL_Pango or SDL_TTF for font rendering: */
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
#ifndef NO_SDLPANGO
|
||||
FONT_TYPE_PANGO,
|
||||
#endif
|
||||
FONT_TYPE_TTF
|
||||
};
|
||||
|
||||
typedef struct TuxPaint_Font_s {
|
||||
typedef struct TuxPaint_Font_s
|
||||
{
|
||||
#ifndef NO_SDLPANGO
|
||||
SDLPango_Context *pango_context;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue