Commit Graph

1609 Commits

Author SHA1 Message Date
Behdad Esfahbod 2ae07bbcd2 Make FcDirCacheDispose() threadsafe 2013-01-02 01:04:58 -06:00
Behdad Esfahbod 68b8ae9af8 Make cache hash threadsafe
This concludes my first pass at making fontconfig threadsafe.  Now to
testing and actually fixing it!
2013-01-02 01:04:47 -06:00
Behdad Esfahbod adb03b730d Make random-state initialization threadsafe 2013-01-02 01:04:03 -06:00
Behdad Esfahbod 91dd7d28ff Add a big cache lock
Not used yet.
2013-01-02 01:03:49 -06:00
Behdad Esfahbod 8d2bbb193a Make cache refcounting threadsafe 2013-01-02 01:03:22 -06:00
Behdad Esfahbod 31ee38e541 Minor 2013-01-02 01:03:18 -06:00
Behdad Esfahbod b8f238e49d Make FcCacheIsMmapSafe() threadsafe 2013-01-02 01:03:06 -06:00
Behdad Esfahbod b27a22aae9 Minor 2013-01-02 01:01:52 -06:00
Behdad Esfahbod 0552f26016 Make default-FcConfig threadsafe 2013-01-02 01:01:29 -06:00
Behdad Esfahbod e53f5da54f Minor 2013-01-02 00:58:52 -06:00
Behdad Esfahbod 7ae24b4554 Refactor; contain default config in fccfg.c 2013-01-02 00:58:31 -06:00
Behdad Esfahbod 32b0d88923 Make FcDefaultFini() threadsafe 2013-01-02 00:57:26 -06:00
Behdad Esfahbod 7019896c99 Make FcInitDebug() idempotent 2013-01-02 00:53:16 -06:00
Behdad Esfahbod b97ab0c949 Make FcGetDefaultLang and FcGetDefaultLangs thread-safe 2013-01-02 00:52:14 -06:00
Behdad Esfahbod 64af9e1917 Make refcounts, patterns, charsets, strings, and FcLang thread-safe 2013-01-02 00:51:00 -06:00
Behdad Esfahbod 814871b2aa Add thread-safety primitives 2013-01-02 00:38:36 -06:00
Behdad Esfahbod f6d8306e56 Add build stuff for threadsafety primitives
Copied over from HarfBuzz.
2013-01-02 00:38:30 -06:00
Behdad Esfahbod b53744383d Fix build stuff 2013-01-02 00:38:18 -06:00
Behdad Esfahbod db6d86a6c1 Remove shared-str pool
We used to have a shared-str pool.  Removed to make thread-safety
work easier.  My measurements show that the extra overhead is not
significant by any means.
2013-01-02 00:37:00 -06:00
Behdad Esfahbod ed41b23765 Switch .gitignore to git.mk 2013-01-02 00:36:12 -06:00
Behdad Esfahbod d58c31e6dc Use a static perfect hash table for object-name lookup
The hash table is generated by gperf.  For runtime element types, we use
a append-only linked list.

A bit clumsy, but I think I got it right.
2013-01-02 00:35:39 -06:00
Behdad Esfahbod 7c0f79c5fe Deprecate FcName(Un)RegisterObjectTypes / FcName(Un)RegisterConstants
These never worked as intended.  The problem is, if Fontconfig tries to
read config files when these new types / constants are not registered,
it errs.  As a result, no defined types / constants are usable from
config files.  Which makes these really useless.  Xft was the only user
of this API and even there it's not really used.  Just kill it.

One inch closer to thread-safety since we can fix the object-type hash
table at compile time.
2013-01-01 22:55:08 -06:00
Behdad Esfahbod 1e2c0d7052 Whitespace 2013-01-01 20:28:08 -06:00
Behdad Esfahbod a498f2f717 Minor 2013-01-01 20:27:54 -06:00
Behdad Esfahbod 8198127b25 Don't crash in FcPatternFormat() with NULL pattern 2013-01-01 20:20:31 -06:00
Behdad Esfahbod c9581b47c4 Don't crash in FcPatternDestroy with NULL pattern 2013-01-01 20:20:12 -06:00
Behdad Esfahbod e7d3e21632 Add NULL check 2013-01-01 20:19:57 -06:00
Behdad Esfahbod 5bb5da4c4a Refuse to set value to unsupported types during config too 2013-01-01 20:19:57 -06:00
Behdad Esfahbod 3878a12541 Make FC_DBG_OBJTYPES debug messages into warnings
And remove FC_DBG_OBJTYPES since it has no use now.
2013-01-01 20:19:53 -06:00
Behdad Esfahbod 209750a4e0 Warn if <name target="font"> appears in <match target="pattern"> 2012-12-31 20:11:12 -06:00
Behdad Esfahbod 424cfa1684 Adjust docs for recent changes 2012-12-31 20:00:17 -06:00
Behdad Esfahbod 31ce352bb3 Initialize matrix during name parsing
Before:
$ fc-match sans:matrix=2 -v | grep matrix
	matrix: [2 6.95183e-310; 0 0](s)

