123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
#ifndef _VIDEO_FONT_H
#define _VIDEO_FONT_H
#include <linux/math.h>
#include <linux/types.h>
struct console_font;
static inline unsigned int font_glyph_pitch(unsigned int width)
{
return DIV_ROUND_UP(width, 8);
}
static inline unsigned int font_glyph_size(unsigned int width, unsigned int vpitch)
{
return font_glyph_pitch(width) * vpitch;
}
typedef const unsigned char font_data_t;
static inline const unsigned char *font_data_buf(font_data_t *fd)
{
return (const unsigned char *)fd;
}
font_data_t *font_data_import(const struct console_font *font, unsigned int vpitch,
u32 (*calc_csum)(u32, const void *, size_t));
void font_data_get(font_data_t *fd);
bool font_data_put(font_data_t *fd);
unsigned int font_data_size(font_data_t *fd);
const unsigned char *font_data_glyph_buf(font_data_t *fd,
unsigned int width, unsigned int vpitch,
unsigned int c);
bool font_data_is_equal(font_data_t *lhs, font_data_t *rhs);
int font_data_export(font_data_t *fd, struct console_font *font, unsigned int vpitch);
void font_glyph_cursor(unsigned int width, unsigned int height,
unsigned int from, unsigned int to, unsigned char *out);
void font_glyph_rotate_90(const unsigned char *glyph, unsigned int width, unsigned int height,
unsigned char *out);
void font_glyph_rotate_180(const unsigned char *glyph, unsigned int width, unsigned int height,
unsigned char *out);
void font_glyph_rotate_270(const unsigned char *glyph, unsigned int width, unsigned int height,
unsigned char *out);
unsigned char *font_data_rotate(font_data_t *fd, unsigned int width, unsigned int height,
unsigned int charcount, unsigned int steps,
unsigned char *buf, size_t *bufsize);
struct font_desc {
int idx;
const char *name;
unsigned int width, height;
unsigned int charcount;
font_data_t *data;
int pref;
};
extern const struct font_desc *find_font(const char *name);
extern const struct font_desc *get_default_font(int xres, int yres,
unsigned long *font_w,
unsigned long *font_h);
#define MAX_FONT_NAME 32
extern const struct font_desc font_10x18;
extern const struct font_desc font_6x10;
extern const struct font_desc font_6x8;
extern const struct font_desc font_7x14;
extern const struct font_desc font_acorn_8x8;
extern const struct font_desc font_mini_4x6;
extern const struct font_desc font_pearl_8x8;
extern const struct font_desc font_sun_12x22;
extern const struct font_desc font_sun_8x16;
extern const struct font_desc font_ter_10x18;
extern const struct font_desc font_ter_16x32;
extern const struct font_desc font_vga_6x11;
extern const struct font_desc font_vga_8x16;
extern const struct font_desc font_vga_8x8;
#endif /* _VIDEO_FONT_H */