From 464943e5a69ad0c94d06170ffac91b6ba3aba703 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 28 Mar 2018 12:57:28 +0800 Subject: [PATCH] gtk, demos: Fix builds without HarfBuzz and PangoFT Really exclude the portions in the gtkfontchooserwidget.c that are built when HarfBuzz and PangoFT2 are built, and update the Meson files to exclude such sources as well from the main GTK SO/DLL and from the gtk4-demo program. https://bugzilla.gnome.org/show_bug.cgi?id=773299 --- demos/gtk-demo/meson.build | 9 +++++---- gtk/gtkfontchooserwidget.c | 7 +++++++ gtk/meson.build | 6 ++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build index 432aecb51b..b6492c7b5b 100644 --- a/demos/gtk-demo/meson.build +++ b/demos/gtk-demo/meson.build @@ -76,8 +76,11 @@ demos = files([ gtkdemo_deps = [ libgtk_dep, ] +extra_demo_sources = files(['main.c', 'gtkfishbowl.c', 'fontplane.c', 'gtkgears.c']) + if harfbuzz_dep.found() and pangoft_dep.found() demos += files('font_features.c') + extra_demo_sources += files(['script-names.c', 'language-names.c']) gtkdemo_deps += [ harfbuzz_dep, ] endif @@ -97,9 +100,7 @@ gtkdemo_resources = gnome.compile_resources('gtkdemo_resources', source_dir: '.') executable('gtk4-demo', - 'main.c', 'gtkfishbowl.c', 'fontplane.c', 'script-names.c', 'language-names.c', - 'gtkgears.c', - demos, demos_h, gtkdemo_resources, + demos, demos_h, extra_demo_sources, gtkdemo_resources, c_args: gtkdemo_args, dependencies: gtkdemo_deps, include_directories: confinc, @@ -135,4 +136,4 @@ install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir) gnome.compile_schemas() # appdata -install_data('org.gtk.Demo.appdata.xml', install_dir: gtk_appdatadir) \ No newline at end of file +install_data('org.gtk.Demo.appdata.xml', install_dir: gtk_appdatadir) diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c index 907d1a3f05..e68c9ff783 100644 --- a/gtk/gtkfontchooserwidget.c +++ b/gtk/gtkfontchooserwidget.c @@ -766,7 +766,10 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass) gtk_widget_class_bind_template_callback (widget_class, size_change_cb); gtk_widget_class_bind_template_callback (widget_class, output_cb); gtk_widget_class_bind_template_callback (widget_class, selection_changed); + +#if defined(HAVE_HARFBUZZ) && defined(HAVE_PANGOFT) gtk_widget_class_bind_template_callback (widget_class, update_language); +#endif gtk_widget_class_set_css_name (widget_class, I_("fontchooser")); } @@ -896,7 +899,11 @@ gtk_font_chooser_widget_init (GtkFontChooserWidget *fontchooser) /* Load data and set initial style-dependent parameters */ gtk_font_chooser_widget_load_fonts (fontchooser, TRUE); + +#if defined(HAVE_HARFBUZZ) && defined(HAVE_PANGOFT) gtk_font_chooser_widget_populate_features (fontchooser); +#endif + gtk_font_chooser_widget_set_cell_size (fontchooser); gtk_font_chooser_widget_take_font_desc (fontchooser, NULL); } diff --git a/gtk/meson.build b/gtk/meson.build index ff57cb4b65..5dea256920 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -7,8 +7,6 @@ subdir('inspector') gtk_private_sources = files([ 'fallback-c89.c', 'fnmatch.c', - 'language-names.c', - 'script-names.c', 'gdkpixbufutils.c', 'gtkactionhelper.c', 'gtkactionmuxer.c', @@ -874,6 +872,10 @@ gtk_deps = [ if harfbuzz_dep.found() and pangoft_dep.found() gtk_deps += [ harfbuzz_dep, pangoft_dep ] + gtk_sources += files([ + 'language-names.c', + 'script-names.c', + ]) endif if x11_enabled -- 2.30.2