Commit Graph

82 Commits

Author SHA1 Message Date
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 9acc14c34a Fix a comparison of constant warning with clang 2013-06-26 12:03:38 +09:00
Akira TAGOH cd9b1033a6 Bug 64906 - FcNameParse() should ignore leading whitespace in parameters
After this change, the following works as expected:
$ FC_DEBUG=4 fc-match ":family=foo bar, sans-serif"
...
FcConfigSubstitute Pattern has 3 elts (size 16)
        family: "foo bar"(s) "sans-serif"(s)
...
2013-05-24 13:57:23 +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
Behdad Esfahbod 93fb1d4bab Remove FcSharedStr* 2013-01-02 02:18:02 -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 a498f2f717 Minor 2013-01-01 20:27:54 -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 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 dd69d96e06 Fix sign-compare warnings 2012-12-29 22:47:49 -05:00
Behdad Esfahbod 24cdcf52ab Fix compiler warnings 2012-12-29 22:24:24 -05:00
Akira TAGOH b447fc5d52 Bug 50835 - Deprecate FC_GLOBAL_ADVANCE
FC_GLOBAL_ADVANCE is deprecated. this flag is simply ignored on
freetype 2.4.5 or later.
2012-06-11 23:28:55 +09:00
Akira TAGOH 7587d1c99d Bug 27765 - FcMatch() returns style in wrong language
Add "namelang" object to obtain the localized name in the font regardless
of the lang object. it's applied to "familylang", "stylelang" and
"fullnamelang" alltogether. this would helps if one wants to enforce
selecting them in the specific language if any.  the default value for
the namelang object is determined from current locale.
2012-04-24 12:44:56 +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
Mike Frysinger d9c4462778 FcObjectValidType: tweak -1 checking
Newer gcc doesn't like when you switch on an enum and use a value
that isn't declared:

fcname.c: In function 'FcObjectValidType':
fcname.c:299:2: warning: case value '4294967295'
	not in enumerated type 'FcType' [-Wswitch]

So tweak the logic to avoid this warning.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-02-21 14:15:58 -05:00
Mike Frysinger 123d344f45 FcName{,Get}Constant: constify string input
These funcs don't modify the incoming string, so add const markings.
This is the "right thing", shouldn't change the ABI, and fixes some
gcc warnings:

fccfg.c: In function 'FcConfigEvaluate':
fccfg.c:916:2: warning: passing argument 1 of 'IA__FcNameConstant'
	discards 'const' qualifier from pointer target type [enabled by default]
fcalias.h:253:34: note: expected 'FcChar8 *' but
	argument is of type 'const FcChar8 *'

fcxml.c: In function 'FcTypecheckExpr':
fcxml.c:604:2: warning: passing argument 1 of 'IA__FcNameGetConstant'
	discards 'const' qualifier from pointer target type [enabled by default]
fcalias.h:251:37: note: expected 'FcChar8 *' but
	argument is of type 'const FcChar8 *'

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-02-21 14:15:58 -05:00
Behdad Esfahbod e0be405a1d Bug 26718 - "fc-match sans file" doesn't work
- Do not throw away FC_FILE in FcNameUnparse
- Update the builtin "fclist" format to remove FC_FILE properly instead
- Switch fc-list to use FcPatternFormat()

