summaryrefslogtreecommitdiff
path: root/rufl_substitution_lookup.c
blob: fba76aa00a3a9fd197e66f994998d58f8320db7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * This file is part of RUfl
 * Licensed under the MIT License,
 *                http://www.opensource.org/licenses/mit-license
 * Copyright 2005 James Bursa <james@semichrome.net>
 */

#include "rufl_internal.h"


/**
 * Look up a character in the substitution table.
 *
 * \param  c  character to look up
 * \return  font number containing the character, or NOT_AVAILABLE
 */

unsigned int rufl_substitution_lookup(unsigned int c)
{
	unsigned int block = c >> 8;

	if (256 < block)
		return NOT_AVAILABLE;

	if (rufl_substitution_table->index[block] == BLOCK_NONE_AVAILABLE)
		return NOT_AVAILABLE;
	else {
		return rufl_substitution_table->block
				[rufl_substitution_table->index[block]]
				[c & 255];
	}
}