 | Code: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //! @file MyFonts.c //! @brief This file manages a small font display (smaller than native NXT fonts). //! @date 2012-05-06 //! @version 1.05 //! @author Michael Cambay //! @copyright You may use this code as you wish, provided you give credit where its due. //! @par LOG: //! @code //! WHO WHEN VERSION WHAT //! --------------------------------------------------------------------------------------------------------------------------- //! MKI 2012-05-06 1.05 Add commented sections starting with //<<<<... and ending with //>>>>... //! //! MKI 2012-04-01 1.04 Chg: Move all structures and signatures delacarations into MyFonts.h //! Chg: Keep only source codes into MyFonts.c //! //! MKI 2012-03-17 1.03 fix inversion of '(' and ')' characters //! //! MKI 2012-03-02 1.02 fix witdh of '+' (from 4 to 3) //! //! MKI 2012-02-16 1.01 Add doxygen group and comments //! //! MKI 2012-01-29 1.00 Create small font //! @endcode /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef MY_FONTS #define MY_FONTS 1 // prevent multiple compilations
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // SECTION: ROBOTC PROJECT MAIN FILE DECLARATION #ifndef PROJECT_MAIN_FILE #define PROJECT_MAIN_FILE "myFonts.c" //!< enable compilation of task main() and various debug and test functions of this file #endif // END OF: ROBOTC PROJECT MAIN FILE DECLARATION //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // SECTION HEADERS #include "myFonts.h" // END OF HEADERS //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // SECTION GLOBAL INSTANCES #include "myFonts_globals.c" // END OF GLOBAL INSTANCES //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< //< SECTION EXTERNAL SOURCES #include "myCoord.c" // END OF EXTERNAL SOURCES //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//============================================================================================================================= //! @addtogroup FONTS //! @{
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // SECTION LOCAL INSTANCES
//----------------------------------------------------------------------------------------------------------------------------- //! @struct Font_Small[] //! @brief this array defines the character pixels of small font a nxt screen. //! each character is defined with 1 byte indicating its width and 6 bytes indicating the pixel on each row //! @note This array is not included in FONT_HANDLER structure, because RobotC 3.08 can't initialize structures //! @todo include this array in FONT structured when RobotC will be able to initialize array. //----------------------------------------------------------------------------------------------------------------------------- ubyte Font_Small[]= { //! espace 32 3, BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '!' 33 1, BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '"' 34 3, BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '#' 35 5, BitsToByte(0,1,0,1,0,0,0,0), BitsToByte(1,1,1,1,1,0,0,0), BitsToByte(0,1,0,1,0,0,0,0), BitsToByte(1,1,1,1,1,0,0,0), BitsToByte(0,1,0,1,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '$' 36 3, BitsToByte(0,1,1,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0),
//! '%' 37 5, BitsToByte(1,1,1,0,1,0,0,0), BitsToByte(1,0,1,1,0,0,0,0), BitsToByte(1,1,1,1,1,0,0,0), BitsToByte(0,1,1,0,1,0,0,0), BitsToByte(1,0,1,1,1,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '&' 38 4, BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,1,1,0,0,0,0), BitsToByte(0,1,1,1,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! ''' 39 2, BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '(' 40 2, BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! ')' 41 2, BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '*' 42 5, BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,1,0,0,0), BitsToByte(0,1,1,1,0,0,0,0), BitsToByte(1,0,1,0,1,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '+' 43 3, BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! ',' 44 3, BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0),
//! '-' 45 3, BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '.' 46 3, BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '/' 47 3, BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '0' 48 3, BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '1' 49 3, BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '2' 50 3, BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '3' 51 3, BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '4' 52 3, BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '5 53 3, BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '6' 54 3, BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '7' 55 3, BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '8' 56 3, BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '9' 57 3, BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! ':' 58 1, BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! ';' 59 3, BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0),
//! '<' 60 3, BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '=' 61 3, BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '>' 62 3, BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '?' 63 3, BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0),
//! '@' 64 4, BitsToByte(0,1,1,0,0,0,0,0), BitsToByte(1,0,1,1,0,0,0,0), BitsToByte(1,0,1,1,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,1,1,1,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'A' 65 3, BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'B' 66 3, BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'C' 67 3, BitsToByte(0,1,1,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'D' 68 3, BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'E' 69 3, BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'F' 70 3, BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'G' 71 3, BitsToByte(0,1,1,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'H' 72 3, BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'I' 73 1, BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'J' 74 3, BitsToByte(0,1,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'K' 75 3, BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'L' 76 3, BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'M' 77 5, BitsToByte(1,0,0,0,1,0,0,0), BitsToByte(1,1,0,1,1,0,0,0), BitsToByte(1,0,1,0,1,0,0,0), BitsToByte(1,0,0,0,1,0,0,0), BitsToByte(1,0,0,0,1,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'N' 78 4, BitsToByte(1,0,0,1,0,0,0,0), BitsToByte(1,1,0,1,0,0,0,0), BitsToByte(1,0,1,1,0,0,0,0), BitsToByte(1,0,0,1,0,0,0,0), BitsToByte(1,0,0,1,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'O' 79 3, BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'P' 80 3, BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'Q' 81 4, BitsToByte(0,1,1,0,0,0,0,0), BitsToByte(1,0,0,1,0,0,0,0), BitsToByte(1,0,0,1,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,1,1,1,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'R' 82 3, BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'S' 83 3, BitsToByte(0,1,1,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'T' 84 3, BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'U' 85 3, BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'V' 86 3, BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'W' 87 5, BitsToByte(1,0,0,0,1,0,0,0), BitsToByte(1,0,0,0,1,0,0,0), BitsToByte(1,0,1,0,1,0,0,0), BitsToByte(1,0,1,0,1,0,0,0), BitsToByte(0,1,0,1,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'X' 88 3, BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'Y' 89 3, BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! 'Z' 90 3, BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '[' 91 2, BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '\' 92 3, BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! ']' 93 2, BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '^' 94 3, BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '_' 95 3, BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(1,1,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '`' 96 NOTE: NXT firmware displays this as Degree symbol. So do I. 3, BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '{' 123 NOTE: this char has the 97th position (replacing 'a') 3, BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,1,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '|' 124 NOTE: this char has the 98th position (replacing 'b') 1, BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '}' 125 NOTE: this char has the 99th position (replacing 'c') 3, BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(0,1,1,0,0,0,0,0), BitsToByte(0,1,0,0,0,0,0,0), BitsToByte(1,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0),
//! '~' 126 NOTE: this char has the 100th position (replacing 'd') 4, BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,1,0,1,0,0,0,0), BitsToByte(1,0,1,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), BitsToByte(0,0,0,0,0,0,0,0), }; // END OF LOCAL INSTANCES //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // SECTION CODE
//----------------------------------------------------------------------------------------------------------------------------- //! @brief display a small charater (at Font.Pos.Y and Font.Pos.Y) //! @param[in] C charater to display //! @return return location of blank pixel at the left of next character to display //! @note //----------------------------------------------------------------------------------------------------------------------------- ubyte Font_DisplayChar(char C) { // These inititalizations (done here) avoid the need to call a Font_Init() function before using the small font. FontHandler_Small.cMax = (sizeof(Font_Small)/7)+' '; FontHandler_Small.Height = 6; // the small charactere are 6 rows height
// turns lowercases into uppercases if(C>='a' && C<='z') C&=~0x20;
// shift {|}~ caracteres for a correct display. if(C >= '{' && C <= '~') C -= ('{'-'a');
// check if character exists in the Font. if((C >= ' ') && ( C < FontHandler_Small.cMax) ) FontHandler_Small.Index = (C - ' ') * 7; else return(FontHandler_Small.Pos.X);
// Get width of character FontHandler_Small.Width = Font_Small[FontHandler_Small.Index++];
// display each row of charcter for (FontHandler_Small.Row=0; FontHandler_Small.Row<FontHandler_Small.Height; FontHandler_Small.Row++) { // display first column empty nxtClearPixel(FontHandler_Small.Pos.X+FontHandler_Small.Col, FontHandler_Small.Pos.Y-FontHandler_Small.Row);
// display each column of charcter FontHandler_Small.Msk= 0x80; for(FontHandler_Small.Col=1; FontHandler_Small.Col<=FontHandler_Small.Width; FontHandler_Small.Col++) { int i = FontHandler_Small.Index+FontHandler_Small.Row; // work around RobotC 3.05 bug if(Font_Small[i] & FontHandler_Small.Msk) nxtSetPixel (FontHandler_Small.Pos.X+FontHandler_Small.Col, FontHandler_Small.Pos.Y-FontHandler_Small.Row); else nxtClearPixel(FontHandler_Small.Pos.X+FontHandler_Small.Col, FontHandler_Small.Pos.Y-FontHandler_Small.Row); FontHandler_Small.Msk = FontHandler_Small.Msk>>1; } // display last column empty nxtClearPixel(FontHandler_Small.Pos.X+FontHandler_Small.Col, FontHandler_Small.Pos.Y-FontHandler_Small.Row); } FontHandler_Small.Pos.X += FontHandler_Small.Width+1; return(FontHandler_Small.Pos.X); }
//----------------------------------------------------------------------------------------------------------------------------- //! @brief display a string at x,y //! @param[in] X location of blank pixel at the left of the first character to display //! @param[in] Y location of top row of first character to display //! @param[out] S string to display //! @return return location of blank pixel at the left of next character to display //----------------------------------------------------------------------------------------------------------------------------- ubyte Font_DisplayString(ubyte X, ubyte Y, string S) { Coord_Set(FontHandler_Small.Pos, X, Y); for (int i=0; i<strlen(S); i++) Font_DisplayChar(StringGetChar(S,i)); return(FontHandler_Small.Pos.X); }
//----------------------------------------------------------------------------------------------------------------------------- //! @brief display an formated integer at x,y //! @param[in] X location of blank pixel at the left of the first character to display //! @param[in] Y location of top row of first character to display //! @param[in] Format format string (sprintf syntax) //! @param[in] N integer to display //! @return return location of blank pixel at the left of next character to display //----------------------------------------------------------------------------------------------------------------------------- ubyte Font_DisplayInt(ubyte X, ubyte Y, string Format, int N) { string s; sprintf(s, Format, N); return Font_DisplayString(X, Y, s); }
// END OF CODE //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//! @} //=============================================================================================================================
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // SECTION TESTS #if(PROJECT_MAIN_FILE=="myFonts.c") #ifdef OPTION_SHOW_SPRINTF_HEX_BUG //----------------------------------------------------------------------------------------------------------------------------- //! @brief Test hexadecimal output from sprintf. (3.05 issue) //! @return none //----------------------------------------------------------------------------------------------------------------------------- void myFonts_Tests() { string s; char c = 127;//254; ubyte ub = 0xFE; int i = 0xFEDC; long l = 0xFEDC;
eraseDisplay();
sprintf(s,"Arg Result"); writeDebugStreamLine(s); sprintf(s,"0xFE %X", 0xFE); writeDebugStreamLine(s); sprintf(s,"0xFEDC %X", 0xFEDC); writeDebugStreamLine(s); sprintf(s,"0xFEDCBA98 %X", 0xFEDCBA98);writeDebugStreamLine(s); sprintf(s,"c %X", c); writeDebugStreamLine(s); sprintf(s,"ub %X", ub); writeDebugStreamLine(s); sprintf(s,"i %X", i); writeDebugStreamLine(s); sprintf(s,"l %X", l); writeDebugStreamLine(s);
while(true); } #else //----------------------------------------------------------------------------------------------------------------------------- //! @brief Test small font display //! @return none //----------------------------------------------------------------------------------------------------------------------------- void myFonts_Tests() { eraseDisplay(); string s; s = "abcdefghijklmnop"; Font_DisplayString( 0,38, s); s = " !\"#$%&'()*+,-./"; Font_DisplayString( 0,62, s); s = "0123456789:;<=>?@"; Font_DisplayString( 0,56, s); s = "ABCDEFGHIJKLMNOP"; Font_DisplayString( 0,50, s); s = "QRSTUVWXYZ[\]^_`"; Font_DisplayString( 0,44, s); s = "qrstuvwxyz{|}~ "; Font_DisplayString( 0,32, s);
int i; s = "0123456789"; i = Font_DisplayString( 0,26, s); i = Font_DisplayString( i,26, s); i = Font_DisplayString( i,26, s);
Font_DisplayInt( 1,20, "%d", 32765); Font_DisplayInt( 30,14,"%X", -25877); Font_DisplayInt( 1,14, "%d", -25877);
while(true); } #endif // OPTION_SHOW_SPRINTF_HEX_BUG
task main() { myFonts_Tests(); } #endif // (PROJECT_MAIN_FILE == "myFonts.c") // END OF TESTS //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#endif // MY_FONTS
|  |