Commit Graph

2413 Commits

Author SHA1 Message Date
Tim-Philipp Müller 6ae5623674 meson: add 'cache-dir' option
Fixes #244
2022-07-02 19:01:18 +01:00
Tim-Philipp Müller 66fa47c6f1 meson: add 'additional-fonts-dirs' option
Fixes #244
2022-07-02 19:01:17 +01:00
Tim-Philipp Müller 0d8d75e559 meson: add 'default-fonts-dirs' option
Fixes #244
2022-07-02 19:01:03 +01:00
Tim-Philipp Müller 56a2487924 meson: add 'default-hinting' option
Fixes #244
2022-07-02 19:00:41 +01:00
Jeremy Huddleston Sequoia fd0753af88 meson: Use fc_configdir where appropriate during build
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2022-06-20 14:53:51 -07:00
Jeremy Huddleston Sequoia db55c4b15e meson: Use fc_templatedir and fc_baseconfigdir are used when installing configs
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2022-06-20 14:45:28 -07:00
Jeremy Huddleston Sequoia 1bc38359d1 meson: Fix linking libexpat on darwin
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2022-06-20 00:39:25 -07:00
Alan Coopersmith d863f67789 Bump the cache version to 8 in doc/fontconfig-user.sgml
Makes docs match code changes from commit 5d84745e72

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-04-12 04:13:05 +00:00
Sam James aa681148a7 configure.ac: allow disabling docbook
Sometimes we might want to build docs (install man pages, etc)
but allow disabling use of docbook.

Bug: https://bugs.gentoo.org/310157
Signed-off-by: Sam James <sam@gentoo.org>
2022-04-12 03:59:02 +00:00
Taylor R Campbell 7dfde9b736 Avoid misuse of ctype(3)
The ctype(3) functions take arguments of type int that are either

(a) EOF, or
(b) unsigned char values, {0, 1, 2, ..., 255} if char is 8-bit.

Passing values of type char, on platforms where it is signed, can go
wrong -- negative values may be confused with EOF (typically -1) or
may lead to undefined behaviour ranging in practice from returning
garbage data (possibly out of an adjacent buffer in memory that may
contain secrets) to crashing with SIGSEGV (if the page preceding the
ctype table is unmapped).

The ctype(3) functions can't themselves convert to unsigned char
because then they would give the wrong answers for EOF, for use with
functions like getchar and fgetc; the user has to cast char to
unsigned char.
2022-04-11 12:27:04 +00:00
Akira TAGOH cf38c54a93 Use the latest stable release image for CI for mingw
CI sometimes fails. we want to avoid environment specific issues on our
CI.
2022-04-11 21:18:01 +09:00
Akira TAGOH 911b19f19f Bump version to 2.14.0 2022-03-31 16:26:11 +09:00
Alan Coopersmith d485760bbe Update address for reporting msgid bugs from bugzilla to gitlab
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-02-19 13:06:27 -08:00
Akira TAGOH d37f97223a Bump version to 2.13.96 2022-02-04 17:19:27 +09:00
Akira TAGOH f07b4cd547 Merge branch 'main' of ssh://gitlab.freedesktop.org/fontconfig/fontconfig 2022-02-04 17:18:10 +09:00
Akira TAGOH 5f96d62fbf Add a missing file 48-spacing.conf
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/310
2022-02-04 13:55:53 +09:00
Akira TAGOH 53fa8a3801 Bump version to 2.13.95 2022-02-01 14:25:45 +09:00
Akira TAGOH 875878efb7 Fix possible memory leaks in FcPatternObjectAddWithBinding
Reported by Ruth Ivimey-Cook

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/302
2022-01-31 19:03:29 +09:00
Francesco Pretto 16bbb5340b WIN32: Fix pGetSystemWindowsDirectory found initialized during FcConfigParseAndLoadFromMemory
Trying to early loading a custom fonts.xml created on the
fly results in the pGetSystemWindowsDirectory function
pointer being found intialized. Normally the initialization
is performed in the default configuration loading.
The commit factorizes the lazy initialization of both
WIN32 getters (together with pSHGetFolderPathA) in a
function and call it when actually needed.
2022-01-31 07:52:09 +00:00
Akira TAGOH 8a150f634f Add test/wrapper-script.sh to the archive
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/307
2022-01-28 18:13:21 +09:00
Akira TAGOH 55eb1ef89b Add an user font directory for Win32 to the default font path
Patch from @takase1121

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/144
2022-01-17 16:19:22 +09:00
Pierre Ducroquet 9a6ad6f1c5 Always add the family name from spacing=100 2022-01-13 11:34:25 +01:00
Pierre Ducroquet 686739af91 It seems this qual doesn't work on integers 2022-01-13 11:34:25 +01:00
Pierre Ducroquet a2687b91d7 Remove configuration file from POTFILES
This failed the CI for reasons unknown to me, and I don't see
the point in translating these files.
2022-01-13 11:34:25 +01:00
Pierre Ducroquet f084aca5cf Reference the new configuration file 2022-01-13 11:34:25 +01:00
Pierre Ducroquet 3fcdd60a1d Add a configuration to switch to monospace if spacing=100 is requested
Previously, requesting a monospace font with an invalid font family
(for instance, when a font is not embedded in a PDF, poppler may
issue such queries), the font family would be filled by configuration
file 49-sansserrif.conf with sans-serif
This new rule set the family to monospace if spacing=100 is specified
in the query.
2022-01-13 11:34:25 +01:00
Nirbheek Chauhan 7b09c81dab meson: Remove summary() from version_compare() block
The version_compare() block is redundant because we require meson 0.56
now, and it fixes a spurious warning:

