aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
blob: 696d5d8fe3b39c0aa64d6c894646a37b56a86317 (plain) (blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* See LICENSE file for copyright and license details. */
#ifndef COMMON_H_
#define COMMON_H_

#if defined(__GNUC__)
# pragma GCC diagnostic ignored "-Wunsuffixed-float-constants"
#endif

#include <libsimple.h>
#include <libsimple-arg.h>
#include <libcmap.h>
#include <grapheme.h>
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
# pragma GCC diagnostic ignored "-Wstrict-prototypes"
#endif
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
#include <math.h>

#if GTK_CHECK_VERSION(2, 12, 0)
# define HAVE_ITEM_TOOLTIPS
#endif

#if defined(__GNUC__)
# define PURE __attribute__((__pure__))
# define CONST __attribute__((__const__))
#else
# define PURE
# define CONST
#endif

#define COMMA ,

#include "char-table.h"
#include "filtered-combo.h"
#include "logical-scroll-pane.h"


#define MARK_BASE 0x20u /* 0x25CCu DOTTED CIRCLE || XXX make the a setting */

enum codepoint_class {
	CP_OUT_OF_RANGE,
	CP_CONTROL,
	CP_SURROGATE,
	CP_NONCHARACTER,
	CP_RESERVED, /* includes not yet assigned */
	CP_COMBINING_MARK,
	CP_REGULAR,
};


/* characters.c */
CONST int is_noncharacter(uint32_t cp);
CONST int is_surrogate(uint32_t cp);
CONST int is_valid_codepoint(uint32_t cp);
struct libcmap_codepoint_data *get_codepoint_data(uint32_t cp);
PURE enum codepoint_class classify_from_codepoint_data(const struct libcmap_codepoint_data *data);
enum codepoint_class classify_codepoint(uint32_t cp);
PURE int is_in_script(uint32_t cp, const struct libcmap_script *script);

/* colour.c */
double srgb_encode_unsigned(double t);
double srgb_decode_unsigned(double t);
double srgb_blend(double at0, double t, double at1);
void set_source_colour_blend(cairo_t *g, const GdkColor *at0, double t, const GdkColor *at1);
void set_source_colour(cairo_t *g, const GdkColor *colour);

#endif