Debian Codegraph @

lib/fontconfig/font-manager-font-properties.h

raw
1 /* font-manager-properties.h
2 *
3 * Copyright (C) 2009-2023 Jerry Casiano
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program.
17 *
18 * If not, see <http://www.gnu.org/licenses/gpl-3.0.txt>.
19 */
20
21 #pragma once
22
23 #include <locale.h>
24 #include <stdlib.h>
25 #include <gio/gio.h>
26 #include <glib.h>
27 #include <glib-object.h>
28 #include <fontconfig/fontconfig.h>
29 #include <libxml/tree.h>
30
31 #include "font-manager-fontconfig.h"
32 #include "font-manager-utils.h"
33 #include "font-manager-xml-writer.h"
34
35 static const FontManagerObjectProperty PROPERTIES [] =
36 {
37 { "RESERVED", G_TYPE_RESERVED_GLIB_FIRST, NULL },
38 { "hintstyle", G_TYPE_INT, "Fontconfig hintstyle" },
39 { "antialias", G_TYPE_BOOLEAN, "Whether to use anti-aliasing or not" },
40 { "hinting", G_TYPE_BOOLEAN, "Whether to use hinting or not" },
41 { "autohint", G_TYPE_BOOLEAN, "Whether to use autohinting or not" },
42 { "embeddedbitmap", G_TYPE_BOOLEAN, "Whether to use embedded bitmaps or not" },
43 { "less", G_TYPE_DOUBLE, "Lower size limit" },
44 { "more", G_TYPE_DOUBLE, "Upper size limit" },
45 { "rgba", G_TYPE_INT, "Fontconfig RGBA" },
46 { "lcdfilter", G_TYPE_INT, "Fontconfig LCD filter" },
47 { "scale", G_TYPE_DOUBLE, "Scale factor" },
48 { "dpi", G_TYPE_DOUBLE, "Screen DPI" },
49 { "config-dir", G_TYPE_STRING, "Fontconfig configuration directory" },
50 { "target-file", G_TYPE_STRING, "Name of fontconfig configuration file" },
51 { "type", G_TYPE_INT, "FontManagerFontPropertiesType" }
52 };
53
54 #define FONT_MANAGER_TYPE_FONT_PROPERTIES (font_manager_font_properties_get_type())
55 G_DECLARE_DERIVABLE_TYPE(FontManagerFontProperties, font_manager_font_properties, FONT_MANAGER, FONT_PROPERTIES, GObject)
56
57 /**
58 * FontManagerFontPropertiesClass:
59 * @load: load configuration from file
60 * @save: save configuration to file
61 * @parse_test_node: parse a fontconfig test node
62 * @parse_edit_node: parse a fontconfig edit node
63 * @add_match_criteria: add additional test elements
64 */
65 struct _FontManagerFontPropertiesClass
66 {
67 GObjectClass parent_class;
68
69 gboolean (* load) (FontManagerFontProperties *self);
70 gboolean (* save) (FontManagerFontProperties *self);
71
72 void (* parse_test_node) (FontManagerFontProperties *self, xmlNode *test_node);
73 void (* parse_edit_node) (FontManagerFontProperties *self, xmlNode *edit_node);
74 void (* add_match_criteria) (FontManagerFontProperties *self, FontManagerXmlWriter *writer);
75 };
76
77 /**
78 * FontManagerFontPropertiesType:
79 * @FONT_MANAGER_FONT_PROPERTIES_TYPE_DEFAULT: Fontconfig font properties
80 * @FONT_MANAGER_FONT_PROPERTIES_TYPE_DISPLAY: Fontconfig display properties
81 */
82 typedef enum
83 {
84 FONT_MANAGER_FONT_PROPERTIES_TYPE_DEFAULT,
85 FONT_MANAGER_FONT_PROPERTIES_TYPE_DISPLAY
86 }
87 FontManagerFontPropertiesType;
88
89 GType font_manager_font_properties_type_get_type (void);
90 #define FONT_MANAGER_TYPE_PROPERTIES_TYPE (font_manager_font_properties_type_get_type ())
91
92 FontManagerFontProperties * font_manager_font_properties_new (void);
93 gboolean font_manager_font_properties_load (FontManagerFontProperties *self);
94 gboolean font_manager_font_properties_save (FontManagerFontProperties *self);
95 gboolean font_manager_font_properties_discard (FontManagerFontProperties *self);
96 gchar * font_manager_font_properties_get_filepath (FontManagerFontProperties *self);
97 void font_manager_font_properties_reset (FontManagerFontProperties *self);
98