]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/libsystemd-terminal/unifont.h
terminal: move unifont-internal.h to unifont.h
[thirdparty/systemd.git] / src / libsystemd-terminal / unifont.h
CommitLineData
86db5dfb
DH
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3/***
4 This file is part of systemd.
5
6 Copyright (C) 2014 David Herrmann <dh.herrmann@gmail.com>
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
22#pragma once
23
24#include <stdbool.h>
25#include <stdint.h>
26#include <stdlib.h>
27#include "util.h"
28
29typedef struct unifont unifont;
30typedef struct unifont_glyph unifont_glyph;
31
32/*
33 * Unifont
34 * The unifont API provides a glyph-lookup for bitmap fonts which can be used
35 * as fallback if no system-font is available or if you don't want to deal with
36 * full font renderers.
37 */
38
39struct unifont_glyph {
40 unsigned int width;
41 unsigned int height;
42 unsigned int stride;
43 unsigned int cwidth;
44 const void *data; /* unaligned! */
45};
46
47int unifont_new(unifont **out);
48unifont *unifont_ref(unifont *u);
49unifont *unifont_unref(unifont *u);
50
51DEFINE_TRIVIAL_CLEANUP_FUNC(unifont*, unifont_unref);
52
53unsigned int unifont_get_stride(unifont *u);
54int unifont_lookup(unifont *u, unifont_glyph *out, uint32_t ucs4);