Increase J6 pin number from 32 to 34 (34 pin connectors are more common).
[bertos.git] / gfx / text.c
index f8705cc4ed5ddeaba552401cc01896cb03da8643..46e3567dbb326f2435951407ed63621bf995a163 100755 (executable)
 
 /*#*
  *#* $Log$
+ *#* Revision 1.11  2006/05/15 07:21:06  bernie
+ *#* Doxygen fix.
+ *#*
+ *#* Revision 1.10  2006/04/27 05:39:23  bernie
+ *#* Enhance text rendering to arbitrary x,y coords.
+ *#*
+ *#* Revision 1.9  2006/04/11 00:08:24  bernie
+ *#* text_offset(): New function, but I'm not quite confident with the design.
+ *#*
+ *#* Revision 1.8  2006/03/22 09:50:37  bernie
+ *#* Use the same format for fonts and rasters.
+ *#*
  *#* Revision 1.7  2006/03/20 17:51:55  bernie
  *#* Cleanups.
  *#*
 #include <cfg/debug.h>
 
 
-/*! ANSI escape sequences flag: true for ESC state on */
+/**
+ * ANSI escape sequences flag: true for ESC state on.
+ *
+ * \todo Move to Bitmap.flags.
+ */
 static bool ansi_mode = false;
 
+/*!
+ * Move (imaginary) cursor to coordinates specified.
+ */
+void text_setCoord(struct Bitmap *bm, int x, int y)
+{
+       bm->penX = x;
+       bm->penY = y;
+}
+
 
 /*!
  * Move (imaginary) cursor to column and row specified.
  * Next text write will start a that row and col.
  */
-void text_moveto(struct Bitmap *bm, int row, int col)
+void text_moveTo(struct Bitmap *bm, int row, int col)
 {
        ASSERT(col >= 0);
        ASSERT(col < bm->width / bm->font->width);
        ASSERT(row >= 0);
        ASSERT(row < bm->height / bm->font->height);
 
-       bm->penX = col * bm->font->width;
-       bm->penY = row * bm->font->height;
-}
-
-
-/*!
- * Move (imaginary) cursor to coordinates specified.
- */
-void text_setcoord(struct Bitmap *bm, int x, int y)
-{
-       bm->penX = x;
-       bm->penY = y;
+       text_setCoord(bm, col * bm->font->width, row * bm->font->height);
 }
 
 
@@ -213,7 +227,7 @@ static int text_putglyph(char c, struct Bitmap *bm)
                                        src_col /= 2;
 
                                /* Fetch a column of dots from glyph. */
-                               dots = PGM_READ_CHAR(glyph + src_col * glyph_height_bytes + row);
+                               dots = PGM_READ_CHAR(RAST_ADDR(glyph, src_col, row * 8, glyph_width));
 
                                /* Italic: get lower 4 dots from previous column */
                                if (styles & STYLEF_ITALIC)
@@ -249,7 +263,7 @@ static int text_putglyph(char c, struct Bitmap *bm)
        else
        {
                /* No style: fast vanilla copy of glyph to bitmap */
-               gfx_blitRaster(bm, bm->penX, bm->penY, glyph, glyph_width, glyph_height, glyph_height_bytes);
+               gfx_blitRaster(bm, bm->penX, bm->penY, glyph, glyph_width, glyph_height, glyph_width);
        }
 
        /* Update current pen position */