aboutsummaryrefslogtreecommitdiffstats
path: root/libfonts_parse_order__.c
blob: 53b4aa4d60a0e61748b1ff1f8098f1be74155bd5 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST


#define LIST_SUBPIXEL_ORDERS(X)\
	X(LIBFONTS_SUBPIXEL_ORDER_UNKNOWN, "unknown")\
	X(LIBFONTS_SUBPIXEL_ORDER_NONRGB, "non-rgb")\
	X(LIBFONTS_SUBPIXEL_ORDER_NONLINEAR, "non-linear")\
	X(LIBFONTS_SUBPIXEL_ORDER_OTHER, "other")\
	X(LIBFONTS_SUBPIXEL_ORDER_RGB, "rgb")\
	X(LIBFONTS_SUBPIXEL_ORDER_R_G_B, "r:g:b")\
	X(LIBFONTS_SUBPIXEL_ORDER_R_G_B, "vrgb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BGR, "bgr")\
	X(LIBFONTS_SUBPIXEL_ORDER_B_G_R, "b:g:r")\
	X(LIBFONTS_SUBPIXEL_ORDER_B_G_R, "vbgr")\
	X(LIBFONTS_SUBPIXEL_ORDER_GBR, "gbr")\
	X(LIBFONTS_SUBPIXEL_ORDER_G_B_R, "g:b:r")\
	X(LIBFONTS_SUBPIXEL_ORDER_G_B_R, "vgbr")\
	X(LIBFONTS_SUBPIXEL_ORDER_RBG, "rbg")\
	X(LIBFONTS_SUBPIXEL_ORDER_R_B_G, "r:b:g")\
	X(LIBFONTS_SUBPIXEL_ORDER_R_B_G, "vrbg")\
	X(LIBFONTS_SUBPIXEL_ORDER_BRG, "brg")\
	X(LIBFONTS_SUBPIXEL_ORDER_B_R_G, "b:r:g")\
	X(LIBFONTS_SUBPIXEL_ORDER_B_R_G, "vbrg")\
	X(LIBFONTS_SUBPIXEL_ORDER_GRB, "grb")\
	X(LIBFONTS_SUBPIXEL_ORDER_G_R_B, "g:r:b")\
	X(LIBFONTS_SUBPIXEL_ORDER_G_R_B, "vgrb")\
	X(LIBFONTS_SUBPIXEL_ORDER_RR_GB, "rr:gb")\
	X(LIBFONTS_SUBPIXEL_ORDER_GR_BR, "gr:br")\
	X(LIBFONTS_SUBPIXEL_ORDER_BG_RR, "bg:rr")\
	X(LIBFONTS_SUBPIXEL_ORDER_RB_RG, "rb:rg")\
	X(LIBFONTS_SUBPIXEL_ORDER_RR_BG, "rr:bg")\
	X(LIBFONTS_SUBPIXEL_ORDER_BR_GR, "br:gr")\
	X(LIBFONTS_SUBPIXEL_ORDER_GB_RR, "gb:rr")\
	X(LIBFONTS_SUBPIXEL_ORDER_RG_RB, "rg:rb")\
	X(LIBFONTS_SUBPIXEL_ORDER_GG_RB, "gg:rb")\
	X(LIBFONTS_SUBPIXEL_ORDER_RG_BG, "rg:bg")\
	X(LIBFONTS_SUBPIXEL_ORDER_BR_GG, "br:gg")\
	X(LIBFONTS_SUBPIXEL_ORDER_GB_GR, "gb:gr")\
	X(LIBFONTS_SUBPIXEL_ORDER_GG_BR, "gg:br")\
	X(LIBFONTS_SUBPIXEL_ORDER_BG_RG, "bg:rg")\
	X(LIBFONTS_SUBPIXEL_ORDER_RB_GG, "rb:gg")\
	X(LIBFONTS_SUBPIXEL_ORDER_GR_GB, "gr:gb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BB_RG, "bb:rg")\
	X(LIBFONTS_SUBPIXEL_ORDER_RB_GB, "rb:gb")\
	X(LIBFONTS_SUBPIXEL_ORDER_GR_BB, "gr:bb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BG_BR, "bg:br")\
	X(LIBFONTS_SUBPIXEL_ORDER_BB_GR, "bb:gr")\
	X(LIBFONTS_SUBPIXEL_ORDER_GB_RB, "gb:rb")\
	X(LIBFONTS_SUBPIXEL_ORDER_RG_BB, "rg:bb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BR_BG, "br:bg")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_RR_GB, "balanced rr:gb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_GR_BR, "balanced gr:br")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_BG_RR, "balanced bg:rr")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_RB_RG, "balanced rb:rg")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_RR_BG, "balanced rr:bg")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_BR_GR, "balanced br:gr")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_GB_RR, "balanced gb:rr")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_RG_RB, "balanced rg:rb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_GG_RB, "balanced gg:rb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_RG_BG, "balanced rg:bg")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_BR_GG, "balanced br:gg")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_GB_GR, "balanced gb:gr")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_GG_BR, "balanced gg:br")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_BG_RG, "balanced bg:rg")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_RB_GG, "balanced rb:gg")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_GR_GB, "balanced gr:gb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_BB_RG, "balanced bb:rg")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_RB_GB, "balanced rb:gb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_GR_BB, "balanced gr:bb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_BG_BR, "balanced bg:br")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_BB_GR, "balanced bb:gr")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_GB_RB, "balanced gb:rb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_RG_BB, "balanced rg:bb")\
	X(LIBFONTS_SUBPIXEL_ORDER_BALANCED_BR_BG, "balanced br:bg")

int
libfonts_parse_order__(enum libfonts_subpixel_order *outp, const char *value)
{
#define X(C, S)\
	if (!strcasecmp(value, S)) {\
		*outp = C;\
	} else
	LIST_SUBPIXEL_ORDERS(X) {
		*outp = LIBFONTS_SUBPIXEL_ORDER_OTHER;
		return 0;
	}
#undef X
	return 1;

}


#else


int
main(void)
{
	return 0; /* TODO add test */
}


#endif