Skip to content

Commit fa8cbee

Browse files
committed
- Workaround missing disabled fonts - Closes #446
1 parent 62d50da commit fa8cbee

18 files changed

+174
-54
lines changed
Lines changed: 3 additions & 0 deletions
Loading

build-aux/ui/gen_ui_resources.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@
3333

3434
'actions' : [
3535
'action-unavailable-symbolic.svg',
36+
'application-preferences-symbolic.svg',
3637
'document-edit-symbolic.svg',
3738
'edit-clear-symbolic.svg',
3839
'edit-clear-symbolic-rtl.svg',
3940
'edit-find-symbolic.svg',
4041
'edit-select-all-symbolic.svg',
41-
'edit-undo-symbolic-rtl.svg',
4242
'edit-undo-symbolic.svg',
43+
'edit-undo-symbolic-rtl.svg',
4344
'format-justify-center-symbolic.svg',
4445
'format-justify-fill-symbolic.svg',
4546
'format-justify-left-symbolic.svg',
@@ -48,6 +49,7 @@
4849
'go-previous-symbolic.svg',
4950
'list-add-symbolic.svg',
5051
'list-drag-handle-symbolic.svg',
52+
'list-remove-all-symbolic.svg',
5153
'list-remove-symbolic.svg',
5254
'open-menu-symbolic.svg',
5355
'panel-right-symbolic.svg',
@@ -82,7 +84,8 @@
8284
'dialog-question-symbolic.svg',
8385
'folder-open-symbolic.svg',
8486
'network-error-symbolic.svg',
85-
'network-offline-symbolic.svg'
87+
'network-offline-symbolic.svg',
88+
'google-fonts-symbolic.svg'
8689
]
8790

8891
}
Lines changed: 8 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

fedora/font-manager.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
Name: font-manager
1717
Version: %{MajorVersion}.%{MinorVersion}.%{PatchVersion}.%{build_timestamp}
18-
Release: 3
18+
Release: 4
1919
Summary: A simple font management application for Gtk+ Desktop Environments
2020
License: GPLv3+
2121
Url: http://fontmanager.github.io/
@@ -198,5 +198,5 @@ appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*.metain
198198
%endif
199199

200200
%changelog
201-
* Wed Mar 5 2025 JerryCasiano <[email protected]> 0.9.4-3
201+
* Wed Mar 5 2025 JerryCasiano <[email protected]> 0.9.4-4
202202
- Refer to https://github.com/FontManager/font-manager/commits/master for changes.

lib/fontconfig/font-manager-fontconfig.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,37 @@ font_manager_list_available_font_families (void)
200200
return result;
201201
}
202202

