blob: 85b4e61501bf49a7f89d73bfed398bbfb2563cbc [file] [log] [blame]
zongqiang.zhang0c6a0882019-08-07 14:48:21 +08001/**
2 \file glcd_text.h
3 \brief GLCD Library - Text functions
4 \author Andy Gock
5 */
6
7/*
8 Copyright (c) 2012, Andy Gock
9
10 All rights reserved.
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright
15 notice, this list of conditions and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright
17 notice, this list of conditions and the following disclaimer in the
18 documentation and/or other materials provided with the distribution.
19 * Neither the name of Andy Gock nor the
20 names of its contributors may be used to endorse or promote products
21 derived from this software without specific prior written permission.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 DISCLAIMED. IN NO EVENT SHALL ANDY GOCK BE LIABLE FOR ANY
27 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33*/
34
35#ifndef GLCD_TEXT_H
36#define GLCD_TEXT_H
37
38/** \addtogroup Text
39 * Functions relating to using text fonts.
40 * @{
41 */
42
43/** \addtogroup StandardText Standard Text
44 * Functions relating to using text fonts of all sizes.
45 * @{
46 */
47
48/** Set GLCD font to predefined font table. Only suitable for MikroElektronika font storage format.
49 *
50 * \param font_table pointer to font table to be used
51 * \param width width of each character
52 * \param height height of each character
53 * \param start_char first character of font table
54 * \param end_char last character of font table
55 * \note Only suitable for MikroElektronika font storage format. For Stang format, use
56 * glcd_tiny_set_font()
57 * \see glcd_tiny_set_font()
58 */
59#if defined(GLCD_DEVICE_AVR8)
60void glcd_set_font(PGM_P font_table, uint8_t width, uint8_t height, char start_char, char end_char);
61#else
62void glcd_set_font(const char * font_table, uint8_t width, uint8_t height, char start_char, char end_char);
63#endif
64
65/** Set GLCD font to predefined font table. Suitable for different different types of font tables.
66 *
67 * \param font_table pointer to font table to be used
68 * \param width width of each character
69 * \param height height of each character
70 * \param start_char first character of font table
71 * \param end_char last character of font table
72 * \param type font table type
73 * \note Only suitable for MikroElektronika font storage format. For Stang format, use
74 * glcd_tiny_set_font()
75 * \see glcd_tiny_set_font()
76 */
77#if defined(GLCD_DEVICE_AVR8)
78void glcd_font(PGM_P font_table, uint8_t width, uint8_t height, char start_char, char end_char, font_table_type_t type);
79#else
80void glcd_font(const char * font_table, uint8_t width, uint8_t height, char start_char, char end_char, font_table_type_t type);
81#endif
82
83/** Draw a char at specified location.
84 * \param x x location to place top-left of character frame
85 * \param y y location to place top-left of character frame
86 * \param c character to be drawn
87 * \return width of character, 0 on error (e.g could not read font table)
88 */
89uint8_t glcd_draw_char_xy(uint8_t x, uint8_t y, char c);
90
91/** Draw a string at specified location.
92 * \param x x location to place top-left of character frame
93 * \param y y location to place top-left of character frame
94 * \param c pointer to string to be drawn
95 */
96void glcd_draw_string_xy(uint8_t x, uint8_t y, char *c);
97
98/** Draw a string from program memory at specified location.
99 * \param x x location to place top-left of character frame
100 * \param y y location to place top-left of character frame
101 * \param str pointer to string in program memory to be drawn
102 */
103void glcd_draw_string_xy_P(uint8_t x, uint8_t y, const char *str);
104
105/** @}*/
106
107/** @}*/
108
109#endif