Commit Graph

237 Commits

Author SHA1 Message Date
Akira TAGOH ee2000494c Add FcPatternGetWithBinding() to obtain the binding type of the value in FcPattern.
https://bugs.freedesktop.org/show_bug.cgi?id=19375
2017-07-07 15:43:59 +09:00
Akira TAGOH abdb6d658e Fix the build issue on GNU/Hurd
PATH_MAX isn't defined on GNU/Hurd. according to the porting guidelines
(https://www.gnu.org/software/hurd/hurd/porting/guidelines.html)
allocate a memory dynamically instead of relying on the length of
a string with PATH_MAX.

https://bugs.freedesktop.org/show_bug.cgi?id=97512
2017-03-01 19:48:38 +09:00
Akira TAGOH d179cbc253 Revert "Workaround another race condition issue"
This reverts commit f44bfad235.
2016-04-06 14:39:15 +09:00
Patrick Haller d570a841a2 Optimizations in FcStrSet
Applied optimizations:
- skip duplicate check in FcStrSetAppend for values originating from readdir()
- grow FcStrSet in 64-element bulks for local FcStrSets (FcConfig layout unaltered)

Starting gedit is measured to

                        Unoptimized     Optimized
user[s]                         0,806         0,579
sys[s]                          0,062         0,062
Total Instr Fetch Cost: 1.658.683.750   895.069.820
Cachegrind D Refs:        513.917.619   312.000.436
Cachegrind Dl Misses:       8.605.632     4.954.639
2016-01-12 10:42:40 +09:00
Akira TAGOH bd96984e4b Use int64_t instead of long long 2015-10-15 15:51:50 +09:00
Akira TAGOH a44cc450b5 Use long long to see the same size between LP64 and LLP64 2015-10-13 13:04:33 +09:00
Akira TAGOH ad9f588050 Fix the broken cache more.
Take a look at the nano second in the mtime to figure out
if the cache needs to be updated if available.
and do the mutex lock between scanning and writing a cache
to avoid the conflict.

Also we don't need to scan directories again after writing
caches. so getting rid of the related code as well.

https://bugs.freedesktop.org/show_bug.cgi?id=69845

and for reference:

https://bugzilla.redhat.com/show_bug.cgi?id=1236034
2015-08-14 17:19:29 +09:00
Behdad Esfahbod 46ec6a52d4 Revert changes made to FcConfigAppFontAddDir() recently
In 32ac7c75e8 the behavior of
FcConfigAppFontAddFile/Dir() were changed to return false
if not fonts were found.  While this is welldefined and useful
for AddFile(), it's quite problematic for AddDir().  For example,
if the directory is empty, is that a failure or success?  Worse,
the false value from AddDir() was being propagated all the way
to FcInit() returning false now.  This only happened upon memory
allocation failure before, and some clients assert that FcInit()
is successful.

With this change, AddDir() is reverted back to what it was.
AddFont() change (which was actually in fcdir.c) from the original
commit is left in.
2015-06-26 17:02:13 -07:00
Akira TAGOH 33fd436a3e Don't return FcFalse even when no fonts dirs is configured 2015-06-17 16:15:35 +09:00
Akira TAGOH f6d61c9bee mark as private at this moment 2015-06-12 11:30:01 +09:00
Akira TAGOH dbda117142 No need to be public 2015-06-09 11:15:25 +09:00
Akira TAGOH 10a57edd07 Add one more debugging option to see transformation on font-matching
just setting FC_MATCH=3 shows a lot of information and hard to keep on track for informamtion
which is really necessary to see. to use this more effectively, added FC_DBG_MATCH_FILTER to
see for what one really want to see. it takes a comma-separated-list of object names.
If you want to see family name only, try like this:

FC_DBG_MATCH_FILTER=family FC_DEBUG=4096 fc-match

debugging output will be filtered out and see family only in the result.
2015-06-08 17:39:25 +09:00
Behdad Esfahbod ee2d1da2d2 Reduce number of places that cache version is specified to 1 2015-05-27 14:36:35 -07:00
Behdad Esfahbod 5bad26ccb6 Simplify FcRange 2015-05-27 14:18:28 -07:00
Akira TAGOH fa6c6b53c5 Fix memory leaks after FcFini()
Reported by Jia Wang

https://bugs.freedesktop.org/show_bug.cgi?id=83770
2015-05-22 16:53:34 +09:00
Akira TAGOH 365809938e Bump the cache version to 5
FcPattern isn't compatible to the older.
2014-12-25 13:11:21 +09:00
Behdad Esfahbod 874a549164 Remove unused regex code
Regex matching was disabled in f6244d2cf2
2014-07-24 15:42:54 -04:00
Akira TAGOH d17f556153 Read the config files and fonts on the sysroot when --sysroot is given to fc-cache
Fix for e96d776088

https://bugs.freedesktop.org/show_bug.cgi?id=59456
2014-06-17 20:11:02 +09:00
Behdad Esfahbod 8f62ccaa96 Remove unused FcHash code now that FC_HASH is deprecated 2014-06-12 17:02:10 -04:00
Akira TAGOH f44bfad235 Workaround another race condition issue
See https://bugzilla.redhat.com/show_bug.cgi?id=921706
2014-06-05 19:06:02 +09:00
Behdad Esfahbod 3f992254f2 Rewrite hashing to use FT_Stream directly
This is more robust but introduces a small change in behavior:
For .pcf.gz fonts, the new code calculates the hash of the uncompressed
font data whereas the original code was calculating the hash of the
compressed data.

No big deal IMO.
2014-05-16 15:02:58 -06:00
Behdad Esfahbod 748e77e89f Simplify hash code 2014-05-16 14:10:06 -06:00
Behdad Esfahbod e4d8847eee Remove unused code 2014-05-16 13:45:44 -06:00
Akira TAGOH 48c8b7938a Allow the modification on FcTypeVoid with FcTypeLangSet and FcTypeCharSet
FcTypeVoid is likely to happen when 'lang' and 'charset'
is deleted by 'delete' or 'delete_all' mode in edit.
Without this change, any modification on them are simply
ignored.

This is useful to make a lot of changes, particularly
when one wants to add a few and delete a lot say.
2014-05-13 21:22:17 +09:00
Akira TAGOH 3cd573fc1f Bug 71287 - size specific design selection support in OS/2 table version 5
This feature requires the FreeType 2.5.1 or later at the build time.

Besides <range> element allows <double> elements with this changes.

This may breaks the cache but not bumping in this change sets at this moment.
please be aware if you want to try it and run fc-cache before/after to
avoid the weird thing against it.
2014-03-26 12:19:04 +09:00
Akira TAGOH 7a6622f25c Improve the performance issue on rescanning directories 2013-12-20 11:57:16 +09:00
Akira TAGOH 223c1384c9 Fix a crash when non-builtin objects are edited 2013-08-24 13:46:44 +09:00
Akira TAGOH 041deb0cc5 warn deprecated only when migration failed 2013-08-07 12:05:32 +09:00
Akira TAGOH a51d2767ce Fix wrong edit position 2013-08-06 13:05:53 +09:00
Akira TAGOH d420e1df98 Rework to apply the intermixed test and edit elements in one-pass 2013-07-04 19:51:03 +09:00
Akira TAGOH 1162515a98 Add FC_UNUSED to FC_ASSERT_STATIC macro to avoid compiler warning 2013-07-03 11:56:58 +09:00
Akira TAGOH cbf06d7d3c Use INT_MAX instead of unreliable hardcoding value 2013-07-02 19:04:36 +09:00
Akira TAGOH 0907589a79 Fix the behavior of intermixed tests end edits in match
to get the following recipe working:

<match>
  <test1 .../>
  <edit1 .../>
  <test2 .../>
  <edit2 .../>
</match>

as:

<match>
  <test1 .../>
  </edit1 .../>
</match>
<match>
  <test1 .../>
  <test2 .../>
  <edit2 .../>
</match>
2013-06-28 15:54:38 +09:00
Akira TAGOH 197d06c49b Add FcTypeUnknown to FcType to avoid comparison of constant -1
This change reverts 9acc14c34a
because it doesn't work as expected when building
with -fshort-enums which is default for older arms ABIs

Thanks for pointing this out, Thomas Klausner, Valery Ushakov, and Martin Husemann
2013-06-28 15:04:11 +09:00
Akira TAGOH f6244d2cf2 Use the glob matching for filename
Regex is expensive to compare filenames. we already have the glob matching
and it works enough in this case.

Prior to this change, renaming FcConfigGlobMatch() to FcStrGlobMatch() and moving to fcstr.c
2013-05-08 11:57:49 +09:00
Akira TAGOH 03216ccf4c Bug 63329 - make check fails: .. contents:: :depth: 2
Add back FcHashGetSHA256DigestFromFile() and fall back to it
when font isn't SFNT-based font because FT_Load_Sfnt_Table
fails with FT_Err_Invalid_Face_Handle.
2013-04-10 18:41:22 +09:00
Akira TAGOH fc5a589aba Revert the previous change and rework to not export freetype API outside fcfreetype.c 2013-04-09 17:18:43 +09:00
Akira TAGOH c93a8b8b54 Obtain fonts data via FT_Face instead of opening a file directly 2013-04-09 12:46:30 +09:00
Akira TAGOH b561ff2016 Bug 38737 - Wishlist: support FC_POSTSCRIPT_NAME
Add the PostScript name into the cache and the matcher.
Scoring the better font against the PostScript name by
the forward-matching.
2013-03-21 16:34:42 +09:00
Akira TAGOH e96d776088 Bug 59456 - Adding a --sysroot like option to fc-cache
Add an ability to set the system root to generate the caches.
In order to do this, new APIs, FcConfigGetSysRoot() and
FcConfigSetSysRoot() is available.
2013-03-05 18:38:50 +09:00
Akira TAGOH 62b7d764ce Bump the cache version to 4 2013-02-06 19:14:51 +09:00
Akira TAGOH 4eab908c86 Update _FcMatchers definition logic
to make it easier to maintain. also added FC_HASH_OBJECT to be matched
in the pattern, prior to FC_FILE_OBJECT.
2013-02-06 19:02:07 +09:00
Akira TAGOH 95af7447db Bug 50733 - Add font-file hash?
Add "hash" object which contains SHA256 hash value (so far) computed from the font file.
2013-02-05 15:34:56 +09:00
Akira TAGOH 20191810d1 Bug 23757 - Add mode="delete" to <edit>
Add two edit mode, "delete" and "delete_all".
what values are being deleted depends on <test> as documented.
if the target object is same to what is tested, matching value there
will be deleted. otherwise all of values in the object will be deleted.
so this would means both edit mode will not take any expressions.

e.g.

Given that the testing is always true here, the following rules:

  <match>
    <test name="foo" compare="eq">
      <string>bar</string>
    </test>
    <edit name="foo" mode="delete"/>
  </match>

will removes "bar" string from "foo" object. and:

  <match>
    <test name="foo" compare="eq">
      <string>foo</string>
    </test>
    <edit name="bar" mode="delete"/>
  </match>

will removes all of values in "bar" object.
2013-02-01 12:56:14 +09:00
Akira TAGOH 6363193a05 Fix mkstemp absence for some platform
Patch from LRN and modified to make more generic.
2013-01-22 12:11:02 +09:00
Behdad Esfahbod ec5ca08c80 Bug 59379 - FC_PRGNAME
Can be used for per-application configuration.
2013-01-15 20:46:45 -06:00
Akira TAGOH 8e8a99ae8a Bug 29312 - RFE: feature to indicate which characters are missing to satisfy the language support
Add fc-validate to check the language coverage in a font.
2013-01-09 12:21:33 +09:00
Akira TAGOH 596931c8b4 Bug 47705 - Using O_CLOEXEC 2013-01-08 15:34:09 +09:00
Behdad Esfahbod ec8a40d238 Fix build and warnings on win32 2013-01-02 17:35:56 -06:00
Behdad Esfahbod 93fb1d4bab Remove FcSharedStr* 2013-01-02 02:18:02 -06:00