changeset 76:7d201aed1fd9

Cleanups, cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 02 Oct 2012 05:51:25 +0300
parents e6535609c161
children c6cdaa675801
files dmtext_bm.c
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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;