[cairo-commit] 3 commits - meson.build NEWS src/cairo-cff-subset.c src/cairo-ft.h src/cairo-type1-subset.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 20 14:50:09 UTC 2023


 NEWS                     |    4 ++--
 meson.build              |   19 +++++++++++--------
 src/cairo-cff-subset.c   |    2 +-
 src/cairo-ft.h           |    2 +-
 src/cairo-type1-subset.c |    2 +-
 5 files changed, 16 insertions(+), 13 deletions(-)

New commits:
commit 48a446663143f8ebd25e67e9d869e40c78ba13fd
Merge: 3f732bd3d bcb793754
Author: Tim-Philipp Müller <tim at centricular.com>
Date:   Thu Jul 20 14:50:07 2023 +0000

    Merge branch 'fix-pulling-ft2-and-fc' into 'master'
    
    Don't pull in FreeType and Fontconfig on Windows and Darwin
    
    See merge request cairo/cairo!495

commit bcb7937545208514805589c468a8df6ad7ded4ba
Author: Sergey Bugaev <bugaevc at gmail.com>
Date:   Fri Jul 14 18:03:10 2023 +0300

    Consistently spell "FreeType" with capital T
    
    Signed-off-by: Sergey Bugaev <bugaevc at gmail.com>

diff --git a/NEWS b/NEWS
index 29e4a0aa0..a1fcf0d9f 100644
--- a/NEWS
+++ b/NEWS
@@ -108,7 +108,7 @@ includes implementation of core functionality, performance
 optimizations, and stabilization.
 
 Subpixel positioning support allows improved glyph outlines with the
-Freetype font backend.
+FreeType font backend.
 
 For a complete log of changes, please see
 
@@ -8223,7 +8223,7 @@ the PNG generation in the demos. These have now been resolved.
 2003-10
 =======
 Graydon Hoare <graydon at redhat.com> implemented the first real text
