1.44 tft lcd display

Dependencies:   TFT_fonts mbed-os

Fork of newTFTLCD by madhu sudhana

Revision:
29:35482446e4ee
Parent:
28:6ac2fa56f82c
--- a/lcd_base.cpp	Thu May 24 07:55:36 2018 +0000
+++ b/lcd_base.cpp	Thu Oct 04 05:11:28 2018 +0000
@@ -383,6 +383,7 @@
 void LCD::Print( const char *str, unsigned short x, unsigned short y, int fgColor, int bgColor, unsigned short deg )
 {
     int stl, i;
+    char rot[100];
 
     stl = strlen( str );
 
@@ -394,9 +395,9 @@
     for ( i = 0; i < stl; i++ )
         if ( deg == 0 )
             PrintChar( *str++, x + ( i * ( _font->Width ) ), y, fgColor, bgColor );
-        else
+            else
             RotateChar( *str++, x, y, i, fgColor, bgColor, deg );
-}
+}               
 void LCD::Printinv( const char *str, unsigned short x, unsigned short y, int fgColor, int bgColor, unsigned short deg )
 {
     int stl, i;
@@ -409,8 +410,9 @@
         x = ( GetWidth() - ( stl * _font->Width ) ) / 2;
 
     for ( i = 0; i < stl; i++ )
-        if ( deg == 0 )
-            PrintChar( *str++, x -( i * ( _font->Width ) ), y, fgColor, bgColor );
+        if ( deg == 180 )
+            PrintChar( *str++, y+( i * ( _font->Width ) ), x, fgColor, bgColor );
+          
         else
             RotateChar( *str++, x, y, i, fgColor, bgColor, deg );
 }
@@ -597,9 +599,10 @@
 }
 
 void LCD::RotateChar( char c, unsigned short x, unsigned short y, int pos, int fgColor, int bgColor, unsigned short deg )
-{
+{ char c1=c;
     uint8_t i, j, ch;
     int newx, newy;
+    int ptr1[100][100],ptr2[100][100];
     double radian;
     radian = deg * 0.0175;
     
@@ -617,9 +620,33 @@
         {
             ch = _font->Data[ position + zz ];
             for ( i = 0; i < 8; i++ )
-            {
-                newx = x + ( ( ( i + ( zz * 8 ) + ( pos * _font->Width ) ) * cos( radian ) ) - ( ( j ) * sin( radian ) ) );
-                newy = y + ( ( ( j ) * cos( radian ) ) + ( ( i + ( zz * 8 ) + ( pos * _font->Width ) ) * sin( radian ) ) );
+        {
+              ptr1[j][i]= newx = x + ( ( ( i + ( zz * 8 ) + ( pos * _font->Width ) ) * cos( radian ) ) - ( ( j ) * sin( radian ) ) );
+               ptr2[j][i]=newy = y + ( ( ( j ) * cos( radian ) ) + ( ( i + ( zz * 8 ) + ( pos * _font->Width ) ) * sin( radian ) ) );
+
+               // SetXY( newx, newy, newx + 1, newy + 1 );
+
+                //if ( ( ch & ( 1 << ( 7 - i ) ) ) != 0 ) SetPixelColor( usedColorFG );
+                //else SetPixelColor( usedColorBG );
+            }
+        }
+        position += ( _font->Width / 8 );
+    }
+   
+//Deactivate();
+//}
+//adding
+position = _font->Position[ c1 - _font->Offset ];
+    if ( position == -1 ) position = 0; // will print space character
+for ( j = 0; j < _font->Height; j++ )
+    {
+        for ( uint16_t zz = 0; zz < ( ( double ) _font->Width / 8 ); zz++ )
+        {
+            ch = _font->Data[ position + zz ];
+            for ( i = 0; i < 8; i++ )
+        {
+              newx = ptr1[j][i];
+               newy = ptr2[j][i];
 
                 SetXY( newx, newy, newx + 1, newy + 1 );
 
@@ -629,6 +656,6 @@
         }
         position += ( _font->Width / 8 );
     }
-
-    Deactivate();
-}
+   
+ Deactivate();
+}
\ No newline at end of file