Commit Graph

2413 Commits

Author SHA1 Message Date
Matthias Clasen de73d6c51a Avoid a crash in FcPatternHash with ranges
When a cached pattern contains a range,
FcPatternHash will crash.

Fixes #254.
2020-08-23 11:28:30 -04:00
Jan Tojnar 9133e799b5 Turn unknown attributes into warning
As far as I can tell, fontconfig can recover from encountering an unknown attribute.
And unknown elements already print a warning instead of an error, so let's make this a warning too.
2020-08-18 04:13:21 +00:00
Akira TAGOH a53f79b4a2 Fix build issues regarding formatter for Win32
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/248
2020-08-06 13:02:00 +09:00
Tim-Philipp Müller a5fd5dc471 meson: print configuration summary()
Fixes #249
2020-07-31 15:17:09 +01:00
Tim-Philipp Müller 57a224f51d Add Meson build system
See https://mesonbuild.com
2020-07-31 07:26:11 +00:00
Tim-Philipp Müller 03aa12c75e Guard dirent.h includes
Might not be available on Windows.
2020-07-27 13:43:23 +00:00
Alan Coopersmith 9bc88933b2 Fix some typos/spelling errors
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-21 18:42:40 -07:00
Akira TAGOH 437f03299b Fix empty XDG_CACHE_HOME Behavior
Use the default $HOME/.cache one for empty XDG_CACHE_HOME.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/243
2020-07-14 19:48:11 +09:00
Ben Wagner 4a1cf888cf Replace FT_UNUSED with FC_UNUSED.
FreeType is trying to hide FT_UNUSED, so use FC_UNUSED instead.
2020-07-07 10:25:02 -04:00
Tim-Philipp Müller a30e4db967 fccompat: fix build on Windows without unistd.h
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/access-waccess?view=vs-2019
2020-07-07 03:48:34 +00:00
Akira TAGOH 97d709e888 Fix a typo in doc/confdir.sgml.in
Since changes introduced by e181ab4d
2020-07-02 13:55:04 +09:00
Tim-Philipp Müller 93e65a8541 Fix build on Windows some more 2020-07-01 20:04:13 +01:00
Tim-Philipp Müller a98b620683 Use FC_PATH_MAX to fix build on Windows 2020-07-01 20:00:57 +01:00
Mathieu Duponchelle 7b293e3292 Some build fixes to support compilation with MSVC on Windows 2020-07-01 20:00:42 +01:00
Tim-Philipp Müller 344925fc53 doc: fix FcPatternFilter documentation
The second argument should be ARG2 not ARG1.
2020-07-01 10:49:20 +01:00
Jan Tojnar 37c7c74874 Drop elements with its namespace from fonts.conf.in
This appears to have been forgotten in https://gitlab.freedesktop.org/fontconfig/fontconfig/merge_requests/97
2020-06-24 00:00:12 +00:00
Akira TAGOH fcb0420281 Drop Bitstream Vera fonts from 60-latin.conf
Bitstream Vera fonts seems broken so dropped them there.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/26
2020-06-02 17:33:15 +09:00
Akira TAGOH 68d021b634 Add FC_ORDER property into cache
"fontversion" used to be modified to sort out fonts as a technique.
But that lost the original purpose to do the version control between
releases.

This change adds the dedicated property into the cache.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/226
2020-05-25 18:22:55 +09:00
Akira TAGOH 528b17b283 Drop elements with its namespace from conf
The translation related elements are now provided by separate files
fontconfig.its and fontconfig.loc. we don't need to have it in conf
anymore.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/234
2020-05-25 10:44:05 +09:00
Akira TAGOH 6d4f937898 Drop unmaintained files 2020-05-19 13:53:22 +09:00
Akira TAGOH fdbd9d13b7 Fix cache conflicts on OSTree based system
mtime isn't reliable to detect updates of fonts on OSTree based system
since they reset mtime to 0 for system files.
Due to this, there are the situation likely to happen where mtime is
newer but content is older.