-support using Freetype/fontconfig, (previous versions of cairo used
+support using FreeType/fontconfig, (previous versions of cairo used
 Xft and could only draw text when using an X backend).
 
 2003-09
diff --git a/meson.build b/meson.build
index 9ec043bca..09532abe0 100644
--- a/meson.build
+++ b/meson.build
@@ -313,7 +313,7 @@ if freetype_dep.found()
   feature_conf.set('CAIRO_HAS_FT_FONT', 1)
   built_features += [{
     'name': 'cairo-ft',
-    'description': 'Freetype font backend',
+    'description': 'FreeType font backend',
     'deps': [freetype_dep],
     # cairo-ft.h includes fontconfig.h so it needs its cflags
     'compile-deps': [fontconfig_dep.partial_dependency(compile_args: true, includes: true)],
diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
index c7aaec4a8..2dc64f393 100644
--- a/src/cairo-cff-subset.c
+++ b/src/cairo-cff-subset.c
@@ -1162,7 +1162,7 @@ cairo_cff_font_read_font_metrics (cairo_cff_font_t *font, cairo_hash_table_t  *t
         if (p < end)
             p = decode_number (p, &yy);
     }
-    /* Freetype uses 1/abs(yy) to get units per EM */
+    /* FreeType uses 1/abs(yy) to get units per EM */
     font->units_per_em = _cairo_round(1.0/fabs(yy));
 }
 
diff --git a/src/cairo-ft.h b/src/cairo-ft.h
index 29c43c965..a23e0320e 100644
--- a/src/cairo-ft.h
+++ b/src/cairo-ft.h
@@ -41,7 +41,7 @@
 
 #if CAIRO_HAS_FT_FONT
 
-/* Fontconfig/Freetype platform-specific font interface */
+/* Fontconfig/FreeType platform-specific font interface */
 
 #include <ft2build.h>
 #include FT_FREETYPE_H
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index 0166f7a78..735c59e72 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -404,7 +404,7 @@ cairo_type1_font_subset_get_bbox (cairo_type1_font_subset_t *font)
     if (yy == 0.0)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
-    /* Freetype uses 1/yy to get units per EM */
+    /* FreeType uses 1/yy to get units per EM */
     font->base.units_per_em = 1.0/yy;
 
     /* If the FontMatrix is not a uniform scale the metrics we extract
commit a3a7ca452f38413f567a502b97497af0aff0128d
Author: Sergey Bugaev <bugaevc at gmail.com>
Date:   Fri Jul 14 17:29:34 2023 +0300

    meson: Don't pull in FreeType and Fontconfig by default
    
    Commit f6a3f6d8add98bf5f15d6fbdc4cd887a0936b531
    "Don't build fontconfig on Windows" made an attempt to prevent Meson
    from automatically building Fontconfig as a subproject on Windows when
    the 'fontconfig' option has its default value of 'auto'.
    
    Unfortunately, this only made things worse instead of fixing them.
    
    Meson feature options can have three states: 'enabled', 'auto', and
    'disabled'. They are primarily intended to be used as a value for the
    'required' option of the 'dependency()' function. When the system
    dependency is not found, but a fallback subproject is provided
    explicitly with the 'fallback' option, a feature option in the 'auto'
    state still causes the subproject to get built.
    
    Since there's no apparent way to produce a value of the "feature option
    object" type in a specific state, commit f6a3f6d8add98bf5f15d6f instead
    set fontconfig_option = false (when it wasn't set to 'enabled', i.e. it
    was either 'auto' or 'disabled') in an attempt to disable building the
    subproject. However, a boolean value of false is equivalent to 'auto',
    not to 'disabled'. This is documented at
    https://mesonbuild.com/Build-options.html#features
    
    So commit f6a3f6d8add98bf5f15d6fbdc4cd887a0936b531 wanted to convert
    'auto' to 'disabled', but instead effectively converted 'disabled' to
    'auto', causing the Fontconfig subproject to be always built on Windows,
    even when explicitly turned off with -D fontconfig=disabled.
    
    A way to accomplish the original goal is available since Meson 0.59;
    feature option objects gained the '.disable_auto_if()' method that
    exactly converts 'auto' to 'disabled' if the boolean condition is true.
    So make use of this method to properly turn off building Fontconfig on
    Windows, unless explicitly enabled with -D fontconfig=enabled.
    
    Apply the same for FreeType, which is also not very useful on Windows.
    
    See also: https://gitlab.gnome.org/GNOME/pango/-/commit/7f8135bfeb83a4f4c3e25115c2942c701b884c36
    
    Signed-off-by: Sergey Bugaev <bugaevc at gmail.com>

diff --git a/meson.build b/meson.build
index c4fcd675b..9ec043bca 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
 project('cairo', 'c', 'cpp',
-  meson_version: '>= 0.56.0',
+  meson_version: '>= 0.59.0',
   version: run_command(find_program('version.py'), check: true).stdout().strip(),
   default_options: ['warning_level=2'],
 )
@@ -263,12 +263,10 @@ if png_dep.found()
   endif
 endif
 
-# Don't build fontconfig as a subproject on Windows unless
-# explicitly requested
+# Disable fontconfig by default on platforms where it is optional
 fontconfig_option = get_option('fontconfig')
-if host_machine.system() == 'windows' and not fontconfig_option.enabled()
-  fontconfig_option = false
-endif
+fontconfig_required = host_machine.system() not in ['windows', 'darwin']
+fontconfig_option = fontconfig_option.disable_auto_if(not fontconfig_required)
 
 fontconfig_dep = dependency('fontconfig',
   required: fontconfig_option,
@@ -301,8 +299,13 @@ endif
 
 ttx = find_program('ttx', required: false)
 
+# Disable FreeType by default on platforms where it is optional
+freetype_option = get_option('freetype')
+freetype_required = host_machine.system() not in ['windows', 'darwin']
+freetype_option = freetype_option.disable_auto_if(not freetype_required)
+
 freetype_dep = dependency('freetype2',
-  required: get_option('freetype'),
+  required: freetype_option,
   version: freetype_required_version,
   fallback: ['freetype2', 'freetype_dep'],
 )


More information about the cairo-commit mailing list