Commit Graph

47 Commits

Author SHA1 Message Date
Behdad Esfahbod 0d47cfabd8 Bug 28958 - lang=en matches other langs
Patch from Akira TAGOH.
2010-12-07 18:48:56 -05: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 a3b2426819 [lang] Fix serializing LangSet from older versions 2009-11-16 18:29:26 -05:00
Behdad Esfahbod 8480c6f863 [arch] Try to ensure proper FcLangSet alignment in arch 2009-11-16 17:46:18 -05:00
Behdad Esfahbod 1f4e6fecde Bump cache version up from 2 to 3 and fix FcLangSet caching/crash
Protect cache against future expansions of FcLangSet (adding new
orth files).  Previously, doing so could change the size of
that struct.  Indeed, that happened between 2.6.0 and 2.7.3, causing
crashes.  Unfortunately, sizeof(FcLangSet) was not checked in fcarch.c.

This changes FcLangSet code to be able to cope with struct size changes.
And change cache format, hence bumping from 2 to 3.
2009-11-16 17:46:12 -05:00
Behdad Esfahbod c5f0a65b36 Revert "Fix FcNameUnparseLangSet()" and redo it
This reverts commit 5c6d1ff23b and
fixes that bug using the new reverse-map I added in the previous
commit.
2009-08-25 20:41:34 -04:00
Behdad Esfahbod d354a321ee Bug 23419 - "contains" expression seems not working on the fontconfig rule
Fix bug in FcLangSetContains(), similar to
5c6d1ff23b
2009-08-25 20:39:20 -04:00
Behdad Esfahbod 7c12181f7a Improve charset printing 2009-07-28 14:23:10 -04:00
Behdad Esfahbod 5c6d1ff23b Fix FcNameUnparseLangSet()
Was broken since ffd6668b46
2009-07-22 19:25:24 -04:00
Behdad Esfahbod ffd6668b46 [fc-lang] Make LangSet representation in the cache files stable
Fontconfig assigns an index number to each language it knows about.
The index is used to index a bit in FcLangSet language map.  The bit
map is stored in the cache.

Previously fc-lang simply sorted the list of languages and assigned
them an index starting from zero.  Net effect is that whenever new
orth files were added, all the FcLangSet info in the cache files would
become invalid.  This was causing weird bugs like this one:

  https://bugzilla.redhat.com/show_bug.cgi?id=490888

With this commit we fix the index assigned to each language.  The index
will be based on the order the orth files are passed to fc-lang.  As a
result all orth files are explicitly listed in Makefile.am now, and
new additions should be made to the end of the list.  The list is made
to reflect the sorted list of orthographies from 2.6.0 released followed
by new additions since.

