Commit Graph

1100 Commits

Author SHA1 Message Date
Akira TAGOH abe91a1694 Use smaller prime for hash size 2017-11-20 17:37:23 +05:30
Akira TAGOH 2f486f6584 Don't call FcStat when the alias has already been added
Similar changes to 3a3d6ea applies to fclist and fcmatch.
2017-11-20 17:37:23 +05:30
Akira TAGOH 665a5d3044 Fix a typo 2017-11-20 17:37:23 +05:30
Akira TAGOH 6b82c70835 Fix memory leak 2017-11-20 17:37:22 +05:30
Akira TAGOH 8f88b1c47c abstract hash table functions 2017-11-20 17:37:22 +05:30
Akira TAGOH 68ff99c414 cleanup 2017-11-20 17:37:22 +05:30
Akira TAGOH b01bf646f1 Destroy the alias and UUID tables when all of caches is unloaded
When a cache contains no fonts, it will be unloaded immediately.
Previously the certain alias and UUID entries will be purged at that time though,
this doesn't work when the targeted directory has sub-directories.
To avoid the unnecessary cache creation with the md5-based naming, try to keep them
as far as possible.
Although this way seems not perfectly working if the first directory to look up is like that
2017-11-20 17:37:22 +05:30
Akira TAGOH d7133f4ed7 Don't call FcStat when the alias has already been added
We could assume that the targeted location is mapped at the different place
when there are in the alias table.
2017-11-20 17:37:22 +05:30
Akira TAGOH cf5acaed96 Replace the path of subdirs in caches as well 2017-11-20 17:37:22 +05:30
Akira TAGOH 6d3b306cbe Replace the original path to the new one 2017-11-20 17:37:22 +05:30
Akira TAGOH 6f226ad67e Replace the font path in FcPattern to what it is actually located. 2017-11-20 17:37:22 +05:30
Akira TAGOH 85d9de58ed Add new API to find out a font from current search path 2017-11-20 17:37:22 +05:30
Akira TAGOH 7b48fd3dd4 Use uuid-based cache filename if uuid is assigned to dirs 2017-11-20 17:37:22 +05:30
Akira TAGOH e73b5dcbf2 Correct debugging messages to load/scan config 2017-11-16 11:37:36 +09:00
Akira TAGOH 2ed243f323 Validate cache more carefully
Reject caches when FcPattern isn't a constant.
This is usually unlikely to happen but reported.
I've decided to add more validation since this isn't reproducible
and easy to have a workaround rather than investigating 'why'.

https://bugs.freedesktop.org/show_bug.cgi?id=103237
2017-11-14 20:55:24 +09:00
Akira TAGOH 9a0fcb948f Add the ruleset description support
Trying to address what these configuration files really do.
This change allows to see the short description that mention
the purpose of the content in the config file and obtain
them through API.

This change also encourage one who want to make some UI for
the user-specific configuration management. it is the main
purpose of this change for me though.

Aside from that, I've also made programs translatable. so
we see more dependencies on the build time for gettext,
and itstool to generate PO from xml.
2017-11-07 15:24:54 +09:00
Alexander Kanavin 90271ae079 src/fcxml.c: avoid double free() of filename
It's also freed after bail1, so no need to do it here.
2017-10-12 11:27:07 +09:00
Behdad Esfahbod f4a2a1e577 Remove assert 2017-10-11 17:27:02 +02:00
Akira TAGOH 9fde3461e3 Fix a compiler warning 2017-09-29 14:33:17 +09:00
Behdad Esfahbod f504b2d6a1 Require freetype >= 2.8.1
2.8.0 had a bad bug with loading 'avar' table.  Let's update requirement and cleanup
fifteen years of ifdefs!
2017-09-28 19:49:05 -04:00
Behdad Esfahbod 1580593ecc Merge branch 'varfonts2'
https://lists.freedesktop.org/archives/fontconfig/2017-September/006048.html
2017-09-28 14:52:41 -04:00
Behdad Esfahbod 01f781a9a4 [varfonts] Share lang across named-instances
Makes VotoSerifGX scanning another 40% faster...  Down to 36ms now.
2017-09-27 18:55:50 -04:00
Behdad Esfahbod 161c738547 Use binary-search for finding name table entries
VotoSerifGX has over 500 named instances, which means it also has over a thousand
name table entries.  So we were looking for names for over 500 pattern, looking for
some thirty different name-ids, and using linear search across the 1000 entries!

