"THE ClubMate-WARE LICENSE" (Revision 42):
[hackover2013-badge-firmware.git] / drivers / displays / tft / aafonts.c
index c425bf9..0983c15 100644 (file)
@@ -1,5 +1,5 @@
 /**************************************************************************/
-/*! 
+/*!  
     @file     aafonts.c
     @author   K. Townsend (microBuilder.eu)
 
@@ -239,6 +239,30 @@ void aafontsDrawString(uint16_t x, uint16_t y, const uint16_t * colorTable, cons
   }
 }
 
+/**************************************************************************/
+/*!
+    @brief  Draws a string using the supplied anti-aliased font, centering
+            it on the specified X/Y co-ordinate
+
+    @param[in]  x
+                Center x co-ordinate
+    @param[in]  y
+                Center y co-ordinate
+    @param[in]  colorTable
+                The color lookup table to use for the antialiased pixels
+    @param[in]  font
+                Pointer to the aafontsFont_t to use when drawing the string
+    @param[in]  str
+                The string to render
+*/
+/**************************************************************************/
+void aafontsCenterString(uint16_t x, uint16_t y, const uint16_t * colorTable, const aafontsFont_t *font, char *str)
+{
+  uint32_t stringWidth;
+  stringWidth = aafontsGetStringWidth(font, str);
+  aafontsDrawString(x - stringWidth/2, y, colorTable, font, str);
+}
+
 /**************************************************************************/
 /*!
     @brief  Returns the width in pixels of a string when it is rendered
@@ -294,17 +318,11 @@ uint16_t aafontsGetStringWidth(const aafontsFont_t *font, char *str)
 
 /**************************************************************************/
 /*!
-    @brief  Creates a 4 or 16 shade color between the specified bg and
-            fore color for use with anti-aliased fonts.
-
-    @note   This method can be used to place anti-aliased in any color on
-            any known, solid-colored background.
+    @brief  Calculates a 4 or 16 color lookup table between the specified
+               bg and fore colors for use with anti-aliased fonts.
 
-            You can get slightly higher-quality results by calculating
-            the color tables by hand, but this method is a convenient
-            method to create text in a variety of colors or on a variety
-            of backgrounds.  Please note, though, that the visual quality
-            of the text heavily on the colors being used.
+    @note   This method can be used to place anti-aliased text on any color
+               of background, as long as it's a single solid color.
 
     @param[in]  bgColor
                 The RGB565 color of the background
This page took 0.019586 seconds and 4 git commands to generate.