Forked para SNOCC

Dependencies:   GPS

Dependents:   SNOCC_V1 SNOCC_V2

Fork of RA8875 by SNOCC

Revision:
98:ecebed9b80b2
Parent:
96:40b74dd3695b
Child:
99:66edf771373a
diff -r 40b74dd3695b -r ecebed9b80b2 RA8875.h
--- a/RA8875.h	Sat Nov 28 15:39:44 2015 +0000
+++ b/RA8875.h	Thu Dec 17 12:16:40 2015 +0000
@@ -68,7 +68,7 @@
 
 // What better place for some test code than in here and the companion
 // .cpp file. See also the bottom of this file.
-//#define TESTENABLE
+#define TESTENABLE
 
 /// DOS colors - slightly color enhanced
 #define Black       (color_t)(RGB(0,0,0))
@@ -1009,10 +1009,13 @@
     ///
     RetCode_t SetTextCursorControl(cursor_t cursor = NOCURSOR, bool blink = false);
     
-    /// Select the ISO 8859-X font to use next.
+    /// Select the built-in ISO 8859-X font to use next.
     ///
     /// Supported fonts: ISO 8859-1, -2, -3, -4
     ///
+    /// @caution This only modifies the choice of font from the RA8875 internal
+    ///     fonts.
+    ///
     /// @param[in] font selects the font for the subsequent text rendering.
     ///
     /// @note if either hScale or vScale is outside of its permitted range,
@@ -1029,6 +1032,8 @@
     ///       to sending text to the screen, or you end with a blended
     ///       image that is probably not as intended.
     ///
+    /// @caution This command only operates on the RA8875 internal fonts.
+    ///
     /// @code
     ///     lcd.cls();
     ///     lcd.SetOrientation(RA8875::normal);
@@ -1065,6 +1070,8 @@
     /// This command lets you make several modifications to any text that
     /// will be written to the screen.
     ///
+    /// @caution This command only operates on the RA8875 internal fonts.
+    ///
     /// Options can be combined:
     /// Default:
     /// @li Full alignment disabled, 
@@ -1095,12 +1102,14 @@
         VerticalScale vScale = 1, 
         alignment_t alignment = align_none);
     
-    /// Control the font size
+    /// Control the font size of the RA8875 internal fonts.
     ///
     /// This command lets you set the font enlargement for both horizontal
     /// and vertical, independent of the rotation, background, and 
     /// alignment. @see SetTextFontControl.
     ///
+    /// @caution This command only operates on the RA8875 internal fonts.
+    ///
     /// @param[in] hScale defaults to 1, but can be 1, 2, 3, or 4,
     ///     and scales the font size by this amount.
     /// @param[in] vScale is an optional parameter that defaults to the hScale value, 
@@ -1738,20 +1747,41 @@
 
     /// Select a bitmap font (provided by the user) for all subsequent text.
     ///
+    /// @caution This function is deprecated. @see SelectUserFont.
+    ///
     /// @note Tool to create the fonts is accessible from its creator
     ///     available at http://www.mikroe.com. 
     ///     Change the data to an array of type char[].
     ///
-    /// @param[in] font is a pointer to a specially formed font array.
-    ///     This special font array has a 4-byte header, followed by 
-    ///     the data:
+    /// This special font array is modified from the mikroe tool output,
+    /// to include a special 4-byte header, which has this data:
     ///   - the number of bytes per char
     ///   - the vertical size in pixels for each character
     ///   - the horizontal size in pixels for each character
     ///   - the number of bytes per vertical line (width of the array)
+    ///   - following this special header is the normal data stream.
+    ///
+    /// @param[in] font is a pointer to a specially formed font array.
     /// @returns error code.
     ///
     virtual RetCode_t set_font(const unsigned char * font = NULL);
+    
+    
+    /// Select a User Font for all subsequent text.
+    ///
+    /// @note This function is replaces the obsolete function @see set_font.
+    ///
+    /// @note Tool to create the fonts is accessible from its creator
+    ///     available at http://www.mikroe.com. 
+    ///     For version 1.2.0.0, choose the "Export for TFT and new GLCD"
+    ///     format.
+    ///
+    /// @param[in] font is a pointer to a specially formed font resource.
+    /// @returns error code.
+    ///
+    virtual RetCode_t SelectUserFont(const uint8_t * font = NULL);
+
+    typedef uint8_t byte;
 
     /// Get the RGB value for a DOS color.
     ///
@@ -2069,6 +2099,9 @@
     bool portraitmode;              ///< set true when in portrait mode (w,h are reversed)
     
     const unsigned char * font;     ///< reference to an external font somewhere in memory
+    uint8_t extFontHeight;          ///< computed from the font table when the user sets the font
+    uint8_t extFontWidth;           ///< computed from the font table when the user sets the font
+    
     loc_t cursor_x, cursor_y;       ///< used for external fonts only
     
     #ifdef PERF_METRICS