Fortunately, OSTree based system requires reboot to deploy changes. so
we can assume we won't see any changes on system fonts. so system caches
are always up-to-date. we can ignore meta data for system fonts in
user caches.
2020-05-12 21:06:10 +09:00
Jonathan Kew 6edaaa4d18 Set name_mapping to NULL after freeing
To avoid risk of double-free.
    
Fixes #237.
2020-04-28 16:50:49 +00:00
Akira TAGOH f3e049967e Fix errors on shellcheck
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/235
2020-04-10 17:27:15 +09:00
Nicolas Mailhot 9c46ef4aac Use an URN for DTD ID
XML tools interpret “fonts.dtd” as a relative path.

Unfortunately, that can not work now that the configuration is spread over
multiple system-dependant directories, without a common relative path to this
file. And, an absolute path can not be defined in a system-independant way.
System independance is a requirement to share config files between systems.

Therefore, replace the broken relative path by a formal URN, that will work the
same way on all systems, without network access.

This makes the DTD registerable with commands like:
$ xmlcatalog --noout --add system \
                           "urn:fontconfig:fonts.dtd" \
                           "file:///usr/share/xml/fontconfig/fonts.dtd" \
                           /etc/xml/catalog

That enables easy config file checking:
$ xmllint --loaddtd ${config_file} >/dev/null
2020-03-28 15:01:35 +01:00
Akira TAGOH 6f6b397802 Fix assertion in FcCacheFini() again
The previous fix in fbc05949ef was wrong. reverting.

When reading older caches, FcDirCacheMapHelper() returns FcFalse and
it became the return value from FcDirCacheProcess() too, which is wrong.
Actually one of calls for FcDirCacheMapHelper() should be successfully
finished and closure should have a valid pointer for cache.