```
fontconfig| WARNING: Project targeting '>= 0.53' but tried to use feature introduced in '0.54.0': list_sep arg in summary.
```
2022-01-09 17:04:25 +05:30
Akira TAGOH e474b380ff Update CaseFolding.txt to Unicode 14 2021-12-21 20:42:44 +09:00
Akira TAGOH 9a6b1d6b6d Add more description for fc-conflist.1 and FcConfigFileInfoIterInit.3
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/299
2021-12-21 19:51:12 +09:00
Akira TAGOH 4238402f1c Initialize variable 2021-12-09 20:29:06 +09:00
Akira TAGOH 3196e1815e Apply the change made by 23e46d1 again
Regression by d62d984e2b
2021-12-09 20:28:16 +09:00
Akira TAGOH 92fbf14b0d Fix the issue fail to obtain the style name
The number of a couple of 'family' and 'familylang' and 'style' and 'stylelang'
is different. need to reset the counter to get the property regarding to regarding to the lang.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/303
2021-12-09 20:26:10 +09:00
Ben Wagner ce00010b1f Actually skip leading spaces in style name
Because the loop body is just 'break' the loop never loops and at most
one leading space is skipped. Remove the body to allow the loop to
continue. Found with ClangTidy.
2021-12-06 16:55:12 -05:00
Ben Wagner 8d3425b8b8 Back FcSerialize with open addressing hash table.
Instead of fixed number of buckets with chaining use an open addressing
hash table with linear probing, max load factor 0.75, and a power of two
number of buckets.
2021-11-16 15:48:56 -05:00
Ryan Gonzalez be453bd159 Ensure config.h is always included before stdlib headers
In particular, if an stdlib header goes first, it includes features.h
which only checks _FILE_OFFSET_BITS *once*, meaning that these files end
up compiled *without* _FILE_OFFSET_BITS taking effect, which affects
fcxml's operations in listing directories.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2021-11-10 19:41:50 -06:00
Akira TAGOH 5841bd012d Fix some testcase fails for 14c265a1
Add an extra code to ignore an error of FT_Get_MM_Var()
only when FT_MM_Var variable isn't used in any case.
2021-11-09 20:42:52 +09:00
Behdad Esfahbod 14c265a10a If a varfont has 'opsz' axis, set FC_SIZE on default instant pattern
Otherwise default-instance pattern would match as an "all sizes",
which would be wrong. See:

https://gitlab.gnome.org/GNOME/pango/-/issues/621#note_1305844
2021-11-09 20:04:52 +09:00
Akira TAGOH ad70d78597 conf.d/60-latin.conf: Make Noto default. 2021-11-08 20:15:29 +09:00
Ben Wagner a204489885 Fix warning about os2->achVendID cannot be NULL
FreeType's TT_OS2::achVendID is a FT_Char[4] array and not a pointer,
so it does not need to be checked for NULL.
2021-10-28 16:17:48 -04:00
Akira TAGOH 877d869904 Add the option to not build fontconfig cache during installation
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/296
2021-10-14 17:52:03 +09:00
Akira TAGOH 1d76699927 Resolves symlinks against <dir prefix="relative">
When a config file is symlinked and obtaining an relative path from it for <dir>,
it behaved like:

$ realpath /path/to/foo.conf
/path/to/realpath/foo.conf
$ FONTCONFIG_FILE=/path/to/foo.conf fc-cache -v
Font directories:
        /path/to/fonts
