Skip to content

Commit

Permalink
Fix compile for old fontconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
kkartaltepe committed Feb 10, 2020
1 parent a607416 commit 428d929
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions text-pango.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ static obs_properties_t *pango_source_get_properties(void *unused)

prop = obs_properties_add_bool(props, "font_from_file",
obs_module_text("Font.FromFile"));
#if FC_VERSION < 21291
// Disable this if FC is too old.
obs_property_set_visible(prop, false);
#endif
obs_property_set_modified_callback(prop,
pango_source_properties_font_from_file_changed);
obs_properties_add_path(props, "font_file",
Expand Down
2 changes: 2 additions & 0 deletions text-utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ cairo_t *create_layout_context()
static void set_font(struct pango_source *src, PangoLayout *layout) {
PangoFontDescription *desc = NULL;

#if FC_VERSION < 21291
if (src->font_from_file && src->font_file && strcmp(src->font_file, "") != 0) {
if (FcConfigAppFontAddFile(NULL, src->font_file)) {
FcFontSet *font_set = FcFontSetCreate();
Expand All @@ -44,6 +45,7 @@ static void set_font(struct pango_source *src, PangoLayout *layout) {
blog(LOG_WARNING, "[pango] Failed to load font: %s", src->font_file);
}
}
#endif

if (!desc) { // If we havnt loaded a font file, go ahead and load our font name choice.
desc = pango_font_description_new ();
Expand Down

0 comments on commit 428d929

Please sign in to comment.