203+
/**
204+
* font_manager_get_files_for_family:
205+
*
206+
* Returns: (transfer full) (nullable):
207+
* a newly created #FontManagerStringSet containing filepaths or %NULL.
208+
* Free the returned object using #g_object_unref
209+
*/
210+
FontManagerStringSet *
211+
font_manager_get_files_for_family (const char *family)
212+
{
213+
g_return_val_if_fail(family != NULL, NULL);
214+
FcPattern *pattern = FcPatternBuild (NULL, FC_FAMILY, FcTypeString, family, NULL);
215+
FcObjectSet *objectset = FcObjectSetBuild(FC_FAMILY, FC_FILE, NULL);
216+
FcFontSet *fontset = FcFontList(FcConfigGetCurrent(), pattern, objectset);
217+
218+
FontManagerStringSet * result = font_manager_string_set_new();
219+
220+
for (int i = 0; i < fontset->nfont; i++) {
221+
FcChar8 *file;
222+
if (FcPatternGetString(fontset->fonts[i], FC_FILE, 0, &file) == FcResultMatch) {
223+
font_manager_string_set_add(result, (const char *) file);
224+
}
225+
}
226+
227+
FcObjectSetDestroy(objectset);
228+
FcPatternDestroy(pattern);
229+
FcFontSetDestroy(fontset);
230+
font_manager_string_set_sort(result);
231+
return result;
232+
}
233+
203234
/**
204235
* font_manager_get_available_fonts:
205236
* @family_name: (nullable): family name or %NULL

lib/fontconfig/font-manager-fontconfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ gboolean font_manager_add_application_font (const gchar *filepath);
5656
gboolean font_manager_add_application_font_directory (const gchar *dir);
5757
gboolean font_manager_update_font_configuration (void);
5858
GList * font_manager_list_available_font_files (void);
59+
FontManagerStringSet * font_manager_get_files_for_family (const char *family);
5960
FontManagerStringSet * font_manager_list_available_font_families (void);
6061
GList * font_manager_get_langs_from_fontconfig_pattern (FcPattern *pattern);
6162
JsonObject * font_manager_get_attributes_from_filepath (const gchar *filepath, GError **error);

lib/ui/gresources.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<gresource prefix="/com/github/FontManager/FontManager">
44
<file preprocess="xml-stripblanks" compressed="true">icons/symbolic/apps/com.github.FontManager.FontManager-symbolic.svg</file>
55
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/apps/preferences-desktop-locale-symbolic.svg</file>
6-
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/application-preferences-symbolic.svg</file>
76
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/action-unavailable-symbolic.svg</file>
7+
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/application-preferences-symbolic.svg</file>
88
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/document-edit-symbolic.svg</file>
99
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/edit-clear-symbolic.svg</file>
1010
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/edit-clear-symbolic-rtl.svg</file>
1111
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/edit-find-symbolic.svg</file>
1212
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/edit-select-all-symbolic.svg</file>
13-
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/edit-undo-symbolic-rtl.svg</file>
1413
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/edit-undo-symbolic.svg</file>
14+
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/edit-undo-symbolic-rtl.svg</file>
1515
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/format-justify-center-symbolic.svg</file>
1616
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/format-justify-fill-symbolic.svg</file>
1717
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/format-justify-left-symbolic.svg</file>
@@ -20,8 +20,8 @@
2020
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/go-previous-symbolic.svg</file>
2121
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/list-add-symbolic.svg</file>
2222
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/list-drag-handle-symbolic.svg</file>
23-
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/list-remove-symbolic.svg</file>
2423
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/list-remove-all-symbolic.svg</file>
24+
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/list-remove-symbolic.svg</file>
2525
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/open-menu-symbolic.svg</file>
2626
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/panel-right-symbolic.svg</file>
2727
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/actions/panel-right-symbolic-rtl.svg</file>
@@ -44,6 +44,7 @@
4444
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/status/folder-open-symbolic.svg</file>
4545
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/status/network-error-symbolic.svg</file>
4646
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/status/network-offline-symbolic.svg</file>
47+
<file preprocess="xml-stripblanks" compressed="true">icons/scalable/status/google-fonts-symbolic.svg</file>
4748
</gresource>
4849
<gresource prefix="/com/github/FontManager/FontManager/ui">
4950
<file compressed="true">FontManager.css</file>
Lines changed: 8 additions & 0 deletions
Loading

src/font-manager/Application.vala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ namespace FontManager {
139139
reload();
140140
} else {
141141
update_font_configuration();
142-
load_user_font_resources();
143142
available_fonts = get_sorted_font_list(null);
144143
db.update_started.connect(() => { hold(); });
145144
db.update_complete.connect(() => { GLib.stdout.printf("\n"); release(); });
@@ -169,10 +168,7 @@ namespace FontManager {
169168
}
170169

171170
public string list_full () throws GLib.DBusError, GLib.IOError {
172-
update_font_configuration();
173-
load_user_font_resources();
174-
Json.Object _fonts = get_available_fonts(null);
175-
Json.Array sorted_fonts = sort_json_font_listing(_fonts);
171+
Json.Array sorted_fonts = get_sorted_font_list(null);
176172
return print_json_array(sorted_fonts, true);
177173
}
178174

0 commit comments

Comments
 (0)