1 //==============================================================================
2 // Copyright 2011 Meta Watch Ltd. - http://www.MetaWatch.org/
4 // Licensed under the Meta Watch License, Version 1.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.MetaWatch.org/licenses/license-1.0.html
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //==============================================================================
17 /******************************************************************************/
20 * Fonts functions common to OLED and LCD version
22 * LCD is ROW based, OLED is column based
24 /******************************************************************************/
29 /*! There are three fonts defined for the MetaWatch LCD
30 * they are 5, 7 and 16 pixels tall with variable width
45 /*! Use to size the bitmap used in the Display Task for printing characters FOR
48 #define MAX_FONT_ROWS ( 19 )
50 /*! The maximum number of columns any font (or icon) requires. This is
51 * used to define the size of the bitmap passed into font functions FOR THE
54 #define MAX_FONT_COLUMNS ( 30 )
56 #define TOTAL_TIME_CHARACTERS ( 12 )
57 #define TIME_CHARACTER_COLON_INDEX ( 10 )
58 #define TIME_CHARACTER_SPACE_INDEX ( 11 )
60 /*! Convert a character into an index into the font table
62 * \param CharIn is the input character
63 * \return Index into the table
65 unsigned char MapCharacterToIndex(unsigned char CharIn);
67 /*! Convert a digit (0-9) into an index into the font table
69 * \param Digit is a number
70 * \return Index into the table
72 unsigned char MapDigitToIndex(unsigned char Digit);
74 /*! Get the bitmap for the specified character
76 * \param Character is the desired character
77 * \param pBitmap pointer to an array of integers that holds the bitmap
79 * \note pBitmap must point to an object large enough to hold the largest bitmap
81 * \note For the LCD bitmaps the font height is the same as number of rows.
82 * If the width is less than 8 then each row is a byte.
83 * If the width is less than 16 but > 8 then each row is a word.
84 * The function works with ints so that it is generic for both types
87 void GetCharacterBitmap(unsigned char Character,unsigned int * pBitmap);
89 /*! Get the width for a specified character *
91 * \param Character is the desired character
92 * \return Width of character in columns
94 unsigned char GetCharacterWidth(unsigned char Character);
96 /*! Set the font type used for future Get operations *
100 void SetFont(etFontType Type);
102 /*! Set the font spacing for the current font*
104 * \param Spacing is the number of columns between characters
106 * \note The characters do not have any 'natural' spacing between them
108 void SetFontSpacing(unsigned char Spacing);
111 * \return The font spacing in columns
113 unsigned char GetFontSpacing(void);
117 * \return The font height in rows
119 unsigned char GetCharacterHeight(void);