]> git.karo-electronics.de Git - oswald.git/blob - ui/Fonts.h
Oh boy... lots of changes, too many to describe
[oswald.git] / ui / Fonts.h
1 //==============================================================================
2 //  Copyright 2011 Meta Watch Ltd. - http://www.MetaWatch.org/
3 // 
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
7 //  
8 //      http://www.MetaWatch.org/licenses/license-1.0.html
9 //
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 //==============================================================================
16
17 /******************************************************************************/
18 /*! \file Fonts.h
19 *
20 * Fonts functions common to OLED and LCD version
21 *
22 * LCD is ROW based, OLED is column based
23 */
24 /******************************************************************************/
25
26 #include "oswald.h"
27
28 #ifndef FONTS_H
29 #define FONTS_H
30
31 /*! There are three fonts defined for the MetaWatch LCD 
32  * they are 5, 7 and 16 pixels tall with variable width
33  */
34 typedef enum 
35 {
36   MetaWatch5,
37   MetaWatch7,
38   MetaWatch16,
39   MetaWatchTime,
40   MetaWatch5Oled,
41   MetaWatch7Oled,
42   MetaWatch16Oled,
43   MetaWatchIconOled,
44   MetaWatchMonospaced10
45 } etFontType;
46
47 /*! Use to size the bitmap used in the Display Task for printing characters FOR 
48  * THE LCD VERSION
49  */
50 #define MAX_FONT_ROWS ( 19 )
51
52 /*! The maximum number of columns any font (or icon) requires.  This is 
53  * used to define the size of the bitmap passed into font functions FOR THE
54  * OLED version
55  */
56 #define MAX_FONT_COLUMNS ( 30 )
57
58 #define TOTAL_TIME_CHARACTERS      ( 12 )
59 #define TIME_CHARACTER_COLON_INDEX ( 10 )
60 #define TIME_CHARACTER_SPACE_INDEX ( 11 )
61
62 /*! Convert a character into an index into the font table
63  *
64  * \param CharIn is the input character
65  * \return Index into the table
66  */
67 unsigned char MapCharacterToIndex(unsigned char CharIn);
68
69 /*! Convert a digit (0-9) into an index into the font table
70  *
71  * \param Digit is a number
72  * \return Index into the table
73  */
74 unsigned char MapDigitToIndex(unsigned char Digit);
75
76 /*! Get the bitmap for the specified character
77  *
78  * \param Character is the desired character
79  * \param pBitmap pointer to an array of integers that holds the bitmap
80  *
81  * \note pBitmap must point to an object large enough to hold the largest bitmap
82  * 
83  * \note For the LCD bitmaps the font height is the same as number of rows. 
84  * If the width is less than 8 then each row is a byte.
85  * If the width is less than 16 but > 8 then each row is a word.
86  * The function works with ints so that it is generic for both types
87  *
88  */
89 void GetCharacterBitmap(unsigned char Character, u16t *pBitmap);
90
91 /*! Get the width for a specified character *
92  *
93  * \param Character is the desired character
94  * \return Width of character in columns
95  */
96 unsigned char GetCharacterWidth(unsigned char Character);
97
98 /*! Set the font type used for future Get operations *
99  *
100  * \param Type of font
101  */
102 void SetFont(etFontType Type);
103
104 /*! Set the font spacing for the current font*
105  *
106  * \param Spacing is the number of columns between characters
107  *
108  * \note The characters do not have any 'natural' spacing between them
109  */
110 void SetFontSpacing(unsigned char Spacing);
111
112 /*! 
113  * \return The font spacing in columns 
114  */
115 unsigned char GetFontSpacing(void);
116
117
118 /*! 
119  * \return The font height in rows 
120  */
121 unsigned char GetCharacterHeight(void);
122
123 #endif /*FONTS_H*/