1 /* font-manager-gtk-utils.h
2  *
3  * Copyright (C) 2009 - 2021 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 #ifndef __FONT_MANAGER_GTK_UTILS_H__
22 #define __FONT_MANAGER_GTK_UTILS_H__
23 
24 #include <gtk/gtk.h>
25 
26 #include <pango/pango-context.h>
27 #include <pango/pango-fontmap.h>
28 #include <pango/pangofc-fontmap.h>
29 
30 #define FONT_MANAGER_BUS_ID "org.gnome.FontManager"
31 #define FONT_MANAGER_BUS_PATH "/org/gnome/FontManager"
32 #define FONT_MANAGER_FONT_VIEWER_BUS_ID "org.gnome.FontViewer"
33 #define FONT_MANAGER_FONT_VIEWER_BUS_PATH "/org/gnome/FontViewer"
34 
35 #define FONT_MANAGER_MIN_MARGIN 2
36 #define FONT_MANAGER_DEFAULT_MARGIN 6
37 
38 #define FONT_MANAGER_DEFAULT_FONT "Sans"
39 #define FONT_MANAGER_MIN_FONT_SIZE 6.0
40 #define FONT_MANAGER_MAX_FONT_SIZE 96.0
41 #define FONT_MANAGER_DEFAULT_PREVIEW_SIZE 10.0
42 #define FONT_MANAGER_CHARACTER_MAP_PREVIEW_SIZE FONT_MANAGER_DEFAULT_PREVIEW_SIZE * 1.6
43 
44 #define FONT_MANAGER_DEFAULT_PREVIEW_TEXT \
45 "    %s\n" \
46 "\n" \
47 "    ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" \
48 "    abcdefghijklmnopqrstuvwxyz\n" \
49 "    1234567890.:,;(*!?')\n" \
50 "\n" \
51 "    "
52 
53 #define FONT_MANAGER_LOREM_IPSUM \
54 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent sed " \
55 "tristique nunc. Sed augue dolor, posuere a auctor quis, dignissim sed " \
56 "est. Aliquam convallis, orci nec posuere lacinia, risus libero mattis " \
57 "velit, a consectetur orci felis venenatis neque. Praesent id lacinia m" \
58 "assa. Nam risus diam, faucibus vitae pulvinar eget, scelerisque nec ni" \
59 "sl. Integer dolor ligula, placerat id elementum id, venenatis sed mass" \
60 "a. Vestibulum at convallis libero. Curabitur at molestie justo.\n" \
61 "\n" \
62 "Mauris convallis odio rutrum elit aliquet quis fermentum velit tempus." \
63 " Ut porttitor lectus at dui iaculis in vestibulum eros tristique. Vest" \
64 "ibulum ante ipsum primis in faucibus orci luctus et ultrices posuere c" \
65 "ubilia Curae; Donec ut dui massa, at aliquet leo. Cras sagittis pulvin" \
66 "ar nunc. Fusce eget felis ut dolor blandit scelerisque non eget risus." \
67 " Nunc elementum ipsum id lacus porttitor accumsan. Suspendisse at quam" \
68 " ligula, ultrices bibendum massa.\n" \
69 "\n" \
70 "Mauris feugiat, orci non fermentum congue, libero est rutrum sem, non " \
71 "dignissim justo urna at turpis. Donec non varius augue. Fusce id enim " \
72 "ligula, sit amet mattis urna. Ut sodales augue tristique tortor lobort" \
73 "is vestibulum. Maecenas quis tortor lacus. Etiam varius hendrerit bibe" \
74 "ndum. Nullam pretium nulla in sem blandit vel facilisis felis fermentu" \
75 "m. Integer aliquet leo nec nunc sollicitudin congue. In hac habitasse " \
76 "platea dictumst. Curabitur mattis nibh ac velit euismod condimentum. P" \
77 "ellentesque volutpat, neque ac congue fermentum, turpis metus posuere " \
78 "turpis, ac facilisis velit lectus sed diam. Etiam dui diam, tempus vit" \
79 "ae fringilla quis, tincidunt ac libero.\n" \
80 "\n" \
81 "Quisque sollicitudin eros sit amet lorem semper nec imperdiet ante veh" \
82 "icula. Proin a vulputate sem. Aliquam erat volutpat. Vestibulum congue" \
83 " pulvinar eros eu vestibulum. Phasellus metus mauris, suscipit tristiq" \
84 "ue ullamcorper laoreet, viverra eget libero. Donec id nibh justo. Aliq" \
85 "uam sagittis ultricies erat. Integer sed purus felis. Pellentesque leo" \
86 " nisi, sagittis non tincidunt vitae, porta quis eros. Pellentesque ut " \
87 "ornare erat. Vivamus semper sodales suscipit. Praesent placerat eleife" \
88 "nd nibh quis tristique. Aenean ullamcorper pellentesque ultrices. Nunc" \
89 " eu risus turpis, in condimentum dui. Aliquam erat volutpat. Phasellus" \
90 " sagittis mattis diam, sit amet pharetra lacus cursus non.\n" \
91 "\n" \
92 "Vestibulum sed est id velit rhoncus imperdiet. Aliquam dictum, arcu at" \
93 " tincidunt condimentum, metus ligula molestie lorem, eget congue torto" \
94 "r est ut massa. Duis ut pulvinar nisl. Aenean sodales purus id risus h" \
95 "endrerit sit amet mattis sem blandit. Aenean feugiat dapibus mattis. P" \
96 "raesent non nibh magna. Nulla facilisi. Nam elementum malesuada sagitt" \
97 "is. Cras et tellus augue, non rhoncus libero. Suspendisse ut nulla mau" \
98 "ris.\n" \
99 "\n" \
100 "Suspendisse potenti. Nulla neque leo, condimentum nec posuere non, ele" \
101 "mentum sit amet lorem. Integer ut ante libero, a tristique quam. Nulla" \
102 " libero nibh, bibendum eget blandit non, viverra in velit. Duis sit am" \
103 "et ipsum in massa imperdiet interdum. Phasellus venenatis consequat le" \
104 "ctus eget facilisis. Quisque ullamcorper rutrum erat at egestas. Integ" \
105 "er pharetra pulvinar odio, sagittis imperdiet ligula aliquam suscipit." \
106 " Aenean rutrum convallis felis, at rhoncus lectus tincidunt et. Morbi " \
107 "mattis risus eu quam suscipit ut tempus nunc pellentesque. Ut adipisci" \
108 "ng, nibh nec pharetra fringilla, diam diam hendrerit neque, quis preti" \
109 "um tellus ligula ut dolor. Nullam dictum, libero in molestie convallis" \
110 ", nunc arcu imperdiet risus, vitae laoreet risus ipsum in ligula. Clas" \
111 "s aptent taciti sociosqu ad litora torquent per conubia nostra, per in" \
112 "ceptos himenaeos. Donec molestie, quam ut adipiscing consequat, risus " \
113 "sem facilisis nisi, ut aliquet sapien est a sapien. Quisque sed enim j" \
114 "usto, sit amet volutpat urna."
115 
116 /**
117  * FontManagerDragTargetType:
118  * @FONT_MANAGER_DRAG_TARGET_TYPE_FAMILY:           Internal drag
119  * @FONT_MANAGER_DRAG_TARGET_TYPE_COLLECTION:       Internal drag
120  * @FONT_MANAGER_DRAG_TARGET_TYPE_EXTERNAL:         External drag
121  */
122 typedef enum
123 {
124     FONT_MANAGER_DRAG_TARGET_TYPE_FAMILY,
125     FONT_MANAGER_DRAG_TARGET_TYPE_COLLECTION,
126     FONT_MANAGER_DRAG_TARGET_TYPE_EXTERNAL
127 }
128 FontManagerDragTargetType;
129 
130 GType font_manager_drag_target_type_get_type (void);
131 #define FONT_MANAGER_TYPE_DRAG_TARGET_TYPE (font_manager_drag_target_type_get_type ())
132 
133 void font_manager_set_application_style (void);
134 void font_manager_clear_pango_cache (PangoContext *ctx);
135 void font_manager_widget_set_align (GtkWidget *widget, GtkAlign align);
136 void font_manager_widget_set_expand (GtkWidget *widget, gboolean expand);
137 void font_manager_widget_set_margin (GtkWidget *widget, gint margin);
138 
139 gchar * font_manager_get_localized_pangram (void);
140 gchar * font_manager_get_localized_preview_text (void);
141 
142 void font_manager_add_keyboard_shortcut (GSimpleAction *action,
143                                          const gchar *action_name,
144                                          const gchar * const *accels);
145 
146 #endif /* __FONT_MANAGER_GTK_UTILS_H__ */
147