Commit Graph

166 Commits

Author SHA1 Message Date
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
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
Руслан Ижбулатов f6e6a8a22b W32: Support cache paths relative to the root directory
Paths starting with '/' don't make sense on W32 as-is,
prepend the installation root directory to them.

This allows the cache to be contained within a particular
fontconfig installation (as long as the default
--with-cache-dir= is overriden at configure time).
2015-04-09 15:19:17 +09:00
Akira TAGOH c965c9f677 Bug 89617 - FcConfigAppFontAddFile() returns false on any font file
Prior to the change of 32ac7c75e8
FcConfigAppFontAddFile() always returned FcTrue no matter what
fonts was added. after that, it always returned FcFalse because
adding a font doesn't add any subdirs with FcFileScanConfig().
so changing that to simply ignore it.

Also fixing it to return FcFalse if non-fonts was added, i.e.
FcFreeTypeQuery() fails.

https://bugs.freedesktop.org/show_bug.cgi?id=89617
2015-03-23 13:31:57 +09:00
Akira TAGOH f18f2f88f2 Don't add FC_LANG when it has "und"
to avoid the situation to find the better fallback font.

https://code.google.com/p/chromium/issues/detail?id=392724 has
more words to explain the details.

https://bugs.freedesktop.org/show_bug.cgi?id=81185
2015-03-02 11:35:42 +09:00
Akira TAGOH d6a5cc665a Hardcode the blanks in the library
https://bugs.freedesktop.org/show_bug.cgi?id=79956
2015-02-27 14:18:32 +09:00
Akira TAGOH 32ac7c75e8 Returns False if no fonts found
https://bugs.freedesktop.org/show_bug.cgi?id=86950
2014-12-09 19:06:46 +09:00
Akira TAGOH 23e88d8c6a Increase the refcount in FcConfigSetCurrent()
https://bugs.freedesktop.org/show_bug.cgi?id=82432
2014-08-12 18:48:00 +09:00
Akira TAGOH 107b44f50b Don't add duplicate lang
Don't add duplicate lang from FC_LANG if the pattern already has.

https://bugs.freedesktop.org/show_bug.cgi?id=81186
2014-07-23 19:17:26 +09:00
Akira TAGOH 5b22776999 Fix a crash when no sysroot is given and failed to load the default fonts.conf 2014-07-04 18:04:52 +09:00
Akira TAGOH dab60e4476 Rework for 5004e8e01f
Don't read/write from/to the XDG dirs even if XDG_*_HOME is set
and the home directory is disabled.
2014-06-30 15:12:32 +09:00
Akira TAGOH 5004e8e01f Don't read/write from/to the XDG dirs if the home directory is disabled 2014-06-30 12:39:31 +09: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
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 272a99217b Fix a crash 2013-08-31 10:43:13 +09:00
Akira TAGOH fba9efecd2 Fix a wrong edit position when 'kind' is different 2013-08-26 12:47:07 +09:00
Akira TAGOH 223c1384c9 Fix a crash when non-builtin objects are edited 2013-08-24 13:46:44 +09:00
Akira TAGOH d52daa0024 Bug 67809 - Invalid read/write with valgrind when assigning something twice 2013-08-06 15:09:23 +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 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