NetSurf
font.h
Go to the documentation of this file.
1/*
2 * Copyright 2008 Vincent Sanders <vince@simtec.co.uk>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef NETSURF_FB_FONT_H
20#define NETSURF_FB_FONT_H
21
24
25/**
26 * Initialise framebuffer font handling.
27 */
28bool fb_font_init(void);
29
30/**
31 * Finalise framebuffer font handling.
32 */
33bool fb_font_finalise(void);
34
35/**
36 * Find the position in a string where an x coordinate falls.
37 *
38 * \param[in] fstyle style for this text
39 * \param[in] string UTF-8 string to measure
40 * \param[in] length length of string, in bytes
41 * \param[in] x coordinate to search for
42 * \param[out] char_offset updated to offset in string of actual_x, [0..length]
43 * \param[out] actual_x updated to x coordinate of character closest to x
44 * \return NSERROR_OK and char_offset and actual_x updated or
45 * appropriate error code on faliure
46 */
47nserror fb_font_position(const struct plot_font_style *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x);
48
49/**
50 * Measure the width of a string.
51 *
52 * \param[in] fstyle plot style for this text
53 * \param[in] string UTF-8 string to measure
54 * \param[in] length length of string, in bytes
55 * \param[out] width updated to width of string[0..length)
56 * \return NSERROR_OK and width updated or appropriate error code on faliure
57 */
58nserror fb_font_width(const struct plot_font_style *fstyle, const char *string, size_t length, int *width);
59
60
61#ifdef FB_USE_FREETYPE
63#else
65#endif
66
67#endif /* NETSURF_FB_FONT_H */
68
nserror
Enumeration of error codes.
Definition: errors.h:29
struct gui_utf8_table * framebuffer_utf8_table
bool fb_font_finalise(void)
Finalise framebuffer font handling.
bool fb_font_init(void)
Initialise framebuffer font handling.
struct gui_layout_table * framebuffer_layout_table
nserror fb_font_position(const struct plot_font_style *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x)
Find the position in a string where an x coordinate falls.
nserror fb_font_width(const struct plot_font_style *fstyle, const char *string, size_t length, int *width)
Measure the width of a string.
int width
Definition: gui.c:160
User interface utf8 characterset conversion routines.
Definition: utf8.h:31
Font style for plotting.
Definition: plot_style.h:111