blob: 37c3e0033668eb8237470b8fe6ee71a55294384a [file] [log] [blame]
Dzmitry Sankouski7fa964a2023-03-07 13:21:14 +03001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * (C) Copyright 2023 Dzmitry Sankouski <dsankouski@gmail.com>
4 */
5
6#ifndef _VIDEO_FONT_DATA_
7#define _VIDEO_FONT_DATA_
8#define VIDEO_FONT_BYTE_WIDTH(width) ((width / 8) + (width % 8 > 0))
9#define VIDEO_FONT_CHAR_PIXEL_BYTES(width, height) (height * VIDEO_FONT_BYTE_WIDTH(width))
10#define VIDEO_FONT_SIZE(chars, width, height) (chars * VIDEO_FONT_CHAR_PIXEL_BYTES(width, height))
11
12struct video_fontdata {
13 const char *name;
14 int width;
15 int height;
16 int byte_width;
17 int char_pixel_bytes;
18 unsigned char *video_fontdata;
19};
20
21#define FONT_ENTRY(_font_width, _font_height, _width_x_height) \
22{ \
23 .name = #_width_x_height, \
24 .width = _font_width, \
25 .height = _font_height, \
26 .byte_width = VIDEO_FONT_BYTE_WIDTH(_font_width), \
27 .char_pixel_bytes = VIDEO_FONT_CHAR_PIXEL_BYTES(_font_width, _font_height), \
28 .video_fontdata = video_fontdata_##_width_x_height, \
29}
30
31#endif /* _VIDEO_FONT_DATA_ */