1-- font hint translation tables
2local hint_lut = {
3	none = 0,
4	mono = 1,
5	light = 2,
6	normal = 3,
7	subpixel = 4 -- need to specify +1 in the case of rotated display
8};
9local hint_rlut = {};
10for k,v in pairs(hint_lut) do
11	hint_rlut[v] = k;
12end
13
14system_load("menus/global/schemes.lua")();
15
16local durden_font = {
17	{
18		name = "size",
19		label = "Size",
20		kind = "value",
21		description = "Change the default UI font pt size",
22		validator = gen_valid_num(1, 100),
23		initial = function() return tostring(gconfig_get("font_sz")); end,
24		handler = function(ctx, val)
25			gconfig_set("font_sz", tonumber(val));
26		end
27	},
28	{
29		name = "hinting",
30		label = "Hinting",
31		kind = "value",
32		description = "Change anti-aliasing hinting algorithm",
33		set = {"none", "mono", "light", "normal", "subpixel"},
34		initial = function() return hint_lut[gconfig_get("font_hint")]; end,
35		handler = function(ctx, val)
36			gconfig_set("font_hint", hint_lut[val]);
37		end
38	},
39	{
40		name = "name",
41		label = "Font",
42		kind = "value",
43		description = "Set the default font used for UI elements",
44		set = function()
45			local set = glob_resource("*", SYS_FONT_RESOURCE);
46			set = set ~= nil and set or {};
47			return set;
48		end,
49		initial = function() return gconfig_get("font_def"); end,
50		handler = function(ctx, val)
51			gconfig_set("font_def", val);
52		end
53	},
54	{
55		name = "fbfont",
56		label = "Fallback",
57		kind = "value",
58		description = "Set the fallback font used for missing glyphs (emoji, symbols)",
59		set = function()
60			local set = glob_resource("*", SYS_FONT_RESOURCE);
61			set = set ~= nil and set or {};
62			return set;
63		end,
64		initial = function() return gconfig_get("font_fb"); end,
65		handler = function(ctx, val)
66			gconfig_set("font_fb", val);
67		end
68	}
69};
70
71return {
72-- thickness is dependent on area, make sure the labels and
73-- constraints update dynamically
74	{
75		name = "font",
76		label = "Font",
77		kind = "action",
78		submenu = true,
79		description = "Generic UI font settings",
80		handler = durden_font
81	},
82	{
83		name = "bars",
84		label = "Bars",
85		kind = "action",
86		submenu = true,
87		description = "Controls/Settings for titlebars, statusbar and launch bar",
88		handler = system_load("menus/global/bars.lua")();
89	},
90	{
91		name = "border",
92		label = "Border",
93		kind = "action",
94		submenu = true,
95		description = "Global window border style and settings",
96		handler = system_load("menus/global/border.lua")();
97	},
98	{
99		name = "shadow",
100		label = "Shadow",
101		kind = "action",
102		submenu = true,
103		description = "Global window and UI element shadow settings",
104		handler = system_load("menus/global/shadow.lua")();
105	},
106	{
107		name = "shaders",
108		label = "Shaders",
109		kind = "action",
110		submenu = true,
111		description = "Control/Tune GPU- accelerated UI and display effects",
112		handler = system_load("menus/global/shaders.lua")();
113	},
114	{
115		name = "animations",
116		label = "Animations",
117		kind = "action",
118		submenu = true,
119		description = "Control animation speed and effect",
120		handler = system_load("menus/global/animations.lua")();
121	},
122	{
123		name = "mouse_scale",
124		label = "Mouse Scale",
125		kind = "value",
126		hint = "(0.1 .. 10.0)",
127		description = "Change the base scale factor used for the mouse cursor",
128		initial = function() return tostring(gconfig_get("mouse_scalef")); end,
129		handler = function(ctx, val)
130			gconfig_set("mouse_scalef", tonumber(val));
131			display_cycle_active(true);
132		end
133	},
134	{
135		name = "colors",
136		label = "Colors",
137		description = "Special colors that are not shader- defined or decorations",
138		kind = "action",
139		submenu = true,
140		handler = system_load("menus/global/colors.lua")
141	},
142	{
143		name = "menu_helper",
144		label = "Menu Descriptions",
145		description = "Set if this helper text should be shown or not",
146		kind = "value",
147		set = {LBL_YES, LBL_NO, LBL_FLIP},
148		initial = function()
149			return gconfig_get("menu_helper") and LBL_YES or LBL_NO;
150		end,
151		handler = suppl_flip_handler("menu_helper")
152	}
153};
154