Commit Graph

2374 Commits

Author SHA1 Message Date
Ben Wagner b35c72dbc7 Always run-test-conf, but skip if not built.
The test-conf test requires libjson-c to be available in order to be
built. However, there has been no user indication that additional tests
could be built if the json-c development files were available.

Continue to not build test-conf if json-c is not available, but do run
the test harness. The test harness is updated to SKIP the test if the
test-conf binary is unavailable.
2020-12-15 19:44:48 -05:00
Ben Wagner 5cd11d19df Fix wild frees and leak of fs in test-conf.
Reported by AddressSanitizer when running test-conf. The `query`,
`result`, and `result_fs` were not initialized to NULL so could result
in a wild free when first initialized.

The `method` was also not initialized to NULL so comparisons could be
made against random data if it had not yet been assigned.

The outer `fs` was never destroyed, but is also not used, so remove.
2020-12-14 12:34:21 -05:00
Ben Wagner d55eaa6b31 Fix leaks in fcxml.c, fc-match.c, and tests.
Fix leaks reported by AddressSanitizer when running 'make check'.
2020-12-14 10:54:11 +00:00
Ben Wagner c00a51f4c8 Portable trap conditions in run-test.sh.
Posix says:
    The condition can be EXIT, 0 (equivalent to EXIT), or a signal
    specified using a symbolic name, without the SIG prefix, as listed
    in the tables of signal names in the <signal.h> header defined in
    the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 13,
    Headers; for example, HUP, INT, QUIT, TERM. Implementations may
    permit names with the SIG prefix or ignore case in signal names as
    an extension.

Remove 'SIG' from trap conditions in run-test.sh for portability.
2020-12-10 14:00:40 -05:00
Szunti ac3c9ba95d Fix locale dependent behaviour in run-test.sh
'stat ... | grep Modify' fails on non english locales. stat -c '%y'
used in most of the places, but one exception remained.
2020-12-08 14:26:25 +01:00
Ben Wagner 23cede3e95 Add line between licenses in COPYING.
More clearly delineate which files are associated with each license.
2020-12-07 14:33:53 -05:00
Ben Wagner 97d5418554 Remove abort from FcCompareSize.
There doesn't appear to be a good reason to abort when 'v1' has type
FcTypeRange. If there does turn out to be a good reason for this then it
should be better documented and the code for handling this case removed.
At worst it seems -1 should be returned as it is for other unknown
types. It is possible this is left over debug code from the initial
implementation.
2020-12-07 04:21:38 +00:00
Ben Wagner 3d6926380d Skip leading whitespace in style name.
Found by Clang-Tidy. The intent seems to have been to skip all leading
whitespace in the 'style' string, but instead this loop was an odd
looking no-op. Remove the 'break' from the loop so that it will
continue until end of string or a non-space character is found.
2020-12-04 15:05:38 -05:00
Akira TAGOH 93c93689f5 Add back fullname property at scan matching phase
There seems to be a lot of config files using fullname property in the world.
To keep the backward compatibility, fullname property is back to a cache at
the scan matching phase but will be rebuilt once it is done according to family
and style property in the pattern no matter what changes one made in fullname
property during that.

Ref. https://bugzilla.redhat.com/show_bug.cgi?id=1902881
2020-12-04 18:18:03 +09:00
Akira TAGOH d06103e3e7 Bump version to 2.13.93 2020-11-28 11:38:31 +09:00
Akira TAGOH 4ac33d17c9 new-version.sh: commit meson.build when bumpping 2020-11-28 11:31:02 +09:00
Akira TAGOH 68e6ab544c Update version in meson.build to sync up with configure.ac 2020-11-28 11:19:07 +09:00
Akira TAGOH 4c2497b511 new-version.sh: update version in meson.build 2020-11-28 11:11:46 +09:00
Akira TAGOH 98764d54a7 Update README that missed changes mistakenly 2020-11-28 10:52:12 +09:00
Akira TAGOH 776d09dbaf Initialize shell variables to be sure 2020-11-28 10:46:09 +09:00
Akira TAGOH b80cd57fda Drop duplicated BUILT_SOURCES in doc/Makefile.am 2020-11-28 10:45:10 +09:00
Niklas Guertler 31edc2880e Increased timeout for meson tests to 600sec to make tests work on Darwin 2020-11-28 01:16:36 +00:00
Niklas Guertler 2584554328 Add <dir> XML tags to default values for FC_DEFAULT_FONTS on non-Darwin systems 2020-11-28 01:16:36 +00:00
Niklas Guertler bc84228a2e Allow multiple default system font directories in the fallback config, and set them to the default dirs on Darwin. 2020-11-28 01:16:36 +00:00
Akira TAGOH 3fa85f033d Add examples section in fc-match(1)
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/233
2020-11-28 09:50:09 +09:00
Chun-wei Fan 89f7bcac08 meson: Don't use .def files for Visual Studio builds
Instead, when building with Visual Studio-style compilers, define 'FcPublic' as
appropriate so that symbols will be exported without the need to maintain a
.def file.
2020-11-19 11:22:29 +08:00
Nirbheek Chauhan b2a54dfb8f meson: Fix build failure with gcc10 on mingw
We were explicitly setting c_args and c_link_args to [], which
overrode the values inherited from the env via CFLAGS and LDFLAGS.

