To only work on writable charsets. Also, return a bool indicating whether
the merge changed the charset.
Also changes the implementation of FcCharSetMerge and FcCharSetIsSubset
Previously an index j was added to element score to prefer matches earlier
in the value list to the later ones. This index started from 0, meaning
that the score zero could be generated for the first element. By starting
j from one, scores for when the element exists in both pattern and font
can never be zero. The score zero is reserved for when the element is
NOT available in both font and pattern. We will use this property later.
This shouldn't change matching much. The only difference I can think of
is that if a font family exists both as a bitmap font and a scalable
version, and when requesting it at the size of the bitmap version,
previously the font returned was nondeterministic. Now the scalable
version will always be preferred.
Previously the matcher multiplied comparison results by 100 and added
index value to it. With long lists of families (lots of aliases),
reaching 100 is not that hard. That could result in a non-match early
in the list to be preferred over a match late in the list. Changing
the multiplier from 100 to 1000 should fix that.
To keep things relatively in order, the lang multiplier is changed
from 1000 to 10000.
Previously fc-match "xxx,nazli" matched Nazli, but "xxx, nazli" didn't.
This was because of a bug in FcCompareFamily's short-circuit check
that forgot to ignore spaces.
I can't understand why the special case is needed. Indeed, removing it
does not make any difference in the "fc-match --verbose" output, and
that's the only time fc-match uses FcPatternPrint.
Two changes:
- after mkdir(), we immediately chmod(), such that we are not affected
by stupid umask's.
- if a directory we want to use is not writable but exists, we try a
chmod on it. This is to recover from stupid umask's having affected
us with older versions.
The current behaviour of FcSortWalk() is to create a new FcCharSet on
each iteration that is the union of the previous iteration with the next
FcCharSet in the font set. This causes the existing FcCharSet to be
reproduced in its entirety and then allocates fresh leaves for the new
FcCharSet. In essence the number of allocations is quadratic wrt the
number of fonts required.
By introducing a new method for merging a new FcCharSet with an existing
one we can change the behaviour to be effectively linear with the number
of fonts - allocating no more leaves than necessary to cover all the
fonts in the set.
For example, profiling 'gedit UTF-8-demo.txt'
Allocator nAllocs nBytes
Before:
FcCharSetFindLeafCreate 62886 2012352
FcCharSetPutLeaf 9361 11441108
After:
FcCharSetFindLeafCreate 1940 62080
FcCharSetPutLeaf 281 190336
The savings are even more significant for applications like firefox-3.0b5
which need to switch between large number of fonts.
Before:
FcCharSetFindLeafCreate 4461192 142758144
FcCharSetPutLeaf 1124536 451574172
After:
FcCharSetFindLeafCreate 80359 2571488
FcCharSetPutLeaf 18940 9720522
Out of interest, the next most frequent allocations are
FcPatternObjectAddWithBinding 526029 10520580
tt_face_load_eblc 42103 2529892
Note that this also fixes a bug with FcFontList() where previously
it was NOT checking whether the config is up-to-date. May want to
keep the old behavior and document that ScanInterval is essentially
unused internally (FcFontSetList uses it, but we can remove that
too).
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.
The fact that we now drop final slashes from all filenames without
checking that the file name represents a directory may surprise some,
but it doesn't bother me really.
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.
It seems indices in _FcMatchers array are slightly mixed up, MATCH_DECORATIVE
should be 10, not 11.
And MATCH_RASTERIZER_INDEX should be 13, not 12, right?
Libtool-2.2 introduces new restrictions. So now it does not allow LT_*
variables as it includes marcros:
m4_pattern_forbid([^_?LT_[A-Z_]+$])
Rename the LT_ variables to LIBT_ to work around this restriction.
Building 2.5.91 on Solaris with the native make(1) yields
...
Making all in src
make: Fatal error in reader: Makefile, line 313: Unexpected end of line seen
Current working directory /tmp/fontconfig-2.5.91/src
*** Error code 1
This is due to the following line (src/Makefile.am:143):
CLEANFILES := $(ALIAS_FILES)
Changing that to a standard assignment ("=") fixes the problem.
I believe the ":=" is a typo. ALIAS_FILES is just a statically assigned
variable; it's not like evaluating it more than once would be a problem.
If the /usr/bin/head program is missing or unusable, or if an unusable head
program is listed first in the PATH, fontconfig fails to build
using "sed -n 1p" instead of "head -1" would be a suitable workaround.
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.
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.
Bitmap-only TrueType fonts without a glyf table will not load a glyph when
FT_LOAD_NO_SCALE is set. Work around this by identifying TrueType fonts that have no
glyphs and select a single strike to measure the glyph map with.
For Version 2.5.0, (same for previous version 2.4.2), in source file fccfg.c,
on line 700,
Original:
ret = FcStrCmpIgnoreCase (left.u.s, right.u.s) == 0;
Should change to:
ret = FcStrStrIgnoreCase (left.u.s, right.u.s) == 0;
I think this is just a mistake when copy-n-paste similar codes in the same
function. Apparently, return for "Not_contain" should be just the inverse of
"Contain", not the same as "Equal".
Fix a couple of longstanding problems with fontconfig on Windows that
manifest themselves especially in GIMP. The root cause to the problems is in
Microsoft's incredibly stupid stat() implementation. Basically, stat()
returns wrong timestamp fields for files on NTFS filesystems on machines
that use automatic DST switching.
See for instance http://bugzilla.gnome.org/show_bug.cgi?id=154968 and
http://www.codeproject.com/datetime/dstbugs.asp
As fccache.c now looks at more fields in the stat struct I fill in them all.
I noticed that fstat() is used only on a fd just after opening it, so on
Win32 I just call my stat() replacement before opening instead...
Implementing a good replacement for fstat() would be harder because the code
in fccache.c wants to compare inode numbers. There are no (readily
accessible) inode numbers on Win32, so I fake it with the hash of the full
file name, in the case as it is on disk. And fstat() doesn't know the full
file name, so it would be rather hard to come up with a inode number to
identify the file.
The patch also adds similar handling for the cache directory as for the fonts
directory: If a cachedir element in fonts.conf contains the magic string
"WINDOWSTEMPDIR_FONTCONFIG_CACHE" it is replaced at runtime with a path under
the machine's (or user's) temp folder as returned by GetTempPath(). I don't
want to hardcode any pathnames in a fonts.conf intended to be distributed to
end-users, most of which who wouldn't know how to edit it anyway. And
requiring an installer to edit it gets complicated.
This reverts commit b607922909.
Conflicts:
src/Makefile.am
Xft still uses the macros that are in fcprivate.h. Document those macros and
include fcprivate.h in the published header files.
These two names are typos of the correct names. Instead of simply changing
them, the correct thing to do is leave them in the library, add the correct
functions and mark them as deprecated so any source packages will be updated.
This requires bumping the minor version of the library (for adding APIs)
instead of bumping the major version of the library (for removing APIs).
fcprivate.h was supposed to extend the fontconfig API for the various
fontconfig utilities. Instead, just have those utilities use the internal
fcint.h header file (which they already do), removing fcprivate.h from the
installation and hence from the defacto public API.
If the provided style value doesn't match any available font, fall back to
using the weight and slant values by ensuring that those are in the pattern.
Glyph names (now used only for dingbats) were using many relocations,
causing startup latency plus per-process memory usage. Replace pointers with
table indices, shrinking table size and elimninating relocations.
The cache was inserted into the hash table before the timestamps in the
cache were verified; if that verification failed, an extra pointer to the
now freed cache would be left in the hash table. FcFini would fail an
assertion as a result.
If ~/.fonts.conf contains:
<edit mode="assign_replace" name="spacing">
<int>mono</int>
</edit>
fontconfig crashes:
mfabian@magellan:~$ fc-match sans
Fontconfig error: "~/.fonts.conf", line 46: "mono": not a valid
integer
セグメンテーション違反です (core dumped)
mfabian@magellan:~$
Of course the above is nonsense, “mono” is no valid integer indeed.
But I think nevertheless fontconfig should not crash in that case.
The problem was caused by partially truncated expression trees caused by
parse errors -- typechecking these walked the tree without verifying the
integrity of the structure. Of course, the whole tree will be discarded
shortly after being loaded as it contained an error.
Some mingw versions have broken X_OK checking; instead of trying to work
around this in a system-depedent manner, simply don't bother checking for
X_OK along with W_OK as such cases are expected to be mistakes, and not
sensible access control.
The old policy of eliding fullname entries which matched FC_FAMILY or
FC_FAMILY + FC_STYLE meant that applications could not know what the
font foundry set as the fullname of the font. Hiding information is not
helpful.
Instead of relying on mtime ordering between a directory and its associated
cache file, write the directory mtime into the cache file itself. This makes
cache file checks more reliable across file systems.
This change is made in a way that old programs can use new cache files, but
new programs will need new cache files.
In FcDirCacheUnlink(), the line
cache_hashed = FcStrPlus (cache_dir, cache_base);
allocates memory in cache_hashed that is never free()'d before the function
exits.
Reported by Ben Combee.
Recent versions of FreeType do not correctly deal with glyph name buffers
that are too small; work around this by declaring a buffer that can hold any
PS name (127 bytes).
I noticed that Qt always uses a different font than fc-match advertises.
Debugging the issue, I found that a call that looks pretty innocent is
changing all weak bindings to strong bindings and as such changes the
semantic of the match: FcPatternDuplicate.
Missing NULL font check before attempting to edit scanned pattern.
Also, <match target="scan"> rules are now checked to ensure all
edited variables are in the predefined set; otherwise, the resulting
cache files will not be stable.
src/fccache.c uses a trick to try and use a function name that is also a
macro name. It does this using the varargs args() macro. Replace that
with separate macros for each number of formals.
grep -l -w '^foo' doesn't work on Solaris. Replace with
grep -l '^foo\>' instead which does. Also, grep -l will
report the filename more than once (!), so add | head -1
to pick just the first one.
The union inside the FcValue structure contains pad bytes. Instead of
copying the whole structure to the cache block, copy only the initialized
fields to avoid writing whichever bytes serve as padding within the
structure.
When updating from older fontconfig versions, if the config file
is not replaced, it will not contain <cachedir> elements. Lacking these,
fontconfig has no place to store cached font information and cannot operate
reasonably.
Add code to check and see if the loaded configuration has no cache
directories, and if so, warn the user and add both the default system cache
directory and the normal per-user cache directory.
Instead of accepting whatever order names appear in the font file,
use an explicit ordering for both platform and nameid.
Platforms are high precedence than nameids.
The platform order is:
microsoft, apple unicode, macintosh, (other)
The family nameid order is:
preferred family, font family
The fullname nameid order is:
mac full name, full name
The style nameid order is
preferred subfamily, font subfamily
This will change the names visible to users in various application UIs, but
should not change how existing font names are matched as all names remain
present in the resulting database. The hope is that family names will, in
general, be less ambiguous. Testing here shows that commercial fonts
have longer names now while DejaVu has a shorter family name, and moves more
of the font description to the style name.
Our build system barfs on autogen.sh, which ignores --noconfigure. Configure
needs a host of options to make the cross compile work in our case.
Fix typo in fccache.c
FcStrCanonFileName checks whether s[0] == '/', and recurses if not.
This only works on POSIX. On dos, this crashes with a stack overflow.
The patch attached splits this functionality in two functions
(FcStrCanonAbsoluteFilename) and uses GetFullPathName on windows to get an
absolute path. It also fixes a number of other issues. With this patch,
LilyPond actually produces output on Windows.
Instead of attempting to track exported symbols manually in
fontconfig.def.in, build it directly from the public fontconfig header files
to ensure it exports the public API.
With the cache restructuring of 2.4.0, the ability to add
application-specific font files and directories was accidentally lost.
Reimplement this using by sharing the logic used to load configured font
directories.
All caches used in the application must be in the cache reference list so
internal references can be tracked correctly. Failing to have newly created
caches in the list would cause the cache to be deallocated while references
were still present.
Locale environment variables (LC_ALL, LC_CTYPE, LANG) must contain language,
and may contain territory and encoding. Don't accidentally require territory
as that will cause fontconfig to fall back to 'en'.
makealias was using a gnu-extension to sed addressing, replace that with a
simple (and more robuse) grep command. Also, found a bug in the public
header file that was leaving one symbol out of the process.
The existing loop for discovering which characters map to glyphs is ugly and
inefficient. The replacement is functionally identical, but far cleaner and
faster.
Charset hashing actually use the value of the leaf pointers, which is
clearly wrong, especially now that charsets are not shared across multiple
font directories.
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
Eliminate need to reference cache object once per cached font, instead
just count the number of fonts used from the cache and bump the reference
count once by that amount. I think this makes this refernece technique
efficient enough for use.
Caches contain patterns and character sets which are reference counted and
visible to applications. Reference count the underlying cache object so that
it stays around until all reference objects are no longer in use.
This is less efficient than just leaving all caches around forever, but does
avoid eternal size increases in case applications ever bother to actually
look for changes in the font configuration.
Without reference counting on cache objects, there's no way to know when
an application is finished using objects pulled from the cache. Until some
kinf of cache reference counting can be done, leave all cache objects mapped
for the life of the library (until FcFini is called). To mitigate the cost
of this, ensure that each instance of a cache file is mapped only once.
Borrowing header stuff written for cairo, fontconfig now exposes in the
shared library only the symbols which are included in the public header
files. All private symbols are hidden using suitable compiler directives.
A few new public functions were required for the fontconfig utility programs
(fc-cat and fc-cache) so those were added, bumping the .so minor version number
in the process.
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.
Use the version number inside the cache file to mark backward compatible
changes while continuing to reserve the filename number for incompatible
changes.
Instead of making filename canonicalization occur in multiple places, it
occurs only in FcStrAddFilename now, as all filenames pass through that
function at one point.
Many Japanese fonts incorrectly include names tagged as Roman encoding and
English language which are actually Japanese names in the SJIS encoding.
Guess that names with a large number of high bits set are SJIS encoded
Japanese names rather than English names.
A pattern specifying 'Chinese' (:lang=zh) without a territory should be
satisfied by any font supporting any Chinese lang. The code was requiring
that the lang tags match exactly, causing this sort to fail.
Within a fontset, the patterns are stored as pointers in an array.
When stored as offsets, the offsets are relative to the fontset object
itself, not the base of the array of pointers.
Charset freezer api now uses allocated object. Also required minor fixes to
charset freezer code to remove assumption that all input charsets are
persistant.
Instead of passing directory information around in separate variables,
collect it all in an FcCache structure. Numerous internal and tool
interfaces changed as a result of this.
Charsets are now pre-frozen before being serialized. This causes them to
share across multiple fonts in the same cache.
Automatically list all font directories when no arguments are given to
fc-cat. Also add -r option to recurse from specified cache directories.
fc-cat also now prints the cache filename in verbose mode, along with the
related directory name.
Validate cache contents and skip broken caches, looking down cache path for
valid ones.
Every time a directory is scanned, it will be written to a cache file if
possible, so fc-cache doesn't need to re-write the cache file. This makes
detecting when the cache was generated a bit tricky, so we guess that if the
cache wasn't valid before running and is valid afterwards, the cache file
was written.
Also, allow empty charsets to be serialized with null leaves/numbers.
Eliminate a leak in FcEdit by switching to FcObject sooner.
Call FcFini from fc-match to make valgrind happy.
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.
FcCharSetSerialize was computing the offset to the unserialized leaf,
which left it pointing at random data when the cache was reloaded.
fc-cat has been updated to work with the new cache structure.
Various debug messages extended to help diagnose serialization errors.
Pagesize no longer matters in architecture decisions, the entire cache file
is mmaped into the library. However, lots of intptr_t values are in use now,
so that value is important.
fc-lang now requires fcserialize.c, which has been added to the repository.
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.
The fancy new FcFontSetMatch algorithm would discard fonts for the
wrong reasons; fc-match sans:lang=en,ja would discard all fonts without
Japanese support. This commit reverts to the original algorithm which
ensure that FcFontSetMatch always matches the first font in the
FcFontSetSort return list.
FcStrCanonFilename eliminates ./ and ../ elements from pathnames through
simple string editing. Also, relative path names are fixed by prepending the
current working directory.
With the removal of the in-directory cache files, and the addition of
per-user cache directories, there is no longer any reason to preserve the
giant global cache file. Eliminating of this unifies the cache structure
and simplifies the overall caching strategies greatly.
Normalized directory names offer protection against looped directory trees
but cost enormous numbers of system calls (stat per file in the hierarchy).
Also, cache file directory name contents are validated each time the
directory is modified, don't re-validate every time the cache file is loaded
with an access and stat call.
Previous policy was to attempt to update the cache in place and bail if that
didn't work. Now, search for the first writable directory and place the
cache file there instead. Furthermore, on startup, search directory list for
valid cache files instead of bailing if the first found cache file wasn't
valid.
permitting cache files to be stored in font dirs. Bump cache magic.
Don't include /fonts.cache-2 in cache hash construction.
reviewed by: Patrick Lam <plam@mit.edu>
Check if pattern is not null before using it (Coverity defect #1883).
Fix memory leak with hash collision (Coverity defect #1829).
Fix memory leak when bail cases (Coverity defect #1828).
Don't leak directory name (Coverity defect #1827).
reviewed by: plam
Make fontconfig compile under MinGW:
1) remove unneeded #includes;
2) make use of mmap and sysconf conditional;
3) replace rand_r by srand/rand if needed;
4) use chsize instead of ftruncate; and
5) update libtool exports file
Fix missing FcCacheBankToIndex in FcCharSetInsertLeaf. Declare extern for
static arrays as arrays, not pointers. (Part of the fix for 'fonts
don't have en' issue after Euro patch.)
(I forgot to commit the ChangeLog last time.)
reviewed by: plam
machine into FcGlobalCacheDir to avoid doing inappropriate operations
on global dir entries, e.g. writing out an out-of-date cache entry.
reviewed by: plam
current config in fc-cache.c. Fix treatment of cache directory as read
from cache file; don't use string equality to determine if we have the
right file, use inode equality.
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
Minor change to global cache file format to fix fc-cat bug reported by
Frederic Crozat, and buglet with not globally caching directories with
zero fonts cached.
Use open instead of fopen (requested by Phil Race for Sun).
src/fccache.c (FcDirCacheWrite);
Fix GCC4 warning and Makefile brokenness for /var/cache/fontconfig dir.
helps make fontconfig FHS-compliant, but requires that all caches get
rebuilt.
Also, autogen.sh now needs the additional parameter
--localstatedir=/var.
Rewrite FcFontSetMatch to a path-finding based algorithm, i.e. inline
FcCompare into FcFontSetMatch and reorder the loops, adding a boolean
array which blocks patterns from future consideration if they're known
to not be best on some past criterion.
Check for type validity during FcPatternAddWithBinding, don't verify type
in FcFontMatch, don't call FcCanonicalize here (which always does a
deep copy).
reviewed by: plam
those headers will go away with freetype 2.2. Replace with public
domain ftglue code from pango. Note that the patch removes some extra
error checking in FT_Get_BDF_Property() and comments out the skipping
of empty pcf fonts.
reviewed by: plam
those headers will go away with freetype 2.2. Replace with public
domain ftglue code from pango. Note that the patch removes some extra
error checking in FT_Get_BDF_Property() and comments out the skipping
of empty pcf fonts.
reviewed by: plam
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
fully-qualified font names for clients' benefit. Clients only pay for
the font names once they request the FC_FILE property from an
FcPattern, but the font name is malloc'd at that point (i.e. not
mmapped: that's impossible, since it may vary between machines.)
Clients do have to pay for a copy of the path name per cache file.
Note that FcPatternGetString now does some rewriting if you ask for an
FC_FILE, appending the pathname as appropriate.
fc-cache once per cached architecture; add some documentation to the
FcCache structure.
Make fc-cache write out fonts.cache-2 files for directories with no fonts
(i.e. only subdirectories).
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!
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.
data format. Also match subdirectories when consuming cache
information. Also check dates for global cache: a dir is out of date if
it is newer than the global cache; scan it manually if that's the case.
Save subdirectory names in cache files to save time. This completely
restores the original fontconfig API, BTW. Note that directories
without fonts don't get a cache file; but then how many files would it
have in that directory...
*Serialize no longer mutates original FcPatterns, it creates a new copy
in the supplied buffer. Fix thinkos in global cache freeing and in
FcCacheSkipToArch.
The global cache now uses the same mmap-based cache infrastructure as the
per-directory caches. Furthermore, the global cache is automatically
updated (if possible) whenever fontconfig is used. Rip out remnants of
the old cache infrastructure.
'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.
probably all right to use the global cache as it was previously and
just store filenames and font info, as long as no mmap cache exists in
the directory. Of course, if an mmap cache exists, use that instead.
If a directory cache does not exist or is invalid, load the fonts for just
that directory using the old codepath.
Fix premature free of the FcPatterns belonging to the FcFontSet which we
create from the mmapped files.
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.
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.
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.
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.
override this in ~/.fonts.conf
Updated translations
Destroy font configuration on exit to help valgrind
Use own transcoding routines in preference to iconv which appears to have
leaks in some translators. Call iconv_close after using iconv (oops).
Prefer unicode encoding of Euro char as some fonts mis-encode Euro in other
ones.
Must fetch bitmap glyphs to get width values to check for
monospace/dual-width fonts.
Include 2.3 release information in changelog Add Josselin Mouette as an
Uploader Set hinting_type to low priority configuration option
Manish Singh:
yes_bitmaps.conf -> yes-bitmaps.conf
Funda Wang:
Johap -> Johab
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
Add new helper program 'fc-case' to construct case folding tables from
standard Unicode CaseFolding.txt file
Re-implement case insensitive functions with Unicode aware versions
(including full case folding mappings)
of language matching.
What I did was to ammend the strict sort order used by FcFontSort so that
it 'satisfies' the language specified in the pattern by locating the
best matching font supporting each pattern language and then ignores
language in the remaining fonts for purposes of matching.
So, when asking for 'sans:lang=en', you'll get an English font first, and
then the remaining fonts sorted with respect to the 'sans' alias alone
-- pushing Kochi fonts ahead of other English-supporting Han fonts.
reviewed by: Owen Taylor <otaylor@redhat.com>
memoize strings and share a single copy for all uses. Note that this could
be improved further by using statically allocated blocks and gluing
multiple strings together, but I'm basically lazy. In my environment
with 800 font files, I get a savings of about 90KB.
multi-arch installs. Now that all X fonts are included without
prejudice, the chances of the date being at all interesting are rather
limited. Bug #415.
Add copyright and license
wherever the X fonts are located).
Document new <include>directory-name</include> semantics
add <include ignore_missing="yes">conf.d</include>
Add selectfont to ignore bitmap fonts, add comment for selectfont which
accepts bitmap fonts.
Allow <include> configuration elements to reference directories. Parse and
load all files of the form [0-9]* in sorted order.
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.
However FcConfigUptoDate() doesn't seem to work. See the attached patch.
First there's an obvious misplaced parenthesis making it return always
false, and second, even this call fails to detect font changes (e.g.
adding a new font to /usr/X11R6/lib/X11/fonts/truetype). The patch
should fix that as well. The problem seems to be triggered by my
fonts.conf specifying only /usr/X11R6/lib/X11/fonts , and therefore
config->configDirs doesn't include subdirs, unlike config->fontDirs.
fails in this way
Make #warning about lacking various FreeType features indicate which
version those features appeared so users know how to fix the problem
(Thanks to Anton Tropashko)
clean up .spec file; perhaps this will be useful to somebody...
Update to 2.2.93
Make 'scanopen' static so GCC doesn't whine about lacking prototype
Add WARN_CFLAGS to pass -W flags for GCC systems
Change various char types around to match across function calls. Fixed bug
in using available_sizes[i].height which is in pixels, not 64ths of a
pixel.
Oops. Left 'newest.set' unset, which would miscompute the newest file
Add FcGetPixelSize to extract correct pixel size from bdf/pcf font
properties (which report the wrong value in current FreeType)
Don't attempt to check for empty glyphs in non-scalable fonts; they have no
outlines...
when trying to save the cache if config->cache is NULL, which happens
if FcConfigHome() is NULL. Guard against that by using the temp folder
in that case.
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
Set FC_DEFAULT_FONTS on Win32 to the WINDOWSFONTDIR token.
Move the LIBRARY and VERSION lines to the end, not to confuse libtool,
which expects the EXPORTS line to be the first. Add FcConfigEnableHome.
On Windows with gcc (a.k.a. mingw) build as a DLL.
We don't want to hardcode the fonts.conf file location in the DLL, so we
look up the DLL location at run-time in a DllMain() function. The
fonts.conf location is deduced from that.
The colon can't be used as path separator on Windows, semicolon is used
instead. File path components can be separated with either slash or
backslash. Absolute paths can also begin with a drive letter.
Add internal function FcStrLastSlash that strrchr's the last slash, or
backslash on Windows.
There is no link() on Windows. For atomicity checks, mkdir a lock directory
instead.
In addition to HOME, also look for USERPROFILE.
Recognize the special font directory token WINDOWSFONTDIR, to use the
system's font directory.
Remove the fontconfig-def.cpp that was obsolete. Add fontconfig.def(.in),
without internal functions.
Add a fontconfig-zip(.in) script, used to build a binary distribution.
funcs into fc-lang, which was done by refactoring code in fccharset.c
and fcfreetype.c a bit
Updated ethiopic orthographies
Remove imake support
Install empty local.conf file if none is present
Had accidentally swapped codePageRange bits for traditional and
simplified chinese. Add persian (fa) and HKSCS (zh-hk). Fix possible
bug in charset walking