Commit Graph

145 Commits

Author SHA1 Message Date
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 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
Behdad Esfahbod bdf1581e3d Fix crash with FcConfigSetCurrent(NULL) 2013-03-08 05:53:27 -05: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 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
Behdad Esfahbod 55d39bcad0 Fix fc-cache crash caused by looking up NULL object incorrectly
We were returning a skiplist node when looking up NULL!
2013-01-16 07:31:15 -06:00
Behdad Esfahbod ec5ca08c80 Bug 59379 - FC_PRGNAME
Can be used for per-application configuration.
2013-01-15 20:46:45 -06: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
Behdad Esfahbod 31ee38e541 Minor 2013-01-02 01:03:18 -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 64af9e1917 Make refcounts, patterns, charsets, strings, and FcLang thread-safe 2013-01-02 00:51:00 -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 209750a4e0 Warn if <name target="font"> appears in <match target="pattern"> 2012-12-31 20:11:12 -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 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
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 e7954674eb Fix the wrong estimation for the memory usage information in fontconfig 2012-12-07 19:09:36 +09:00
Akira TAGOH cd280f6532 Fix a build fail on MINGW 2012-06-13 20:01:30 +09:00
Akira TAGOH f4103bf708 fcdefault: Add the lang object at FcConfigSubstituteWithPat() only when kind is FcMatchPattern 2012-06-08 19:17:57 +09:00
Akira TAGOH 550fd49d4f Add the default language to the pattern prior to do build the substitution
the default language is referred from the FC_LANG environment variable
or the current locale
2012-06-08 15:48:30 +09:00
Akira TAGOH 1b692d8ab9 Fix the wrong estimation for the memory usage information in fontconfig 2012-06-01 19:06:17 +09:00
Akira TAGOH 8c255fb185 Bug 20411 - fontconfig doesn't match FreeDesktop directories specs
Allows reading configuration files, fonts and cache files from
the directories where the XDG Base Directory Specification defines.

