Commit Graph

61 Commits

Author SHA1 Message Date
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
Patrick Lam 0fa237d1e0 Add a global binding for the 'render' pattern element used by Xft; the lack
of said binding prevented programs from using FcPatterns through Xft.
2005-09-11 05:17:28 +00:00
Patrick Lam 7f37423d8c Replace FcObjectStaticName by FcStrStaticName. Implement serialization of
'object' table (strings pointed to by FcPatternElt->object and used as
    keys) and loading of object table from cache file if more strings are
    present in cache file than in current version of fontconfig. Hash the
    object table in memory.
2005-08-27 02:34:24 +00:00
Patrick Lam 4262e0b385 Overhaul the serialization system to create one mmapable file per directory
and distribute bytes for each directory from a single malloc for that
    directory. Store pointers as differences between the data pointed to
    and the pointer's address (s_off = s - v). Don't serialize data
    structures that never actually get serialized. Separate strings used
    for keys from strings used for values (in FcPatternElt and FcValue,
    respectively). Bump FC_CACHE_VERSION to 2.
2005-08-24 06:21:30 +00:00
Patrick Lam 0fa680f076 Convert ObjectPtr from a fat structure to a simple index into an id table;
ids can be positive (for static strings) or negative (for dynamic
    strings). Static strings belong to a single buffer, while dynamic
    strings are independently allocated.
2005-07-07 12:09:10 +00:00
Patrick Lam cd2ec1a940 Add functionality to allow fontconfig data structure serialization.
This patch allows the fundamental fontconfig data structures to be
    serialized. I've converted everything from FcPattern down to be able to
    use *Ptr objects, which can be either static or dynamic (using a union
    which either contains a pointer or an index) and replaced storage of
    pointers in the heap with the appropriate *Ptr object. I then changed
    all writes of pointers to the heap with a *CreateDynamic call, which
    creates a dynamic Ptr object pointing to the same object as before.
    This way, the fundamental fontconfig semantics should be unchanged; I
    did not have to change external signatures this way, although I did
    change some internal signatures. When given a *Ptr object, just run *U
    to get back to a normal pointer; it gives the right answer regardless
    of whether we're using static or dynamic storage.
I've also implemented a Fc*Serialize call. Calling FcFontSetSerialize
    converts the dynamic FcFontSets contained in the config object to
    static FcFontSets and also converts its dependencies (e.g. everything
    you'd need to write to disk) to static objects. Note that you have to
    call Fc*PrepareSerialize first; this call will count the number of
    objects that actually needs to be allocated, so that we can avoid
    realloc. The Fc*Serialize calls then check the static pointers for
    nullness, and allocate the buffers if necessary. I've tested the
    execution of fc-list and fc-match after Fc*Serialize and they appear to
    work the same way.
2005-06-28 03:41:02 +00:00
Keith Packard 414f720281 Create prototype /etc/fonts/conf.d directory with a few sample
configuration files. Deprecate use of local.conf for local
    customizations in favor of this directory based scheme which is more
    easily integrated into installation systems.
Tag FC_EMBOLDEN as a boolean variable
2005-02-28 18:56:15 +00:00
Keith Packard ca60d2b5c5 Polite typechecking for test and edit expressions. Helps catch errors in
the font configuration.
2005-01-28 23:55:14 +00:00
Keith Packard 46b51147d1 Change files from ISO-Latin-1 to UTF-8 2004-12-07 01:14:46 +00:00
Keith Packard 537e3d23fa Create FC_FONTFORMAT from FT_Get_X11_Font_Format function where available.
This provides font file format information (BDF, Type 1, PCF, TrueType)
    for each font. Closes #109.
2004-12-05 00:26:06 +00:00
Keith Packard dbf68dd5fe Fix typo.
Add detection for font capabilities (bug #105)
reviewed by: Keith Packard <keithp@keithp.com>
2004-12-04 22:06:52 +00:00
Keith Packard 4f27c1c0a3 Move existing fonts.conf to fonts.conf.bak
Add detection of iconv
Document new selectfont elements
Switch to UTF-8 in comment
Add fullname, and family/style/fullname language entries
Respect selectfont/*/glob
Add support for selectfont
Add multi-lingual family/style/fullname support
Expose FcListPatternMatchAny (which selectfont/*/pattern uses)
Add new FcPatternRemove/FcPatternAppend. FcObjectStaticName stores computed
    pattern element names which are required to be static.
2004-12-04 19:41:10 +00:00
Owen Taylor f077d662c0 Add a FC_HINT_STYLE key for patterns, with possible values
HINT_NONE/HINT_SLIGHT/HINT_MEDIUM/HINT_FULL. (Bug #117)
2003-09-23 20:12:20 +00:00
Noah Levitt a05d257fb3 Add new spacing value FC_DUAL (dual-width, as some CJK fonts). (bug #111)
When checking for monospace and dual-width fonts, allow roughly a 3%
    variance in the advances.
2003-09-06 19:40:41 +00:00
Keith Packard 1f71c4d878 Add book constant for book weight 2003-05-02 01:11:09 +00:00
Keith Packard 81fa16c336 add font widths and extend weight from OS/2 table 2003-03-12 22:16:43 +00:00
Keith Packard 94421e4097 use FcToLower instead of tolower 2003-03-05 05:53:10 +00:00
Keith Packard 1852d49035 Add FC_RGBA_UNKNOWN 2002-10-02 07:11:30 +00:00
Keith Packard a342e87dc3 Add fontversion field 2002-09-26 00:17:28 +00:00
Keith Packard 9dac3c5945 More complete memory tracking. Install always overwrites header files 2002-08-31 22:17:32 +00:00
Keith Packard d8d7395877 Reimplement FC_LANG as FcTypeLang, freeze patterns, other cleanup 2002-08-22 07:36:45 +00:00
Keith Packard fa244f3d88 Various config changes plus a couple of optimizations from Owen 2002-08-19 19:32:05 +00:00