+2006-04-07 Dominic Lachowicz <cinamod@hotmail.com>
+ Patrick Lam <plam@mit.edu>
+ * configure.in:
+ * fc-cache/fc-cache.c:
+ * fc-cat/fc-cat.c:
+ * src/fccache.c (FcGlobalCacheSave, FcCacheNextOffset,
+ FcDirCacheConsume, FcDirCacheProduce,
+ FcDirCacheWrite, FcCacheMachineSignature):
+ * src/fcfreetype.c (FcFreeTypeQuery):
+ * src/fontconfig.def.in:
+
+ 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
+
2006-04-07 Patrick Lam <plam@mit.edu>
* src/fcdir.c (FcDirScanConfig):
#include <fcntl.h>
#include <dirent.h>
#include <string.h>
-#include <sys/mman.h>
-#include <sys/utsname.h>
#include <sys/types.h>
#include <unistd.h>
#include "fcint.h"
#include <unistd.h>
+#if defined(HAVE_MMAP) || defined(__CYGWIN__)
+# include <sys/mman.h>
+# include <sys/utsname.h>
+#endif
#define ENDIAN_TEST 0x12345678
#define MACHINE_SIGNATURE_SIZE (9 + 5*20 + 1)
+/* for when we don't have sysconf: */
+#define FC_HARDCODED_PAGESIZE 8192
#ifndef O_BINARY
#define O_BINARY 0
goto bail3;
current_arch_start = lseek(fd, 0, SEEK_CUR);
+#if defined (HAVE_FTRUNCATE)
if (ftruncate (fd, current_arch_start) == -1)
goto bail3;
+#else
+#if defined (HAVE_CHSIZE)
+ if (chsize (fd, current_arch_start) == -1)
+ goto bail3;
+#else
+ goto bail3;
+#endif
+#endif
header = malloc (10 + strlen (current_arch_machine_name));
if (!header)
{
static long pagesize = -1;
if (pagesize == -1)
+#if defined (HAVE_SYSCONF)
pagesize = sysconf(_SC_PAGESIZE);
+#else
+ pagesize = FC_HARDCODED_PAGESIZE;
+#endif
if (w % pagesize == 0)
return w;
else
}
pos = FcCacheNextOffset (lseek(fd, 0, SEEK_CUR));
+#if defined(HAVE_MMAP) || defined(__CYGWIN__)
current_dir_block = mmap (0, metadata.count,
PROT_READ, MAP_SHARED, fd, pos);
- lseek (fd, pos+metadata.count, SEEK_SET);
if (current_dir_block == MAP_FAILED)
return FcFalse;
+#else
+ current_dir_block = malloc (metadata.count);
+ if (!current_dir_block)
+ return FcFalse;
+
+ /* could also use CreateMappedViewOfFile under MinGW... */
+ if (read (fd, current_dir_block, metadata.count) != metadata.count)
+ goto bail;
+#endif
+ lseek (fd, pos+metadata.count, SEEK_SET);
FcCacheAddBankDir (metadata.bank, dir);
if (config)
FcConfigAddFontDir (config, (FcChar8 *)dir);
if (!FcFontSetUnserialize (&metadata, set, current_dir_block))
- return FcFalse;
+ goto bail;
return FcTrue;
+ bail:
+#if !(defined(HAVE_MMAP) || defined(__CYGWIN__))
+ free (current_dir_block);
+#endif
+ return FcFalse;
}
static void *
static unsigned int rand_state = 0;
int bank, needed_bytes_no_align;
+#if defined (HAVE_RAND_R)
if (!rand_state)
rand_state = time(0L);
bank = rand_r(&rand_state);
while (FcCacheHaveBank(bank))
bank = rand_r(&rand_state);
+#else
+ if (!rand_state)
+ {
+ rand_state = 1;
+ srand (time (0L));
+ }
+ bank = rand();
+
+ while (FcCacheHaveBank(bank))
+ bank = rand();
+#endif
memset (metadata, 0, sizeof(FcCache));
FcFontSetNewBank();
close (fd_orig);
current_arch_start = lseek(fd, 0, SEEK_CUR);
+#if defined (HAVE_FTRUNCATE)
if (ftruncate (fd, current_arch_start) == -1)
goto bail4;
+#else
+#if defined (HAVE_CHSIZE)
+ if (chsize (fd, current_arch_start) == -1)
+ goto bail4;
+#else
+ goto bail4;
+#endif
+#endif
/* allocate space for subdir names in this block */
dirs_count = 0;
}
/* this actually serves to pad out the cache file, if needed */
+#if defined (HAVE_FTRUNCATE)
if (ftruncate (fd, current_arch_start + truncate_to) == -1)
goto bail5;
+#else
+#if defined (HAVE_CHSIZE)
+ if (chsize (fd, current_arch_start + truncate_to) == -1)
+ goto bail5;
+#else
+ goto bail5;
+#endif
+#endif
free (header);
close(fd);
(unsigned int)sizeof (FcCharLeaf),
(unsigned int)sizeof (FcChar32),
(unsigned int)sizeof (FcCache),
+#if defined (HAVE_SYSCONF)
(unsigned int)sysconf(_SC_PAGESIZE));
+#else
+ (unsigned int)FC_HARDCODED_PAGESIZE);
+#endif
return buf;
}
EXPORTS
- FcAtomicCreate
- FcAtomicDeleteNew
- FcAtomicDestroy
- FcAtomicLock
- FcAtomicNewFile
- FcAtomicOrigFile
- FcAtomicReplaceOrig
- FcAtomicUnlock
- FcBlanksAdd
+ FcDirCacheValid
+ FcDirCacheHasCurrentArch
+ FcDirCacheUnlink
FcBlanksCreate
FcBlanksDestroy
+ FcBlanksAdd
FcBlanksIsMember
- FcCharSetAddChar
- FcCharSetCopy
- FcCharSetCount
- FcCharSetCreate
- FcCharSetDestroy
- FcCharSetEqual
- FcCharSetFirstPage
- FcCharSetHasChar
- FcCharSetIntersect
- FcCharSetIntersectCount
- FcCharSetIsSubset
- FcCharSetNextPage
- FcCharSetSubtract
- FcCharSetSubtractCount
- FcCharSetUnion
- FcConfigAppFontAddDir
- FcConfigAppFontAddFile
- FcConfigAppFontClear
- FcConfigBuildFonts
- FcConfigCreate
- FcConfigDestroy
+ FcConfigHome
FcConfigEnableHome
FcConfigFilename
- FcConfigGetBlanks
- FcConfigGetCache
- FcConfigGetConfigDirs
- FcConfigGetConfigFiles
+ FcConfigCreate
+ FcConfigDestroy
+ FcConfigSetCurrent
FcConfigGetCurrent
+ FcConfigUptoDate
+ FcConfigBuildFonts
FcConfigGetFontDirs
- FcConfigGetFonts
+ FcConfigNormalizeFontDir
+ FcConfigGetConfigDirs
+ FcConfigGetConfigFiles
+ FcConfigGetCache
+ FcConfigGetBlanks
FcConfigGetRescanInverval
- FcConfigParseAndLoad
- FcConfigSetCurrent
FcConfigSetRescanInverval
- FcConfigSubstitute
+ FcConfigGetFonts
+ FcConfigAppFontAddFile
+ FcConfigAppFontAddDir
+ FcConfigAppFontClear
FcConfigSubstituteWithPat
- FcConfigUptoDate
+ FcConfigSubstitute
+ FcCharSetCreate
+ FcCharSetDestroy
+ FcCharSetAddChar
+ FcCharSetCopy
+ FcCharSetEqual
+ FcCharSetIntersect
+ FcCharSetUnion
+ FcCharSetSubtract
+ FcCharSetHasChar
+ FcCharSetCount
+ FcCharSetIntersectCount
+ FcCharSetSubtractCount
+ FcCharSetIsSubset
+ FcCharSetFirstPage
+ FcCharSetNextPage
+ FcValuePrint
+ FcPatternPrint
+ FcFontSetPrint
+ FcDebugVal
+ FcFontSetUnserialize
FcDefaultSubstitute
- FcDirCacheValid
- FcDirSave
- FcDirScan
FcFileScan
- FcFini
- FcFontList
- FcFontMatch
- FcFontRenderPrepare
- FcFontSetAdd
+ FcDirScan
+ FcDirSave
+ FcFreeTypeQuery
FcFontSetCreate
FcFontSetDestroy
- FcFontSetList
- FcFontSetMatch
- FcFontSetPrint
- FcFontSetSort
- FcFontSetSortDestroy
- FcFontSort
- FcFreeTypeCharIndex
- FcFreeTypeCharSet
- FcFreeTypeQuery
- FcGetVersion
- FcInit
- FcInitBringUptoDate
+ FcFontSetAdd
FcInitLoadConfig
FcInitLoadConfigAndFonts
+ FcInit
+ FcFini
+ FcGetVersion
FcInitReinitialize
- FcLangSetAdd
- FcLangSetCompare
- FcLangSetCopy
+ FcInitBringUptoDate
FcLangSetCreate
FcLangSetDestroy
- FcLangSetEqual
+ FcLangSetCopy
+ FcLangSetAdd
FcLangSetHasLang
+ FcLangSetCompare
+ FcLangSetContains
+ FcLangSetEqual
FcLangSetHash
+ FcObjectSetCreate
+ FcObjectSetAdd
+ FcObjectSetDestroy
+ FcObjectSetVaBuild
+ FcObjectSetBuild
+ FcFontSetList
+ FcFontList
+ FcAtomicCreate
+ FcAtomicLock
+ FcAtomicNewFile
+ FcAtomicOrigFile
+ FcAtomicReplaceOrig
+ FcAtomicDeleteNew
+ FcAtomicUnlock
+ FcAtomicDestroy
+ FcFontSetMatch
+ FcFontMatch
+ FcFontRenderPrepare
+ FcFontSetSort
+ FcFontSort
+ FcFontSetSortDestroy
FcMatrixCopy
FcMatrixEqual
FcMatrixMultiply
FcMatrixRotate
FcMatrixScale
FcMatrixShear
- FcNameConstant
- FcNameGetConstant
+ FcNameRegisterObjectTypes
+ FcNameUnregisterObjectTypes
FcNameGetObjectType
- FcNameParse
FcNameRegisterConstants
- FcNameRegisterObjectTypes
- FcNameUnparse
FcNameUnregisterConstants
- FcNameUnregisterObjectTypes
- FcObjectSetAdd
- FcObjectSetBuild
- FcObjectSetCreate
- FcObjectSetDestroy
- FcObjectSetVaBuild
- FcPatternAdd
- FcPatternAddBool
- FcPatternAddCharSet
- FcPatternAddDouble
- FcPatternAddFTFace
- FcPatternAddInteger
- FcPatternAddLangSet
- FcPatternAddMatrix
- FcPatternAddString
- FcPatternAddWeak
- FcPatternBuild
+ FcNameGetConstant
+ FcNameConstant
+ FcNameParse
+ FcNameUnparse
+ FcNameUnparseEscaped
FcPatternCreate
- FcPatternDel
- FcPatternDestroy
FcPatternDuplicate
+ FcPatternReference
+ FcValueDestroy
+ FcValueEqual
+ FcValueSave
+ FcPatternDestroy
FcPatternEqual
FcPatternEqualSubset
+ FcPatternHash
+ FcPatternAdd
+ FcPatternAddWeak
FcPatternGet
- FcPatternGetBool
- FcPatternGetCharSet
- FcPatternGetDouble
- FcPatternGetFTFace
+ FcPatternDel
+ FcPatternRemove
+ FcPatternAddInteger
+ FcPatternAddDouble
+ FcPatternAddString
+ FcPatternAddMatrix
+ FcPatternAddCharSet
+ FcPatternAddBool
+ FcPatternAddLangSet
FcPatternGetInteger
- FcPatternGetLangSet
- FcPatternGetMatrix
+ FcPatternGetDouble
FcPatternGetString
- FcPatternHash
- FcPatternPrint
- FcPatternReference
+ FcPatternGetMatrix
+ FcPatternGetCharSet
+ FcPatternGetBool
+ FcPatternGetLangSet
FcPatternVaBuild
- FcStrBasename
- FcStrCmp
- FcStrCmp
- FcStrCmpIgnoreCase
+ FcPatternBuild
FcStrCopy
FcStrCopyFilename
+ FcStrDowncase
+ FcStrCmpIgnoreCase
+ FcStrCmp
+ FcStrStrIgnoreCase
+ FcStrStr
+ FcUtf8ToUcs4
+ FcUtf8Len
+ FcUcs4ToUtf8
+ FcUtf16ToUcs4
+ FcUtf16Len
FcStrDirname
- FcStrListCreate
- FcStrListDone
- FcStrListNext
+ FcStrBasename
+ FcStrSetCreate
+ FcStrSetMember
+ FcStrSetEqual
FcStrSetAdd
FcStrSetAddFilename
- FcStrSetCreate
FcStrSetDel
FcStrSetDestroy
- FcStrSetEqual
- FcStrSetMember
- FcUcs4ToUtf8
- FcUtf16Len
- FcUtf16ToUcs4
- FcUtf8Len
- FcUtf8ToUcs4
- FcValueDestroy
- FcValueEqual
- FcValuePrint
- FcValueSave
+ FcStrListCreate
+ FcStrListNext
+ FcStrListDone
+ FcConfigParseAndLoad
+ FcFreeTypeCharIndex
+ FcFreeTypeCharSetAndSpacing
+ FcFreeTypeCharSet
+ FcPatternGetFTFace
+ FcPatternAddFTFace
+ FcGlobalCacheCreate
+ FcGlobalCacheDestroy
+ FcGlobalCacheReadDir
+ FcGlobalCacheLoad
+ FcGlobalCacheUpdate
+ FcGlobalCacheSave
+ FcCacheRead
+ FcDirCacheWrite
+ FcDirCacheRead
+ FcCacheBankToIndexMTF
+ FcCacheFindBankDir
+ FcConfigAddConfigDir
+ FcConfigAddFontDir
+ FcConfigAddDir
+ FcConfigAddConfigFile
+ FcConfigSetCache
+ FcConfigAddBlank
+ FcConfigAddEdit
+ FcConfigSetFonts
+ FcConfigCompareValue
+ FcConfigGlobAdd
+ FcConfigAcceptFilename
+ FcConfigPatternsAdd
+ FcConfigAcceptFont
+ FcConfigModifiedTime
+ FcLangCharSetPopulate
+ FcCharSetFreeze
+ FcCharSetThawAll
+ FcNameUnparseCharSet
+ FcNameParseCharSet
+ FcCharSetFindLeafCreate
+ FcCharSetNewBank
+ FcCharSetNeededBytes
+ FcCharSetNeededBytesAlign
+ FcCharSetDistributeBytes
+ FcCharSetUnserialize
+ FcValueListPrint
+ FcLangSetPrint
+ FcOpPrint
+ FcTestPrint
+ FcExprPrint
+ FcEditPrint
+ FcSubstPrint
+ FcInitDebug
+ FcGetDefaultLang
+ FcFileIsDir
+ FcFileScanConfig
+ FcDirScanConfig
+ FcFreeTypeIsExclusiveLang
+ FcFreeTypeUcs4ToPrivate
+ FcFreeTypePrivateToUcs4
+ FcFreeTypeGetPrivateMap
+ FcFontSetNewBank
+ FcFontSetNeededBytes
+ FcFontSetNeededBytesAlign
+ FcFontSetDistributeBytes
+ FcFontSetSerialize
+ FcConfigSaveField
+ FcTestDestroy
+ FcExprCreateInteger
+ FcExprCreateDouble
+ FcExprCreateString
+ FcExprCreateMatrix
+ FcExprCreateBool
+ FcExprCreateNil
+ FcExprCreateField
+ FcExprCreateConst
+ FcExprCreateOp
+ FcExprDestroy
+ FcEditDestroy
+ FcMemReport
+ FcMemAlloc
+ FcMemFree
+ FcFreeTypeLangSet
+ FcLangCompare
+ FcCharSetForLang
+ FcLangSetPromote
+ FcNameParseLangSet
+ FcNameUnparseLangSet
+ FcLangSetNewBank
+ FcLangSetNeededBytes
+ FcLangSetNeededBytesAlign
+ FcLangSetDistributeBytes
+ FcLangSetSerialize
+ FcLangSetUnserialize
+ FcListPatternMatchAny
+ FcNameBool
+ FcObjectDistributeBytes
+ FcObjectToPtr
+ FcObjectNeededBytes
+ FcObjectNeededBytesAlign
+ FcObjectUnserialize
+ FcObjectSerialize
+ FcObjectPtrU
+ FcObjectStaticNameFini
+ FcValueCanonicalize
+ FcValueListDestroy
+ FcPatternFindElt
+ FcPatternInsertElt
+ FcPatternAddWithBinding
+ FcPatternFreeze
+ FcPatternFini
+ FcPatternAppend
+ FcPatternAddFullFname
+ FcPatternTransferFullFname
+ FcStrStaticName
+ FcStringHash
+ FcPatternNewBank
+ FcPatternNeededBytes
+ FcPatternNeededBytesAlign
+ FcPatternDistributeBytes
+ FcPatternSerialize
+ FcPatternUnserialize
+ FcMatrixFree
+ FcStrPlus
+ FcStrFree
+ FcStrBufInit
+ FcStrBufDestroy
+ FcStrBufDone
+ FcStrBufChar
+ FcStrBufString
+ FcStrBufData
+ FcStrCmpIgnoreBlanksAndCase
+ FcStrContainsIgnoreBlanksAndCase
+ FcStrContainsIgnoreCase
+ FcStrUsesHome
+ FcStrLastSlash
+ FcStrHashIgnoreCase
LIBRARY libfontconfig-@LT_CURRENT_MINUS_AGE@.dll
VERSION @LT_CURRENT@.@LT_REVISION@