Test for STM32F4

Dependents:   Nucleo_SSD1331

Fork of RGB_OLED_SSD1331 by Juergen M

Revision:
15:c49040bf0e1d
Parent:
13:8dd215952d76
Child:
17:1bcdc92af126
--- a/src/SGL.cpp	Tue Dec 22 21:44:31 2015 +0000
+++ b/src/SGL.cpp	Thu Dec 08 21:38:39 2016 +0000
@@ -269,7 +269,7 @@
 }
 
 //---------------------------------------------------------------------------------------
-template <class T>
+/*template <class T>
 void SGL<T>::drawString(const char *string, T x, T y, uint16_t color, float zoom, uint8_t fontSpace)
 {
     if(!_currentFont && !*_currentFont)
@@ -286,6 +286,31 @@
             x = 0;
         }
     }
+}*/
+
+//---------------------------------------------------------------------------------------
+template <class T>
+Rect<T> SGL<T>::drawString(const char *string, T x, T y, uint16_t color, float zoom, uint8_t fontSpace)
+{
+    if(!_currentFont && !*_currentFont)
+        return Rect<T>();
+        
+    int boundingWidth = 0;
+        
+    while(*string)
+    {
+        boundingWidth += _fontWidth;
+        drawChar(*string, x, y, color, zoom);
+        *string++;
+        x += fontSpace*zoom;
+        if(x >= _width-1)
+        {
+            y += _fontHeight*zoom;
+            x = 0;
+        }
+    }
+    
+    return Rect<T>(x, y, boundingWidth, _fontHeight );
 }
 
 //---------------------------------------------------------------------------------------