Commit Graph

2314 Commits

Author SHA1 Message Date
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
Matthias Clasen 148ebf98ed Use __builtin_expect in a few places
utf8 is extremely rare in the strings we see in
font configuration, so this seems to be a good
case for __builtin_expect.
2020-08-25 12:15:45 -04:00
Matthias Clasen 13015a0a6e Use a hash table for families in FcConfigSubstitute
Use the same approach we used for FcFontMatch, and
keep a hash table of family names. We only speed
up the no-match case, for now.
2020-08-25 12:15:18 -04:00
Matthias Clasen 7deb07e38e Speed up FcCompareLang and FcCompareBool
Avoid FcCanonicalize here too.
2020-08-25 12:15:18 -04:00
Matthias Clasen 09729c9032 Speed up FcConfigCompareValue
Avoid FcValueCanonicalize when we can, to avoid
unnecessary copying of FcValue structs.
2020-08-25 12:15:18 -04:00
Matthias Clasen 9d4e5d0f25 Speed up FcConfigCompareValue
Make FcConfigPromote use a switch instead of
an if-else cascade, and avoid calling it when
we can.

Note that we need to add a case for integers
in FcConfigCompareValue, since we are no longer
promoting integers to doubles unconditionally.
2020-08-25 12:15:18 -04:00
Matthias Clasen 922168afe8 Speed up fonthashint matching
When we don't need to differentiate between weak and strong,
we can exit the loop in FcCompareValueList once we found a
best match.

This change helps reducing the amount of list walking we do
for fonthashint, where careless config files end up creating
lists with ~100 booleans :( We don't want to walk all those
to the end, over and over again.

We are already special-casing family, and the only other case
where weak != strong, PostScript names, doesn't have long lists
of values, so the limitation to weak == strong doesn't matter
much in practice.
2020-08-25 12:15:18 -04:00
Matthias Clasen 1b0cb23adc Add a shortcut for FcQualAny matching
When checking whether a test matches a pattern,
we cut the loop short for FcQualAll when we see
the first non-matching value, but for FcQualAny
we were always walking the full list. This patch
cuts the loop short for FcQualAny when we see the
first matching value.
2020-08-25 12:15:18 -04:00
Matthias Clasen 8022ab4aff Use a hash table for family matching
With the way typical font configurations look, matching the lists
of families is the bottleneck for both FcFontMatch and FcFontSort.
After installing the Noto fonts on my system, an innocent match
pattern like "Cantarell 14" turns into a monster with a list of
300 family names after calling FcConfigSubstitute().

With this setup, every FcFontSort call takes 80-100 ms, which is
entirely incompatible with using FcFontSort for anything interactive.
And many font choosers render every font in itself, causing on average
one FcFontSort call per font.

On my system, it takes more than 20 seconds to open the GTK font
chooser dialog, with frequent stalls when scrolling.

This patch special-cases font families and replaces the list
walking for comparison with a hash table lookup. With this
patch, the FcFontSort time goes to ~10ms per call. Which is
still not good enough for calling it dozens of times when
scrolling, but a significant improvement.
2020-08-25 12:15:18 -04:00
Matthias Clasen 055843631b Add a hash function for families
Add a hash function that behaves like family
comparison: ignoring case and blanks. This
will be used to replace the list walking for
finding family matches with a hash table.
2020-08-25 12:10:53 -04:00
Matthias Clasen 46d818df26 Special-case some of the string walking code
Make variants of FcStrCaseWalkerNext for the two
common cases, delim == NULL and delim == " ", to
speed things up.

These are inner loops, and having the conditions
as simple as possible helps.
2020-08-25 12:10:53 -04:00