This fixes the stability problem.  Needless to say, recreating caches
is necessary before any new orthography is recognized in existing fonts,
but at least the existing caches are still valid and don't cause bugs
like the above.
2009-06-24 13:52:10 -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 d62b85af21 [fclang] Implement FcLangSetGetLangs() (#18846) 2009-02-15 14:13:34 -08:00
Behdad Esfahbod 317b849215 Replace RCS Id tags with the file name 2009-02-13 16:53:55 -08:00
Keith Packard a0a1da22a4 Include fcftaliastail.h so that the freetype funcs are exported.
This header file needs to be included at the end of every file that
exports any freetype symbols.
2008-01-07 16:31:06 -08:00
Keith Packard dbd065ad31 Remove freetype requirement for build-time applications.
This avoids requiring the freetype development files when cross compiling
2008-01-02 08:47:14 -08:00
Behdad Esfahbod cf223cc7bc Add FcGetLangs() and FcLangGetCharSet(). 2007-11-05 15:29:44 -05:00
Keith Packard c833409f6b Use FcLangDifferentTerritory instead of FcLangDifferentCountry. 2007-11-03 21:58:34 -07:00
Keith Packard e85789a997 Place language name in constant array instead of pointer.
Constant char array of 8 bytes is the same size as a pointer plus a short
string, so this actually saves memory and eliminates a pile of relocations.
2007-10-18 08:58:14 -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 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 2de24638b2 Missing bits from previous patches.
Remove extra semi-colon.
Fix memory leak in error case (Coverity defects #776, #985).
Fix memory leaks (Coverity defects #779, #781) and memory use after free
    (Coverity defect #780).
reviewed by: plam
2006-04-11 16:54:24 +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 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 0d745819a9 Fix intel compiler warnings: make many variables static, eliminate
duplicate names, reduce variable scopes, unsigned/signed printf
    formatting.
reviewed by: plam
2006-04-06 04:33:11 +00:00
Patrick Lam b36f2a39d0 Fix suspicious return expression which causes junk to be returned.
reviewed by: plam
2006-03-03 06:11:31 +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 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 82f35f8bb4 Fix bug 2878 (excessive relocations at startup for charsets, reported by
Ross Burton): fc-lang/fc-lang now creates the static form of the
    langset, not the dynamic form, so that the charsets should now be in
    .rodata.
2005-11-04 19:31:26 +00:00
Patrick Lam 21696e5bf0 Add consts to variables so as to move arrays into .rodata.
reviewed by: plam
2005-10-14 21:02:31 +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 212c9f437e #ifdef out old cache stuff, replace with first version of new mmapping
cache. Add *Read and *Write procedures which mmap in and write out the
    fontconfig data structures to disk. Currently, create cache in /tmp,
    with different sections for each architecture (as returned by uname's
    .machine field. Run the fc-cache binary to create a new cache file;
    fontconfig then uses this cache file on subsequent runs, saving lots of
    memory. Also fixes a few bugs and leaks.
2005-07-25 04:10:09 +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 46b51147d1 Change files from ISO-Latin-1 to UTF-8 2004-12-07 01:14:46 +00:00
Keith Packard 74a623e02e Implement new semantics for Contains and LISTING:
LISTING requires that the font Contain all of the pattern values, where
    Contain is redefined for strings to mean precise matching (so that
    Courier 10 Pitch doesn't list Courier fonts)
"Contains" for lang means both langs have the same language and either the
    same country or one is missing the country
2003-07-20 16:06:18 +00:00
Keith Packard 947afeb566 Optimization in FcLangSetIndex was broken, occasionally returning a pointer
to the wrong location on miss
2003-06-09 17:31:03 +00:00
Colin Walters 12d49d3cf4 Remove some unused variables, and initialize some other ones so gcc doesn't
warn us.
2003-04-17 17:43:04 +00:00
Keith Packard cc9dd09816 switch // comment 2003-03-22 01:55:00 +00:00
Keith Packard 793e946c2f AddFcLangSetContains for font listing, add first-letter table for language
lookups, change RCS tag
2003-03-05 05:52:31 +00:00
David Dawes 234397b429 633. Perform country-independent matching for Chinese languages in
fontconfig (#A.1406, Keith Packard).
2002-12-14 02:03:59 +00:00
Keith Packard 2458a6d8d8 FcLangSetHasLang was not actually checking the language set itself 2002-08-26 23:34:31 +00:00
Keith Packard 47d4f9501f Add contains/not_contains, fix LangSet equal operator to use FcLangEqual 2002-08-22 18:53:22 +00:00
Keith Packard d8d7395877 Reimplement FC_LANG as FcTypeLang, freeze patterns, other cleanup 2002-08-22 07:36:45 +00:00
Keith Packard c80d2ac486 Clean up some coverage files; a few accidentally included PUA values and
punctuation. Add debugging stuff to dump out missing codepoints during
    cache building when missing only a few
2002-07-12 21:06:03 +00:00
Keith Packard e50b9ae711 Update iso639-2 language coverage info, fix Georgian orthography to
eliminate Mingrelian and Svan glyphs, use coverage for inclusion and
    OS/2 for Han exclusion, restructure fclang.c to use fclang.h from
    fc-lang dir
2002-07-08 07:31:53 +00:00
Keith Packard d6dabf3686 Add walloon, update fclang.c to include recent language additions 2002-07-07 19:30:53 +00:00
Keith Packard 3de8881ec9 Add fclang.c to CVS; easier than attempting to build it on the fly 2002-07-07 00:00:43 +00:00