Also add a comment for future reference.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/263
2020-11-05 04:27:55 +00:00
xiota d9c99340b1 Add Courier Std aliases. Fixes #262. 2020-11-04 12:35:51 +00:00
Akira TAGOH 1c0e7885a6 Evaluate mingw64_env to setup properly on CI 2020-11-02 14:25:01 +09:00
Akira TAGOH 8815641571 Use memcpy instead of strcpy
To work around a warning with GCC10 on Win32

warning: '__builtin___strncpy_chk' specified bound depends on the length of the source argument [-Wstringop-overflow=]
2020-11-02 14:25:01 +09:00
Ben Wagner 447b9ccc7d Fix fc_atomic_ptr_get and use.
Before this change building with ThreadSanitizer and running
test/test-pthread generated a large number of threading issues. These
mostly stemmed from fc_atomic_ptr_get not doing an atomic load and using
"acquire load" instead of "load acquire". After making these changes it
was still necessary to use fc_atomic_ptr_get where it was needed.

This also documents the current memory barrier requirements for the
atomic primitives.
2020-11-02 05:05:24 +00:00
Tim-Philipp Müller 4ee4347691 ci: allow meson mingw build to fail
Until https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/263
is resolved.
2020-10-30 15:45:57 +00:00
James Lee b368a0e380 Fix 'meson install' when cross compiling
Prevent execution of target's fc-cache on host when installing
2020-10-24 19:18:55 +11:00
Xavier Claessens abc723366d meson: Fix build failure when compiler is not in PATH
When cross compiling gcc/clang could not exist in PATH and Meson could
be using aarch64-linux-android-clang set in a cross file for example.
2020-10-03 22:07:54 -04:00
Xavier Claessens 73353b3376 meson: Use version comparison function 2020-10-03 21:33:44 -04:00
Xavier Claessens af052688d8 meson: Fix build when 'tools' option is disabled 2020-10-03 21:33:44 -04:00
Chun-wei Fan e50fbc1beb meson: Look for FreeType using CMake too
Some systems build FreeType using CMake rather than autotools (such as Visual
Studio), which will give us CMake config files rather than pkg-config files, so
if we can't find FreeType using pkg-config, try again using CMake.

Please note that according to FreeType's docs/VERSIONS.TXT, the version we want
when checking with CMake is 2.8.1 or later.
2020-10-02 11:09:08 +08:00
Akira TAGOH 74f05951e8 Update COPYING
Add missing copyright notice.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/219
2020-09-29 15:37:34 +09:00
Akira TAGOH dc1443ac83 Split up a code again coming from different copyright notice
to show up easier in COPYING.
it was originally merged from separate file by 2e2121f9 though.
2020-09-29 15:37:14 +09:00
Akira TAGOH dbef9d10de Make sure a combination of family and familylang is available 2020-09-21 14:55:21 +09:00
Akira TAGOH 5a291467a7 Add Regular style when no meta data available to guess a style
This makes sure that fullname can be constructed at least even if a style is missing
and "Regular" is omitted for fullname so this change won't affect in that case.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/259
2020-09-21 14:55:18 +09:00
Akira TAGOH dbd67ccc63 Update meson.build 2020-09-16 15:06:43 +09:00
Akira TAGOH c78e7fd6de Add fullname later once FcConfigSubstitute() is done
So user's changes in family and style will be reflected into fullname.
2020-09-16 13:40:48 +09:00
Akira TAGOH 0f9040406c Construct fullname from family and style
OpenType spec says that the Regular descriptor would generally be
omitted from fullname. but some fonts doesn't follow on it.