Note that I had previously broken fc-list and it was not showing the
file name anymore.  No one noticed that it seems!  Now fixed.
2011-06-20 11:22:17 -04: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 3074a73b41 Replace 'KEITH PACKARD' with 'THE AUTHOR(S)' in license text in all files 2009-03-13 17:59:28 -04:00
Behdad Esfahbod 9c83a8376f [fcformat] Support indexing simple tags
The format '%{family[0]}' will only output the first value for element family.
2009-02-15 13:40:30 -08:00
Behdad Esfahbod 0c93b91db0 Implement FcPatternFormat and use it in cmdline tools (bug #17107)
Still need to add more features, but the API is there, and used
by cmdline tools with -f or --format.
2009-02-13 16:54:04 -08:00
Behdad Esfahbod 2987409853 Implement fc-list --verbose (#13015)
A private FcObjectGetSet() is implemented that provides an
FcObjectSet of all registered elements.  FcFontSetList() is
then modified to use the object set from FcObjectGetSet() if
provided object-set is NULL.

Alternatively FcObjectGetSet() can be made public.  In that
case fc-list can use that as a base if --verbose is included,
and also add any elements provided by the user (though that has
no effect, as all elements from the cache are already registered).
Currently fc-list ignores user-provided elements if --verbose
is specified.
2009-02-13 16:53:56 -08:00
Behdad Esfahbod 317b849215 Replace RCS Id tags with the file name 2009-02-13 16:53:55 -08:00
Sylvain Pasche 53aec11107 Fontconfig options for freetype sub-pixel filter configuration
David Turner has modified FreeType to be able to render sub-pixel decimated
glyphs using different methods of filtering. Fontconfig needs new
configurables to support selecting these new filtering options. A patch
follows that would correspond to one available for Cairo in bug 10301.
2008-05-03 19:33:45 -07:00
Keith Packard 23816bf9ac Eliminate .so PLT entries for local symbols. (thanks to Arjan van de Ven)
Using a simple shell script that processes the public headers, two header
files are constructed that map public symbols to hidden internal aliases
avoiding the assocated PLT entry for referring to a public symbol.

A few mistakes in the FcPrivate/FcPublic annotations were also discovered
through this process
2006-09-05 02:24:01 -07:00
Keith Packard 04cedae0d5 Don't segfault when string values can't be parsed as charsets or langsets.
If parsing charsets or langsets fails, return a FcTypeVoid value instead of
a charset/langset value with a NULL pointer in it (which is invalid).
2006-09-02 20:23:31 -07:00
Keith Packard c2c6976d1a Add FcMatchScan to resolve Delicious font matching issues (bug #6769)
The Delicious family includes one named Delicious Heavy, a bold variant
which is unfortunately marked as having normal weight. Because the family
name is 'Delicious', fontconfig accidentally selects this font instead of
the normal weight variant. The fix here rewrites the scanned data by running
the scanned pattern through a new substitution sequence tagged with
<match target=scan>; a sample for the Delicious family is included to
demonstrate how it works (and fix Delicious at the same time).

Also added was a new match predicate -- the 'decorative' predicate which is
automatically detected in fonts by searching style names for key decorative
phrases like SmallCaps, Shadow, Embosed and Antiqua. Suggestions for
additional decorative key words are welcome. This should have little effect
on font matching except when two fonts share the same characteristics except
for this value.
2006-09-02 17:52:12 -07:00
Keith Packard 551b6b2cd7 Allow FcTypeLangSet to match either FcTypeLangSet or FcTypeString.
Applications explicitly setting FC_LANG with string would fail due
to typechecking disallowing this case.
2006-08-31 18:16:00 -07:00
Keith Packard 09f9f6f62a Rework Object name database to unify typechecking and object lookup.
Eliminate ancient list of object name databases and load names into single
hash table that includes type information. Typecheck all pattern values to
avoid mis-typed pattern elements.
2006-08-30 18:50:58 -07:00
Keith Packard 7ce1967331 Rework cache files to use offsets for all data structures.
Replace all of the bank/id pairs with simple offsets, recode several
data structures to always use offsets inside the library to avoid
conditional paths. Exposed data structures use pointers to hold offsets,
setting the low bit to distinguish between offset and pointer.

Use offset-based data structures for lang charset encodings; eliminates
separate data structure format for that file.

Much testing will be needed; offsets are likely not detected everywhere in
the library yet.
2006-08-30 04:16:22 -07:00
Patrick Lam f045376c08 Include $(top_srcdir), $(top_srcdir)/src before anything else.
Shuffle order of includes for building out of srcdir on win32.
reviewed by: plam
2006-04-25 05:57:41 +00:00
Patrick Lam 8cfa0bbc82 Fix Gecko-exposed segfault from my last hack to FcObjectToPtrLookup.
Simplify code and get things straight.
2006-04-14 18:35:16 +00:00
Patrick Lam a56e89ab4f Fix bad behaviour on realloc resulting in crash.
reviewed by: plam
2006-04-12 03:02:57 +00:00
Patrick Lam 04f7d3e7fd Properly convert static charsets to dynamic charsets.
Fix memory leak in error case (Coverity defects #1820, #1821, #1822).
Fix memory leak (Coverity defect #1819).
prevent crash when invalid include line is parsed (Coverity defect #763).
Fix potential null pointer access (Coverity defect #1804).
Remove dead code (Coverity defect #1194).
Prevent potential null pointer access (Coverity defect #767), ensure error
    value is read (Coverity defect #1195).
reviewed by: plam
2006-04-11 14:20:59 +00:00
Patrick Lam ac0010940e Swap typo in order of ALIGN and dereferencing, fixing bug 6529. 2006-04-10 21:04:54 +00:00
Patrick Lam 44415a079a Portability fixes for HP-UX (reported by Christoph Bauer). Replace
'__inline__' by AC_C_INLINE and 'inline'. Replace '__alignof__' by
    'fc_alignof'.
reviewed by: plam
2006-04-07 17:27:39 +00:00
Patrick Lam d8951c0cc2 Remove stuff we don't use, make get_{char,short,long} functions of ftglue
macros to be inlined.
Code cleanups (excess prototype, old-style function definition).
reviewed by: plam
2006-03-08 02:30:43 +00:00
Patrick Lam 5fe09702f4 Print out full pathname in fc-match -v as well. Reported by Frederic
Crozat.
Fix bug where fc-match crashes when given __DUMMY__ property to match on.
(I added the __DUMMY__ string to enable callers of FcObjectToPtrLookup to
    distinguish an error return from a successful return. -PL)
reviewed by: plam
2006-01-07 06:36:24 +00:00
Patrick Lam c6103dfb22 Don't assign types to user object names. 2005-12-06 18:57:43 +00:00
Patrick Lam 61571f3f2e Pass around FcCache *s to the Unserialize functions for extra consistency
(and less overhead, for what that's worth).
2005-11-25 15:50:34 +00:00
Patrick Lam 9ab79bdfb7 Inline the *PtrU functions to gain perf. Remove unneeded params for the
FcCompare* functions.
reviewed by: plam
2005-11-25 03:00:51 +00:00
Patrick Lam 1c5b6345b9 Don't add current_arch_start more than once.
Fix ordering of ALIGN with respect to saving block_ptr; add another ALIGN
    to fcfs.c.
reviewed by: plam
2005-11-17 15:43:39 +00:00
Patrick Lam 7fd7221e68 Add *NeededBytesAlign(), which overestimates the padding which is later
added by the new ALIGN macro. Fix alignment problems on ia64 and s390
    by bumping up block_ptr appropriately. (Earlier version by Andreas
    Schwab).
Use sysconf to determine proper PAGESIZE value; this appears to be
    POSIX-compliant. (reported by Andreas Schwab)
reviewed by: plam
2005-11-16 15:55:17 +00:00
Patrick Lam 720298e773 Add FC_EMBEDDED_BITMAP object type to tell Xft/Cairo whether to load
embedded bitmaps or not.
reviewed by: plam
2005-10-26 06:34:29 +00:00
Patrick Lam 2fa3f27e68 Prevent fc-list from escaping strings when printing them. 2005-10-21 19:47:43 +00:00
Patrick Lam 23787a8f1b Add padding to make valgrind and glibc not hate each other when calling
strlen().
2005-10-06 20:45:25 +00:00
Patrick Lam 141432505a Fix bug when clients use FcNameRegisterObjectTypes; fontconfig was
returning bogus (i.e. duplicate) FcObjectPtr values. Now use negative
    values for dynamic object strings and positive values for built-in and
    FcNameRegisterObjectType strings. Thanks to Matthias Clasen for
    pinpointing this bus!
2005-09-22 20:49:24 +00:00
Patrick Lam 13cdf60753 Revert ill-advised addition of FC_RENDER. Add strategy for handling objects
that aren't hardcoded into fontconfig, but generated by fontconfig
    clients: keep another array of user-defined objects (indexed after the
    built-in objects).
Fix compilation warning (uninitialized variable).
Add comment.
2005-09-15 20:36:44 +00:00