Debian Codegraph @

lib/json/font-manager-font.c

raw
1 /* font-manager-font.c
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 #include "font-manager-font.h"
22
23 /**
24 * SECTION: font-manager-font
25 * @short_description: Font style information
26 * @title: Font
27 * @include: font-manager-font.h
28 * @see_also: #FontManagerJsonProxy
29 *
30 * #FontManagerFont holds basic style information for a single font.
31 *
32 * The #JsonObject backing this class should have the following structure:
33 *
34 *|[
35 * {
36 * "filepath" : string,
37 * "findex" : int,
38 * "family" : string,
39 * "style" : string,
40 * "spacing" : int,
41 * "slant" : int,
42 * "weight" : int,
43 * "width" : int,
44 * "description" : string,
45 * }
46 *]|
47 */
48
49 struct _FontManagerFont
50 {
51 FontManagerJsonProxy parent;
52 };
53
54 G_DEFINE_TYPE(FontManagerFont, font_manager_font, FONT_MANAGER_TYPE_JSON_PROXY)
55
56 static void
57 font_manager_font_class_init (FontManagerFontClass *klass)
58 {
59 GObjectClass *object_class = G_OBJECT_CLASS(klass);
60 GObjectClass *parent_class = G_OBJECT_CLASS(font_manager_font_parent_class);
61 FontManagerJsonProxyClass *proxy_class = FONT_MANAGER_JSON_PROXY_CLASS(klass);
62 object_class->get_property = parent_class->get_property;
63 object_class->set_property = parent_class->set_property;
64 proxy_class->properties = FontProperties;
65 proxy_class->n_properties = G_N_ELEMENTS(FontProperties);
66 font_manager_json_proxy_install_properties(proxy_class);
67 return;
68 }
69
70 static void
71 font_manager_font_init (FontManagerFont *self)
72 {
73 g_return_if_fail(self != NULL);
74 }
75
76 /**
77 * font_manager_font_new:
78 *
79 * Returns: (transfer full): A newly created #FontManagerFont.
80 * Free the returned object using #g_object_unref().
81 */
82 FontManagerFont *
83 font_manager_font_new (void)
84 {
85 return g_object_new(FONT_MANAGER_TYPE_FONT, NULL);
86 }
87