Makes scanning VotoSerifGX three times faster.  The rest is probably the lang
matching, which can also be shared across named-instances.  Upcoming.
2017-09-27 18:47:42 -04:00
Behdad Esfahbod 261464e0e2 Simplify name-table platform mathcing logic
There's no "all other platforms", there was just ISO left.
Hardcode it in.
2017-09-27 18:37:00 -04:00
Behdad Esfahbod 55d04e25d6 Don't convert nameds to UTF-8 unless we are going to use them 2017-09-27 18:37:00 -04:00
Behdad Esfahbod f99278112d Whitespace 2017-09-27 18:37:00 -04:00
Behdad Esfahbod 554041d596 Fix whitespace-trimming loop and empty strings... 2017-09-27 18:37:00 -04:00
Behdad Esfahbod a74109a114 Move whitespace-trimming code to apply to all name-table strings
If it's good, it's good for everything!
2017-09-27 18:37:00 -04:00
Behdad Esfahbod 869dfe0bdc [varfonts] Reuse charset for named instances
This didn't give me the speedup I was hoping for, though I do get around 15% for VotoSerifGX.
2017-09-27 18:37:00 -04:00
Behdad Esfahbod bf4d440e7f Separate charset and spacing code
For variable-font named-instances we want to reuse the same charset and redo the spacing.
2017-09-27 12:37:23 -04:00
Akira TAGOH 052115aa83 Fix again to keep the same behavior to the return value of FcConfigParseAndLoad
https://bugs.freedesktop.org/show_bug.cgi?id=102141
2017-09-21 14:04:10 +09:00
Akira TAGOH 5603e06aeb Revert "Keep the same behavior to the return value of FcConfigParseAndLoad"
This reverts commit dc56ff8040.
2017-09-21 14:03:51 +09:00
Behdad Esfahbod 15b5016ccd [varfonts] Don't reopen face for each named instance
Makes scanning of Voto (over 500 named instaces) twice faster.

Next, avoid charset / lang recalculation for each of those.
2017-09-20 19:39:59 -07:00
Behdad Esfahbod 2d0063948a [varfonts] Do not set postscriptname for varfont pattern 2017-09-20 16:36:03 -07:00
Behdad Esfahbod be735d6a68 [varfonts] Skip named-instance that is equivalent to base font 2017-09-20 16:36:03 -07:00
Behdad Esfahbod 8183194ae3 [varfonts] Don't set style for variable-font pattern 2017-09-20 13:21:52 -07:00
Behdad Esfahbod 131219f9e5 [varfonts] Comment 2017-09-20 13:21:52 -07:00
Behdad Esfahbod e85afde2d6 [varfonts] Minor 2017-09-20 13:21:52 -07:00
Behdad Esfahbod 5ee9c38df7 Revert "[varfonts] Use fvar data even if there's no variation in it"
This reverts commit 57764e3a36449da25bb829c34cb08c54e9e5de90.

For regular font pattern we don't look into fvar, so it doesn't make sense to
get non-variation from it either.
2017-09-20 13:21:52 -07:00
Behdad Esfahbod 7e1b84100d Minor 2017-09-20 13:21:52 -07:00
Behdad Esfahbod 01f14de417 [varfonts] Use fvar data even if there's no variation in it 2017-09-20 13:21:52 -07:00
Behdad Esfahbod 38a6d6fba0 Fix possible div-by-zero 2017-09-20 13:21:52 -07:00
Behdad Esfahbod 0ed241cb30 Implement more config bool operations for boolean types
Meh.
2017-09-20 13:21:52 -07:00
Behdad Esfahbod 2544bc5343 Add FcDontCare value to FcBool
This can be used for FC_VARIABLE=FcDontCare for example, to opt into getting
variable fonts for clients that support using them.
2017-09-20 13:21:13 -07:00
Behdad Esfahbod c2fcde498a [varfonts] Map from OpenType to Fontconfig weight values
Oops.
2017-09-20 13:13:35 -07:00
Behdad Esfahbod a79f367c3f Fix range comparision operators implementation 2017-09-20 13:13:35 -07:00
Behdad Esfahbod 5bbdffd2c2 Add separate match compare function for size
Has two distinctions from FcCompareRange():
1. As best value, it returns query pattern size, even if it's out of font range,
2. Implements semi-closed interval, as that's what OS/2 v5 table defines
2017-09-20 13:13:35 -07:00
Behdad Esfahbod 2db7ca7d58 In RenderPrepare(), handle ranges smartly
If font claims to support range [100,900], and request is for [250], then
return [250] in "rendered" pattern.  Previously was returning [100,900].

This is desirable for varfonts weight and width, but probably not for size.
Will roll back size to return request size always, for non-empty ranges.
2017-09-20 13:13:35 -07:00
Behdad Esfahbod 6a13a21e40 [varfonts] Fetch optical-size for named instances 2017-09-20 13:13:35 -07:00
Behdad Esfahbod 0f9bbbcf8f [varfonts] Query variable font in FcFreeTypeQueryAll()
Returns varfont pattern at the end.
2017-09-20 13:13:35 -07:00