/path/to/fonts: skipping, existing cache is valid: 1 fonts, 0 dirs
/path/to/cachedir: cleaning cache directory
fc-cache: succeeded

And after this change:

$ FONTCONFIG_FILE=/path/to/foo.conf fc-cache -v
Font directories:
        /path/to/relpath/fonts
/path/to/realpath/fonts: skipping, existing cache is valid: 1 fonts, 0 dirs
/path/to/cachedir: cleaning cache directory
fc-cache: succeeded

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/290
2021-10-11 18:43:12 +09:00
Akira TAGOH 2d17232a45 Fix score estimation for postscriptname
Before this fix:
$ fc-match :postscriptname=LiberationSans
LiberationSansNarrow.ttf: "Liberation Sans Narrow" "Regular"

After this fix:
$ fc-match :postscriptname=LiberationSans
LiberationSans-Regular.ttf: "Liberation Sans" "Regular"

See https://bugzilla.redhat.com/show_bug.cgi?id=1946871
2021-10-08 18:30:09 +09:00
Ryan Schmidt 889097353e Fix FC_DEFAULT_FONTS on macOS and with BSD sed
Fix processing of FC_DEFAULT_FONTS when it contains multiple comma-
separated values (i.e. on macOS/Darwin) and fix inserting it into
fonts.conf when using BSD sed.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/287
2021-10-05 08:51:52 +00:00
Ben Wagner 6e414d61c7 Extend test thread args lifetime
The argument passed to each thread in test-pthread.c indicates a thread
number to report when finished. This value is read out by the thread
into a local variable early in the thread's execution. Currently, the
address passed as this argument is the address of a loop local. However,
it is possible that the created thread will not be scheduled to run or
will not read the argument before the thread creation loop finishes and
the local is destroyed. This can lead to odd behavior, usually observed
as multiple threads reporting the same thread_num.

Fix this issue by storing the thread arguments in a parallel array to
the array of threads. This ensures that the thread arguments are in
scope as long as the threads themselves.

Discovered with tests/test-pthread with AddressSanitizer enabled.
2021-09-06 04:06:16 +00:00
Ben Wagner efc71a3c13 Free local FcCache lock on contention
If two threads attempt to create the FcCache lock in lock_cache at the
same time, both threads may create and initialize a local FcMutex. One
thread will atomically make cache_lock point to its FcMutex. The other
thread currently calls FcMutexFinish on the local lock, but does not
free it. Change this behavior to free the unused lock.

Found with test/test-pthread on an LeakSanitizer enabled build.
2021-09-06 03:20:31 +00:00
Ben Wagner 6e68763085 Add memory order constraints to C11 atomics
Reduce the strength of the C11 atomics from memory_order_seq_cst to the
actually required memory order constraints for each operation. In
addition to reflecting the already documented memory order constraints,
this should allow for better code generation.
2021-08-31 12:38:50 -04:00
Akira TAGOH 57032f489b Fix a memory leak when trying to open a non-existing file
https://bugzilla.redhat.com/show_bug.cgi?id=1914716
2021-08-25 15:52:53 +09:00
Akira TAGOH c7891755cb Reflect matching results to binding in FcPattern
This change allows applications to see what property was matched perfectly
and help to filter out for their needs.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/294
2021-08-24 19:32:09 +09:00
Akira TAGOH 5d84745e72 Bump the cache version to 8
Bump the cache version to avoid unexpected behavior in
older version of fontconfig.

There was no real incompatible features introduced in a cache.
But the older version of fontconfig can't deal with variable fonts
and then it failed. To avoid this breakage, you may want to choose
one of options like:

1) Applying this change to fontconfig in host and remove all the
fontconfig caches and then regenerate them by fc-cache linked with
older one and new one. or simply run applications.
You'll see two versions of caches in the cache directories.

2) Remove variable fonts on system and remove all the fontconfig
caches too. then regenerate caches. You'll still see one version of
caches there but without the entries of variable fonts.

After that, the problem should be gone.

https://bugzilla.redhat.com/show_bug.cgi?id=1981500
2021-08-24 18:28:26 +09:00
Alex Richardson 92ed966b74 FcCharSetPutLeaf(): Fix missing move of new_leaves contents
If the `realloc(numbers)` call fails, shrinking the leaves allocation
back to the old size is not guaranteed to return the old pointer value.
While this might be the case with some malloc() implementations, realloc()
could also just mark the following area as free.
To make this less error-prone, we grow numbers first and then grow leaves
since the numbers content does not need to be relocated, but leaves does.

See https://bugs.freedesktop.org/show_bug.cgi?id=90867
2021-08-18 10:36:47 +01:00