# HG changeset patch # User Matti Hamalainen # Date 1349146285 -10800 # Node ID 7d201aed1fd9cf1f843bd416aa8bb1eb8cedf523 # Parent e6535609c161f040f3b941cc1dfb1d7328d14bc5 Cleanups, cosmetics. diff -r e6535609c161 -r 7d201aed1fd9 dmtext_bm.c --- a/dmtext_bm.c Tue Oct 02 05:51:08 2012 +0300 +++ b/dmtext_bm.c Tue Oct 02 05:51:25 2012 +0300 @@ -19,9 +19,9 @@ int pos; int ch = *ptr++; - if (ch == 'ยง') + if (ch == '_') { - xc += 15; + xc += 4; continue; } else @@ -105,7 +105,7 @@ int dmCreateBitmapFontFromImage(SDL_Surface *image, int width, int height, DMBitmapFont **pfont) { - int glyph, xc, yc, xglyphs, yglyphs; + int nglyph, xc, yc, xglyphs, yglyphs; DMBitmapFont *font; if (image->w < width || width < 4 || image->h < height || height < 4) @@ -120,23 +120,25 @@ font->width = width; font->height = height; +/* fprintf(stderr, "%d x %d split as %d x %d blocks => %d x %d = %d glyphs\n", image->w, image->h, width, height, xglyphs, yglyphs, xglyphs * yglyphs); +*/ - glyph = 0; + nglyph = 0; for (yc = 0; yc < yglyphs; yc++) for (xc = 0; xc < xglyphs; xc++) { - SDL_Surface *bmp = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, + SDL_Surface *glyph = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, image->format->BitsPerPixel, image->format->Rmask, image->format->Gmask, image->format->Bmask, image->format->Amask); - if (bmp == NULL) + if (glyph == NULL) { dmFreeBitmapFont(font); return DMERR_MALLOC; @@ -148,9 +150,9 @@ r.w = width; r.h = height; - SDL_BlitSurface(image, &r, bmp, NULL); + SDL_BlitSurface(image, &r, glyph, NULL); - font->glyphs[glyph++] = bmp; + font->glyphs[nglyph++] = glyph; } *pfont = font;