forked from Skiff2/SimplyVFD_V3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfonts.h
132 lines (107 loc) · 2.85 KB
/
fonts.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* original author: Tilen Majerle<tilen@majerle.eu>
* modification for STM32f10x: Alexander Lutsai<s.lyra@ya.ru>
----------------------------------------------------------------------
Copyright (C) Alexander Lutsai, 2016
Copyright (C) Tilen Majerle, 2015
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------------------------------------
*/
#ifndef FONTS_H
#define FONTS_H 120
/* C++ detection */
#ifdef __cplusplus
extern C {
#endif
/**
*
* Default fonts library. It is used in all LCD based libraries.
*
* \par Supported fonts
*
* Currently, these fonts are supported:
* - 7 x 10 pixels
* - 11 x 18 pixels
* - 16 x 26 pixels
*/
#include "stm32f10x.h"
#include "string.h"
/**
* @defgroup LIB_Typedefs
* @brief Library Typedefs
* @{
*/
/**
* @brief Font structure used on my LCD libraries
*/
typedef struct {
uint8_t FontWidth; /*!< Font width in pixels */
uint8_t FontHeight; /*!< Font height in pixels */
const uint16_t *data; /*!< Pointer to data font data array */
} FontDef_t;
/**
* @brief String length and height
*/
typedef struct {
uint16_t Length; /*!< String length in units of pixels */
uint16_t Height; /*!< String height in units of pixels */
} FONTS_SIZE_t;
/**
* @}
*/
/**
* @defgroup FONTS_FontVariables
* @brief Library font variables
* @{
*/
/**
* @brief 7 x 10 pixels font size structure
*/
extern FontDef_t Font_7x10;
/**
* @brief 11 x 18 pixels font size structure
*/
extern FontDef_t Font_11x18;
/**
* @brief 16 x 26 pixels font size structure
*/
extern FontDef_t Font_16x26;
/**
* @}
*/
/**
* @defgroup FONTS_Functions
* @brief Library functions
* @{
*/
/**
* @brief Calculates string length and height in units of pixels depending on string and font used
* @param *str: String to be checked for length and height
* @param *SizeStruct: Pointer to empty @ref FONTS_SIZE_t structure where informations will be saved
* @param *Font: Pointer to @ref FontDef_t font used for calculations
* @retval Pointer to string used for length and height
*/
char* FONTS_GetStringSize(char* str, FONTS_SIZE_t* SizeStruct, FontDef_t* Font);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/* C++ detection */
#ifdef __cplusplus
}
#endif
#endif