So decided to construct a fullname from family and style instead of
relying on the meta data in a font.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/208
2020-09-16 13:40:48 +09:00
Akira TAGOH 76f88e780a fc-scan: add --sysroot option
and fix scanning to get things work with sysroot

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/225
2020-09-15 18:17:36 +09:00
Akira TAGOH 9d419e22d6 Add CONFIGDIR to the fallback config where can be specified by --with-configdir 2020-09-15 18:14:30 +09:00
Akira TAGOH 3ae08a8601 Make more clearer the license terms
COPYING is missing non-expat license terms for some files and some files is also missing license terms. This is changes to makes it clearer and update.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/219
2020-09-03 06:25:30 +00:00
Matthias Clasen e735abcfe1 Fix a problem in FcConfigSubstitute
We were using the family names from the pattern without
copying, and this was leading to a valgrind warning:
==53167== Invalid read of size 1
==53167==    at 0x58B0238: FcStrCaseWalkerNextNonBlank (fcstr.c:198)
==53167==    by 0x58B0238: FcStrCaseWalkerNextNonBlank (fcstr.c:186)
==53167==    by 0x58B02C7: FcStrCmpIgnoreBlanksAndCase (fcstr.c:281)
==53167==    by 0x58A4D44: FcHashTableFind (fchash.c:109)
==53167==    by 0x5895E76: FamilyTableAdd (fccfg.c:1634)
==53167==    by 0x589646A: FcConfigAdd.isra.0 (fccfg.c:1823)
==53167==    by 0x58988CF: IA__FcConfigSubstituteWithPat.part.0 (fccfg.c:2228)
==53167==    by 0x55F4F1A: pango_cairo_fc_font_map_fontset_key_substitute (pangocairo-fcfontmap.c:106)
==53167==    by 0x5B88AF6: pango_fc_default_substitute (pangofc-fontmap.c:1795)
==53167==    by 0x5B88D15: pango_fc_font_map_get_patterns (pangofc-fontmap.c:1850)
==53167==    by 0x5B88FC7: pango_fc_font_map_load_fontset (pangofc-fontmap.c:1952)
==53167==    by 0x5623627: pango_font_map_load_fontset (pango-fontmap.c:161)
==53167==    by 0x5621743: pango_context_get_metrics (pango-context.c:1782)
==53167==  Address 0x150d3450 is 0 bytes inside a block of size 10 free'd
==53167==    at 0x483B9F5: free (vg_replace_malloc.c:538)
==53167==    by 0x58ABE70: FcValueListDestroy (fcpat.c:147)
==53167==    by 0x5898A08: IA__FcConfigSubstituteWithPat.part.0 (fccfg.c:2203)
==53167==    by 0x55F4F1A: pango_cairo_fc_font_map_fontset_key_substitute (pangocairo-fcfontmap.c:106)
==53167==    by 0x5B88AF6: pango_fc_default_substitute (pangofc-fontmap.c:1795)
==53167==    by 0x5B88D15: pango_fc_font_map_get_patterns (pangofc-fontmap.c:1850)
==53167==    by 0x5B88FC7: pango_fc_font_map_load_fontset (pangofc-fontmap.c:1952)
==53167==    by 0x5623627: pango_font_map_load_fontset (pango-fontmap.c:161)
==53167==    by 0x5621743: pango_context_get_metrics (pango-context.c:1782)

Use copies of the strings as keys in the hash table to avoid this.
2020-08-30 12:05:24 -04:00
Akira TAGOH 9c1946d330 Make sure a minimum version of python 2020-08-27 18:32:53 +09:00
Akira TAGOH ef28c78350 Integrate python scripts to autotools build
Recently some python scripts has been added to the build toolchain for meson build support. but we don't want to maintain multiple files for one purpose. since autotools build support will be guradually discontinued, integrating those scripts into autotools would be better.
2020-08-26 13:33:07 +00:00
Matthias Clasen ff7d314ab5 Fix up FC_LIKELY macros
__builtin_expect returns the same type as the expression,
so enforce that we pass in a boolean expression.

Pointed out by Emmanuele Bassi.
2020-08-25 18:12:07 -04:00
Matthias Clasen e117d6768c Fixup: Handle patterns without family
Pointed out by Akira Tagoh.
2020-08-25 12:15:45 -04:00
Matthias Clasen 51d40491fc Use FC_UNLIKELY 2020-08-25 12:15:45 -04:00
Matthias Clasen 76699a4813 Add FC_LIKELY and FC_UNLIKELY macros
These wrap __builtin_expect where it exists.
2020-08-25 12:15:45 -04:00
Matthias Clasen 835f9bbdbe Fixup: Promote ints to ranges when appropriate
Pointed out by Akira Tagoh.
2020-08-25 12:15:45 -04:00