A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2003 Tat Tang
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#ifndef _FONT_CACHE_H_
22#define _FONT_CACHE_H_
23#include <stdbool.h>
24#include "config.h"
25#include "lru.h"
26
27/*******************************************************************************
28 *
29 ******************************************************************************/
30struct font_cache
31{
32 struct lru _lru;
33 unsigned int _size;
34 unsigned int _capacity;
35 ucschar_t _prev_char_code;
36 int _prev_result;
37 short *_index; /* index of lru handles in char_code order */
38};
39
40struct font_cache_entry
41{
42 ucschar_t _char_code;
43 unsigned char width;
44 unsigned char bitmap[1]; /* place holder */
45};
46
47/* void (*f) (void*, struct font_cache_entry*); */
48/* Create an auto sized font cache from buf */
49void font_cache_create(
50 struct font_cache* fcache, void* buf, int buf_size, int bitmap_bytes_size);
51
52/* Get font cache entry for the given char_code
53 *
54 * cache_only: true if only a cache lookup should be performed and loading on miss should be avoided
55 *
56 * Note: With cache_only this can return NULL, which otherwise never happens */
57struct font_cache_entry* font_cache_get(
58 struct font_cache* fcache,
59 ucschar_t char_code,
60 bool cache_only,
61 void (*callback) (struct font_cache_entry* p, void *callback_data),
62 void *callback_data);
63
64#endif