Commit Graph

2345 Commits

Author SHA1 Message Date
Akira TAGOH 10c7390e35 Fix missing <dir> element for WINDOWSFONTDIR in meson
also refactoring logic around it to reduce the redundant

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/276
2021-03-03 22:16:56 +09:00
Heiko Becker 4e42925096 Handle absolute sysconfdir when installing symlinks
sysconfdir defaults to /etc when the prefix is set to /usr. But joining
MESON_INSTALL_DESTDIR_PREFIX and sysconfdir when the latter is an
absoulte path, results in sysconfdir only. Which might lead to an error
during install because /etc/fonts/conf.d/ might already exist from an
pre-existing fontconfig installation.
2021-03-03 04:54:33 +00:00
Akira TAGOH 615e2cb844 Overwrite symlinks for config files
In Makefile, we are trying to remove old symlinks first and then create a symlink.
do the same thing in meson too.

Also, the line of the exception handling for FileExistsError is meaningless
as the above line is taking care of it instead and we shouldn't ignore it if
os.remove and os.symlink doesn't work somehow.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/275
2021-03-02 19:41:44 +09:00
Tim-Philipp Müller dba3287bf5 meson: fix subproject build regression
commit ae9ac2a1 from !165 introduced a regression when
fontconfig is built as a subproject. In that case we
would fail to correctly construct the path to the root
build dir where the meson-info subdirectory resides,
instead looking for it in the fontconfig subproject
subdir. This would result in
FAILED: subprojects/fontconfig/src/fcobjshash.gperf
errors in the cutout.py script.

Instead use the @BUILD_ROOT@ substitution to get
to the build root which will work correctly in
either scenario.
2021-02-18 11:26:26 +00:00
Ben Wagner ba15d41bdc Fix stack use after scope in FcConfigCompareValue
Discovered by AddressSanitizer. When left_o and right_o are promoted the
promoted values are placed on the stack in FcValuePromotionBuffer.
The FcValuePromotionBuffers must then continue to be in scope while
left_o and right_o point into their content. In 9d4e5d0f the
FcValuePromotionBuffers were moved into the incorrect scope, leaving
left_o and right_o pointing into an object whose lifetime has ended.
This is similar to left and right which appear to have a smaller scope
but are actually required to be in the larger scope.

Correct this by moving the FcValuePromotionBuffers to the proper scope.
Leave the left and right FcValues where they are since they are in the
correct scope already.

This also adds to test-conf the ability to create charset, langset,
range, and matrix in patterns. This allows for a simple test which fails
under AddressSanitizer before this change and passes after.
2021-02-16 11:30:32 -05:00
Tim-Philipp Müller ae9ac2a1bf meson: fix cross-compilation issues with gperf header file preprocessing
Pass c_args to the compiler when preprocessing the gperf header file,
they might contain important bits without which compilation/preprocessing
might fail (e.g. with clang on Android). cc.cmd_array() does not include
the c_args and we can't easily look them up from the meson.build file, so
we have to retrieve from the introspection info.

This is basically the Meson equivalent to commit 57103773.
2021-02-15 12:53:32 +00:00
Xavier Claessens 7bfbaecf81 Windows: Fix symlink privilege error detection
The message is in e.args[1] and not e.args[0] at least with python 3.8.
Should be more future proof like this in case it change again.
2021-02-15 11:58:52 +00:00
Carmina16 401d521c1f ie.orth: Corrected; mistaken source replaced 2021-01-30 10:21:33 +00:00
Xavier Claessens b58f2798e2 Meson: Do not wrap fccache insallation script
When passing fccache executable directly Meson does special tricks such
as modifying $PATH on Windows.

See: https://github.com/mesonbuild/meson/pull/8259

Fixes: #260
2021-01-28 05:12:06 +00:00
Xavier Claessens 58c6633d6c Meson: Fallback to gperf subproject on all platforms
With Meson 0.56 when find_program() does not find it on the system it
automatically checks if a .wrap provides it and configure the
subproject.
2021-01-26 08:58:12 -05:00
Szunti 23e46d13c5 Fix stripping whitespace from end of family in FcPatternAddFullname 2021-01-20 16:13:18 +01:00
Tim-Philipp Müller 4b142e9241 meson: error out in script if gperf preprocessing failed 2021-01-15 11:34:43 +00:00
Jacko Dirks b7e4931582 fccfg.c: lock_config: Fix potential memory leak
We would malloc for every try, never cleaning up.
2021-01-13 14:25:59 +01:00
Tim-Philipp Müller 643c3f1e27 ci: add meson android aarch64 build
Passing -Wno-pointer-bool-conversion in cross file
to suppress compiler warning:

src/fcfreetype.c:1373:11: address of array 'os2->achVendID' will always evaluate to 'true'
2021-01-08 11:39:25 +00:00
Tim-Philipp Müller 8657c081e9 fcformat: fix compiler warnings with clang on Android
fcformat.c:762:44: warning: expression which evaluates to zero treated as a null pointer constant of type 'FcChar8 *' (aka 'unsigned char *') [-Wnon-literal-null-conversion]
                if (!FcNameUnparseValue (buf, &l->value, '\0'))
                                                         ^~~~
fcformat.c:769:38: warning: expression which evaluates to zero treated as a null pointer constant of type 'FcChar8 *' (aka 'unsigned char *') [-Wnon-literal-null-conversion]
            FcNameUnparseValueList (buf, l, '\0');
                                            ^~~~
2021-01-08 11:39:25 +00:00
Ben Wagner bd7123ac41 Clean up test-family-matching test.
Correct the type of TestMatchPattern's 'ret' from TestResult to
TestMatchResult to match the actual return type (and values assigned to
it).

Fix leak of TestMatchPattern's 'xml' and TestFamily's 'pat'.

Simplify TestMatchPattern cleanup and ensure cleanup always happens.
2021-01-07 07:03:42 +00:00
Tim-Philipp Müller e2c6b620b3 meson: remove unused stdin_wrapper.py script
Not needed any more. Used to be used with fc-case and fc-lang,
but those have since been rewritten in python.
2021-01-07 06:33:20 +00:00
Ben Wagner b1e1a87512 Test all not_eq for family names.
Any early out checks must give the same answer as FcConfigCompareValue.
An accelerator was added for family names which treated all ops as if
they were FcOpEqual, giving the wrong answer for other non-equivalent ops
(for example FcOpContains or FcOpNotEqual).

This adds a test which passes before the accelerator was introduced,
fails after, and will pass again after !142 lands. This tests the all
not_eq case.
2020-12-28 11:01:38 -05:00
ratijas d243bb3f88 Fix closing tag bracket typo in doc/fontconfig-user.sgml 2020-12-17 06:03:40 +00:00
Szunti df29933e1a Check qual and compare for family tests
Fixes #267. Hash table lookups assumed qual="any" compare="eq".
Add a test too.
2020-12-17 04:51:20 +00:00
Ben Wagner 921ede9f46 Fix test-conf string to integer conversion.
The test-conf build_pattern attempted to convert known constant strings
into integer values. However, it did so by always converting the string
value to an integer if possible and then complaining if the key wasn't
of the expected type. This lead to error messages on "style": "Regular"
since "Regular" was recognized as "weight".

Instead, only attempt conversion from string to integer if the key is
the name of an object which can take an integer type. This eliminates
the spurious non-fatal errors reported when parsing
test-90-synthetic.json.

This also fixes an issue where the created value was given the type of
the object found, but the integer field was assigned. Instead, check
that the object type can take an integer and always set the value type
to integer.
2020-12-16 10:16:40 -05:00
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