the old directories are still in the configuration files for
the backward compatibility.
2012-05-18 11:12:50 +09:00
Akira TAGOH bc4517d8e5 Bug 19128 - Handling whitespace in aliases
Add a new attribute `ignore-blanks' to <test>.
When this is set to "true", any blanks in the string will be ignored
on comparison.  This takes effects for compare="eq" or "not_eq" only.

Also changed the behavior of the comparison on <alias> too.
2012-05-14 12:06:12 +09:00
Akira TAGOH d2718257f9 Output more verbose debugging log to show where to insert the element into the value list 2012-05-01 20:22:17 +09:00
Akira TAGOH 06d6b7c312 Create CACHEDIR.TAG when fc-cache is run or only when the cache directory is created at the runtime.
Also add FcCacheCreateTagFile() API to do create CACHEDIR.TAG on the cache
directory.
2012-04-23 11:26:32 +09:00
Akira TAGOH d8dcff7b96 Bug 17832 - Memory leaks due to FcStrStaticName use for external patterns
Use the reference-counted strings instead of the static strings

Patch from Karl Tomlinson
2012-03-28 13:42:01 +09:00
Akira TAGOH 71b14d645f Bug 46169 - Pointer error in FcConfigGlobMatch
Fix possibly accessing the invalid memory and a crash in the worst case
when the glob string is longer than the string.
2012-02-22 16:30:05 +09:00
Behdad Esfahbod 1c475d5c8c Bug 35587 - Add padding to make valgrind and glibc not hate each other 2011-03-28 16:33:12 -04:00
Behdad Esfahbod c21fb9ac27 Always define FcStat as a function
Such that first arg is const char *.  We also need to make more changes
in that function as part of some other bug.
2011-03-14 18:49:21 -03:00
Akira TAGOH 3c862aad9f Add editing langset feature.
The syntax to add any langset to the langset table looks like:

<match target="scan">
    <test name="family">
        <string>Buggy Sans</string>
    </test>
    <edit name="lang" mode="assign">
        <plus>
            <name>lang</name>
            <langset>
                <string>zh-cn</string>
                <string>zh-tw</string>
            </langset>
        </plus>
    </edit>
</match>

To remove any langset from the langset table:

<match target="scan">
    <test name="family">
        <string>Buggy Sans</string>
    </test>
    <edit name="lang" mode="assign">
        <minus>
            <name>lang</name>
            <langset>
                <string>ja</string>
            </langset>
        </minus>
    </edit>
</match>
2010-12-09 11:40:08 +09:00
Akira TAGOH 857b7efe1e Add charset editing feature.
The syntax to add any characters to the charset table looks like:

<match target="scan">
    <test name="family">
        <string>Buggy Sans</string>
    </test>
    <edit name="charset" mode="assign">
        <plus>
            <name>charset</name>
            <charset>
                <int>0x3220</int>    <!-- PARENTHESIZED IDEOGRAPH ONE -->
            </charset>
        </plus>
    </edit>
</match>

To remove any characters from the charset table:

<match target="scan">
    <test name="family">
        <string>Buggy Sans</string>
    </test>
    <edit name="charset" mode="assign">
        <minus>
            <name>charset</name>
            <charset>
                <int>0x06CC</int>    <!-- ARABIC LETTER FARSI YEH -->
                <int>0x06D2</int>    <!-- ARABIC LETTER YEH BARREE -->
                <int>0x06D3</int>    <!-- ARABIC LETTER YEH BARREE WITH HAMZA ABOVE -->
            </charset>
        </minus>
    </edit>
</match>

You could also use the range element for convenience:

...
            <charset>
                <int>0x06CC</int>    <!-- ARABIC LETTER FARSI YEH -->
                <range>
                    <int>0x06D2</int>    <!-- ARABIC LETTER YEH BARREE -->
                    <int>0x06D3</int>    <!-- ARABIC LETTER YEH BARREE WITH HAMZA ABOVE -->
                </range>
            </charset>
...
2010-12-09 11:09:24 +09:00
Behdad Esfahbod 5aaf466d38 Cleanup copyright notices to replace "Keith Packard" with "the author(s)" 2010-11-10 16:45:42 -05:00
Behdad Esfahbod 594dcef0f3 Remove all training whitespaces 2010-04-12 12:19:05 -04:00
Behdad Esfahbod 390c05e64a [xml] Allocate FcExpr's in a pool in FcConfig
Reduces number of malloc's for FcExprs from hundreds into single digits.
2009-06-24 13:52:13 -04:00
Behdad Esfahbod efe5eae26b Simplify FcValueSave() semantics 2009-06-24 13:52:11 -04:00
Behdad Esfahbod 3074a73b41 Replace 'KEITH PACKARD' with 'THE AUTHOR(S)' in license text in all files 2009-03-13 17:59:28 -04:00
Behdad Esfahbod f69db8d49c Consistently use FcStat() over stat() in all places 2009-02-13 16:54:01 -08:00
Behdad Esfahbod 241fbde1ab Add FcConfigReference() (#17124) 2009-02-13 16:53:59 -08:00
Behdad Esfahbod 317b849215 Replace RCS Id tags with the file name 2009-02-13 16:53:55 -08:00
Behdad Esfahbod e04afe83de Avoid C99ism in Win32 code (#16651) 2009-02-13 16:53:54 -08:00
Sayamindu Dasgupta ad3fc66791 FcConfigUptoDate breaks if directory mtime is in the future. Bug 14424.
At OLPC, we came across a bug where the Browse activity (based on xulrunner)
took 100% CPU after an upgrade/. It turns out the Mozilla uses
FcConfigUptoDate() to check if new fonts have been added to the system, and
this function was always returning FcFalse since we have the mtimes of some
font directories set in the future. The attached patch makes
FcConfigUptoDate() print a warning and return FcTrue if mtime of directories
are in the future.
2008-05-24 16:15:27 -07:00
Dennis Schridde 6d65081e35 Proper config path for static libraries in win32
Since fontconfig didn't have special handling for paths in static Windows
libraries, I've created a patch which should fix this.

Basically it does this:
fccfg.c:
If fontconfig_path was uninitialised it tries to get the directory the exe is
in and uses a fonts/ dir inside that.
fcxml.c:
In case the fonts.conf lists a <dir>CUSTOMFONTDIR</dir>, it searches for a
fonts/ directory where the exe is located.
2008-05-03 19:45:31 -07:00