Due to this, the proper finalization process wasn't running against
cache in closure.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/227
2020-03-23 14:08:55 +09:00
Nirbheek Chauhan 6def66164a fcatomic: Fix EXC_BAD_ACCESS on iOS ARM64
iPhone 2.1 was released a long time ago, and the macro for checking
the target iOS SDK version has changed. We can simplify everything and
do a very basic check.
2020-03-19 18:44:36 +09:00
Akira TAGOH d3bfbea7dc Set exact boolean value to color property
This is a regression since 48e9e5f4
2020-02-27 14:25:10 +09:00
Akira TAGOH fbc05949ef Fix assertion in FcFini()
Due to the unproper initialization of `latest_mtime', the duplicate caches
was still in fcCacheChains with no references. which means no one frees
them. thus, the memory leak was happened.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/227
2020-02-26 15:42:21 +09:00
Akira TAGOH 61573ad5f7 Fix memory leaks 2020-02-19 17:05:20 +09:00
Akira TAGOH 71d6866d38 Fix the process substitution doesn't work with FONTCONFIG_FILE
Don't address the real filename when a named pipe is given in FONTCONFIG_FILE.
2020-02-19 14:02:31 +09:00
Akira TAGOH 452be8125f Add proper fullname for named-instances
Try to build a fullname from a family and a style name for a named-instance.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/185
2019-12-09 20:13:38 +09:00
Akira TAGOH 8bddcb1137 Fix a test fail when no bwrap was available
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/201
2019-12-05 19:55:06 +09:00
Akira TAGOH 8249f871b3 Don't add a value for FC_FULLNAME in meta face
FC_FULLNAME is affected by variables and could be different
against it. FC_FULLNAME should be dropped from meta face.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/185
2019-11-28 18:08:07 +09:00
Jan Tojnar a4aa66a858 Correct reset-dirs in DTD
Empty elements need to be declared as such in well-formed DTDs.
2019-11-20 02:13:58 +00:00
Akira TAGOH 23ab038281 Fix gcc warnings with -Wpointer-sign
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/184
2019-11-06 20:28:58 +09:00
Akira TAGOH aa8c8cfa9f Fix potential race condition in FcConfigSetCurrent and FcConfigReference 2019-11-06 14:21:34 +09:00
Akira TAGOH b5bcf61fe7 Use FcConfigReference/Destroy appropriately instead of FcConfigGetCurrent
This may improves to be MT-safe.

Reported at https://bugs.chromium.org/p/chromium/issues/detail?id=1004254
2019-11-01 14:44:47 +09:00
Akira TAGOH a45fc8a332 Fix a memory leak caused by the previous commit 2019-10-31 16:15:25 +09:00
Akira TAGOH c9862b6ea7 Read latest cache in paths
Right now fontconfig uses a cache found first in a path and
cachedirs are the order of the system-wide path and then the user path.
this is due to avoid writing caches into the user path when running as root.

However, changing caches by certain config only, e.g. using <match target="scan">
may not take effect by this behavior, because it may be stored into the user path.

Thus, needing to find the latest cache out from paths.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/182
2019-10-28 17:15:07 +09:00
Akira TAGOH cd51cb241a Take effect sysroot functionality to the default config file
When loading the default config file with FONTCONFIG_SYSROOT,
it fails if no /etc/fonts/fonts.conf is available, even if it is
there where is based on sysroot.

To address this, FcConfig is required to determine the sysroot.
therefore, this change makes FcConfigFilename() deprecated,
use FcConfigGetFilename() instead.

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/181
2019-10-21 20:46:09 +09:00
Akira TAGOH 75eadca266 Warn as well if no directory name for cachedir provided
cachedir is used to determine where cache files are stored.
the empty directory will ends up to put them under the top of
directory of XDG_CACHE_HOME. that messes it up and must be avoided.

As a note, if you want to read/write something from the top of
XDG_DATA_HOME (dir) and/or XDG_CACHE_HOME (cachedir),
put "." instead of the empty.

https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/180
2019-10-08 20:12:12 +09:00
Jan Tojnar 65087ac7ce
conf: Add JoyPixels emoji font
It is a successor of EmojiOne.

https://www.joypixels.com/
2019-08-29 12:51:43 +02:00
Akira TAGOH fcada52291 Do not return FcFalse from FcConfigParseAndLoad*() if complain is set to false
https://bugzilla.redhat.com/show_bug.cgi?id=1744377
2019-08-28 17:48:29 +09:00
Szunti 7172f08d42 Add missing return type for FcFontSet* functions 2019-08-21 11:45:23 +02:00
Akira TAGOH cb1036a7c7 Affect FC_FONT_HAS_HINT property to score on matcher 2019-08-09 12:22:59 +00:00
Akira TAGOH 505c7c46a5 Improve the performance a bit
This change reduces the call cost of strcmp 1.5 % less.
2019-08-07 12:39:14 +00:00
Akira TAGOH 01e4f088bf Fix the fails of make check when SOURCE_DATE_EPOCH is set
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/172
2019-07-31 13:18:51 +00:00
Akira TAGOH 8c44becd45 Fix failing the check of prep table in some fonts 2019-07-30 11:06:19 +00:00
Akira TAGOH 80047ed8e8 Add FC_FONT_HAS_HINT property to see if font has hinting or not.
This may helps to enable autohint only when font doesn't have any hinting
2019-07-29 10:19:26 +00:00
Akira TAGOH f555f50a20 Add 35-lang-normalize.conf
This avoids a situation where the score of lang becomes lower or equal to others
and then figures out the best font according to other properties and the order
of family names.

This typically happens only when our orthography files are the subset of lang
in patterns. i.e. fc-match :lang=en-us to match on en.orth.
In this case, the score is lower than the exact match (en to en) and the partial
match (en to en-us). thus, the result of 'fc-match :lang=en-us' isn't necessarily
same to 'fc-match :lang=en'.

So 35-lang-normalize.conf contains languages only which is available as orth
without countries and tries to update properties to match on orth exactly like:

  <match>
    <test name="lang" compare="contains">
      <string>en</string>
    </test>
    <edit name="lang" mode="assign" binding="same">
      <string>en</string>
    </edit>
  </match>

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/155
2019-07-26 07:42:36 +00:00