After:
$ fc-match sans:matrix=2 -v | grep matrix
	matrix: [2 0; 0 1](s)
2012-12-31 19:56:06 -06:00
Behdad Esfahbod 6bfef3ca4e Make tests run on Windows 2012-12-31 17:21:07 -06:00
Behdad Esfahbod b1630dc00e Enable fcarch assert checks even when FC_ARCHITECTURE is explicitly given
After all, if the asserts fail, the resulting library simply can't be
working correctly.
2012-12-31 17:20:29 -06:00
Behdad Esfahbod a0638ff0c7 Remove unneeded stuff 2012-12-31 17:20:12 -06:00
Behdad Esfahbod a603be89cd Unbreak build when FC_ARCHITECTURE is defined 2012-12-31 17:00:19 -06:00
Behdad Esfahbod 1fbb0b3b15 Don't warn if an unknown element is used in an expression
The type will be resolved at runtime...

For example, we can do this now without getting a warning:

<match target="font">
  <test name="scalable" compare="eq">
    <bool>false</bool>
  </test>
  <edit name="pixelsizefixupfactor" mode="assign">
    <divide>
      <name target="pattern">pixelsize</name>
      <name target="font"   >pixelsize</name>
    </divide>
  </edit>
  <edit name="matrix" mode="assign">
    <times>
      <name>matrix</name>
      <matrix>
        <name>pixelsizefixupfactor</name> <double>0</double>
        <double>0</double> <name>pixelsizefixupfactor</name>
       </matrix>
    </times>
  </edit>
  <edit name="size" mode="assign">
    <divide>
      <name>size</name>
      <name>pixelsizefixupfactor</name>
    </divide>
  </edit>
</match>

Previously the last edit was generating:

Fontconfig warning: "/home/behdad/.local/etc/fonts/conf.d/00-scale-bitmap-fonts.conf", line 29: saw unknown, expected number
2012-12-30 19:08:42 -06:00
Behdad Esfahbod 51b0044648 Allow target="font/pattern/default" in <name> elements
Based on idea from Raimund Steger.

For example, one can do something like this:

<match target="font">
  <test name="scalable" compare="eq">
    <bool>false</bool>
  </test>
  <edit name="pixelsizefixupfactor" mode="assign">
    <divide>
      <name target="pattern">pixelsize</name>
      <name target="font"   >pixelsize</name>
    </divide>
  </edit>
  <edit name="matrix" mode="assign">
    <times>
      <name>matrix</name>
      <matrix>
        <name>pixelsizefixupfactor</name> <double>0</double>
        <double>0</double> <name>pixelsizefixupfactor</name>
       </matrix>
    </times>
  </edit>
</match>

Part of work to make bitmap font scaling possible.  See thread
discussion:

http://lists.freedesktop.org/archives/fontconfig/2012-December/004498.html
2012-12-30 19:01:23 -06:00
Behdad Esfahbod d7e1965aa0 Remove memory accounting and reporting
That belongs in tools like cairo/util/malloc-stat.so
2012-12-29 23:12:07 -05:00
Behdad Esfahbod d823bb3cad Fixup from 4f6767470f 2012-12-29 22:57:53 -05:00
Behdad Esfahbod eb9ffac7e5 Fix more warnings 2012-12-29 22:56:14 -05:00
Behdad Esfahbod 1404af312a Fix warning 2012-12-29 22:55:36 -05:00
Behdad Esfahbod dd69d96e06 Fix sign-compare warnings 2012-12-29 22:47:49 -05:00
Behdad Esfahbod 4ad3a73691 Fix more warnings 2012-12-29 22:37:19 -05:00
Behdad Esfahbod 83d8019011 Fix unused-parameter warnings 2012-12-29 22:32:56 -05:00
Behdad Esfahbod 24cdcf52ab Fix compiler warnings 2012-12-29 22:24:24 -05:00
Behdad Esfahbod 4f6767470f Parse matrices of expressions
Previously a <matrix> element could only accept four <double> literals.
It now accepts full expressions, which can in turn poke into the
pattern, do math, etc.
2012-12-29 21:39:06 -05:00
Behdad Esfahbod 927dd3ddb5 Fix typo
Ouch, this has been wrong since 2004...  I guess no one uses <patelt>
stuff.
2012-12-29 20:14:07 -05:00
Akira TAGOH 9ce36f4bbe Check the system font to be initialized
config->fonts is an array and checking if config->fonts is a null
will not be useful.
2012-12-11 18:53:57 +09:00
Akira TAGOH 58040349e8 Fix a memory leak 2012-12-11 12:38:42 +09:00