#define FC_WEIGHT_HEAVY FC_WEIGHT_BLACK
#endif
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include "magick/nt-feature.h"
#endif
\f
%
% const TypeInfo *GetTypeInfoByFamily(const char *family,
% const StyleType style,const StretchType stretch,
-% const unsigned long weight,ExceptionInfo *exception)
+% const size_t weight,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
*/
-static inline unsigned long MagickMax(const unsigned long x,
- const unsigned long y)
+static inline size_t MagickMax(const size_t x,
+ const size_t y)
{
if (x > y)
return(x);
return(y);
}
-static inline unsigned long MagickMin(const unsigned long x,
- const unsigned long y)
+static inline size_t MagickMin(const size_t x,
+ const size_t y)
{
if (x < y)
return(x);
}
MagickExport const TypeInfo *GetTypeInfoByFamily(const char *family,
- const StyleType style,const StretchType stretch,const unsigned long weight,
+ const StyleType style,const StretchType stretch,const size_t weight,
ExceptionInfo *exception)
{
typedef struct _Fontmap
const TypeInfo
*type_info;
- long
+ ssize_t
range;
register const TypeInfo
*p;
- register long
+ register ssize_t
i;
- static Fontmap
+ static const Fontmap
fontmap[] =
{
{ "fixed", "courier" },
{ NULL, NULL }
};
- unsigned long
+ size_t
max_score,
score;
(void) GetTypeInfo("*",exception);
if (type_list == (SplayTreeInfo *) NULL)
return((TypeInfo *) NULL);
- (void) LockSemaphoreInfo(type_semaphore);
+ LockSemaphoreInfo(type_semaphore);
ResetSplayTreeIterator(type_list);
type_info=(const TypeInfo *) NULL;
p=(const TypeInfo *) GetNextValueInSplayTree(type_list);
type_info=p;
break;
}
- (void) UnlockSemaphoreInfo(type_semaphore);
+ UnlockSemaphoreInfo(type_semaphore);
if (type_info != (const TypeInfo *) NULL)
return(type_info);
/*
Check for types in the same family.
*/
max_score=0;
- (void) LockSemaphoreInfo(type_semaphore);
+ LockSemaphoreInfo(type_semaphore);
ResetSplayTreeIterator(type_list);
p=(const TypeInfo *) GetNextValueInSplayTree(type_list);
while (p != (const TypeInfo *) NULL)
if (weight == 0)
score+=16;
else
- score+=(16*(800-((long) MagickMax(MagickMin(weight,900),p->weight)-
- (long) MagickMin(MagickMin(weight,900),p->weight))))/800;
+ score+=(16*(800-((ssize_t) MagickMax(MagickMin(weight,900),p->weight)-
+ (ssize_t) MagickMin(MagickMin(weight,900),p->weight))))/800;
if ((stretch == UndefinedStretch) || (stretch == AnyStretch))
score+=8;
else
{
- range=(long) UltraExpandedStretch-(long) NormalStretch;
- score+=(8*(range-((long) MagickMax(stretch,p->stretch)-
- (long) MagickMin(stretch,p->stretch))))/range;
+ range=(ssize_t) UltraExpandedStretch-(ssize_t) NormalStretch;
+ score+=(8*(range-((ssize_t) MagickMax(stretch,p->stretch)-
+ (ssize_t) MagickMin(stretch,p->stretch))))/range;
}
if (score > max_score)
{
}
p=(const TypeInfo *) GetNextValueInSplayTree(type_list);
}
- (void) UnlockSemaphoreInfo(type_semaphore);
+ UnlockSemaphoreInfo(type_semaphore);
if (type_info != (const TypeInfo *) NULL)
return(type_info);
/*
% The format of the GetTypeInfoList function is:
%
% const TypeInfo **GetTypeInfoList(const char *pattern,
-% unsigned long *number_fonts,ExceptionInfo *exception)
+% size_t *number_fonts,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
#endif
MagickExport const TypeInfo **GetTypeInfoList(const char *pattern,
- unsigned long *number_fonts,ExceptionInfo *exception)
+ size_t *number_fonts,ExceptionInfo *exception)
{
const TypeInfo
**fonts;
register const TypeInfo
*p;
- register long
+ register ssize_t
i;
/*
*/
assert(pattern != (char *) NULL);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
- assert(number_fonts != (unsigned long *) NULL);
+ assert(number_fonts != (size_t *) NULL);
*number_fonts=0;
p=GetTypeInfo("*",exception);
if (p == (const TypeInfo *) NULL)
/*
Generate type list.
*/
- (void) LockSemaphoreInfo(type_semaphore);
+ LockSemaphoreInfo(type_semaphore);
ResetSplayTreeIterator(type_list);
p=(const TypeInfo *) GetNextValueInSplayTree(type_list);
for (i=0; p != (const TypeInfo *) NULL; )
fonts[i++]=p;
p=(const TypeInfo *) GetNextValueInSplayTree(type_list);
}
- (void) UnlockSemaphoreInfo(type_semaphore);
+ UnlockSemaphoreInfo(type_semaphore);
qsort((void *) fonts,(size_t) i,sizeof(*fonts),TypeInfoCompare);
fonts[i]=(TypeInfo *) NULL;
- *number_fonts=(unsigned long) i;
+ *number_fonts=(size_t) i;
return(fonts);
}
\f
%
% The format of the GetTypeList function is:
%
-% char **GetTypeList(const char *pattern,unsigned long *number_fonts,
+% char **GetTypeList(const char *pattern,size_t *number_fonts,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
}
#endif
-MagickExport char **GetTypeList(const char *pattern,unsigned long *number_fonts,
+MagickExport char **GetTypeList(const char *pattern,size_t *number_fonts,
ExceptionInfo *exception)
{
char
register const TypeInfo
*p;
- register long
+ register ssize_t
i;
/*
*/
assert(pattern != (char *) NULL);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
- assert(number_fonts != (unsigned long *) NULL);
+ assert(number_fonts != (size_t *) NULL);
*number_fonts=0;
p=GetTypeInfo("*",exception);
if (p == (const TypeInfo *) NULL)
/*
Generate type list.
*/
- (void) LockSemaphoreInfo(type_semaphore);
+ LockSemaphoreInfo(type_semaphore);
ResetSplayTreeIterator(type_list);
p=(const TypeInfo *) GetNextValueInSplayTree(type_list);
for (i=0; p != (const TypeInfo *) NULL; )
fonts[i++]=ConstantString(p->name);
p=(const TypeInfo *) GetNextValueInSplayTree(type_list);
}
- (void) UnlockSemaphoreInfo(type_semaphore);
+ UnlockSemaphoreInfo(type_semaphore);
qsort((void *) fonts,(size_t) i,sizeof(*fonts),TypeCompare);
fonts[i]=(char *) NULL;
- *number_fonts=(unsigned long) i;
+ *number_fonts=(size_t) i;
return(fonts);
}
\f
width,
weight;
- register long
+ register ssize_t
i;
TypeInfo
FcConfigDestroy(font_config);
return(MagickFalse);
}
- for (i=0; i < (long) font_set->nfont; i++)
+ for (i=0; i < (ssize_t) font_set->nfont; i++)
{
status=FcPatternGetString(font_set->fonts[i],FC_FAMILY,0,&family);
if (status != FcResultMatch)
{
if (type_semaphore == (SemaphoreInfo *) NULL)
AcquireSemaphoreInfo(&type_semaphore);
- (void) LockSemaphoreInfo(type_semaphore);
+ LockSemaphoreInfo(type_semaphore);
if ((type_list == (SplayTreeInfo *) NULL) &&
(instantiate_type == MagickFalse))
{
(void) LoadTypeLists(MagickTypeFilename,exception);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
(void) NTLoadTypeLists(type_list,exception);
#endif
#if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
#endif
instantiate_type=MagickTrue;
}
- (void) UnlockSemaphoreInfo(type_semaphore);
+ UnlockSemaphoreInfo(type_semaphore);
}
return(type_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
}
const TypeInfo
**type_info;
- register long
+ register ssize_t
i;
- unsigned long
+ size_t
number_fonts;
if (file == (FILE *) NULL)
return(MagickFalse);
*weight='\0';
path=(const char *) NULL;
- for (i=0; i < (long) number_fonts; i++)
+ for (i=0; i < (ssize_t) number_fonts; i++)
{
if (type_info[i]->stealth != MagickFalse)
continue;
glyphs="unknown";
if (type_info[i]->glyphs != (char *) NULL)
glyphs=type_info[i]->glyphs;
- (void) FormatMagickString(weight,MaxTextExtent,"%lu",type_info[i]->weight);
+ (void) FormatMagickString(weight,MaxTextExtent,"%.20g",(double)
+ type_info[i]->weight);
(void) fprintf(file," Font: %s\n",name);
(void) fprintf(file," family: %s\n",family);
(void) fprintf(file," style: %s\n",style);
% The format of the LoadTypeList method is:
%
% MagickBooleanType LoadTypeList(const char *xml,const char *filename,
-% const unsigned long depth,ExceptionInfo *exception)
+% const size_t depth,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
}
static MagickBooleanType LoadTypeList(const char *xml,const char *filename,
- const unsigned long depth,ExceptionInfo *exception)
+ const size_t depth,ExceptionInfo *exception)
{
char
font_path[MaxTextExtent],
status=MagickTrue;
type_info=(TypeInfo *) NULL;
token=AcquireString(xml);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
/*
Determine the Ghostscript font path.
*/
*path;
path=ConstantString(token);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (strchr(path,'@') != (char *) NULL)
SubstituteString(&path,"@ghostscript_font_path@",font_path);
#endif
MaxTextExtent);
(void) ConcatenateMagickString(font_path,token,MaxTextExtent);
path=ConstantString(font_path);
+ if (IsPathAccessible(path) == MagickFalse)
+ {
+ path=DestroyString(path);
+ path=ConstantString(token);
+ }
}
type_info->glyphs=path;
break;
*path;
path=ConstantString(token);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (strchr(path,'@') != (char *) NULL)
SubstituteString(&path,"@ghostscript_font_path@",font_path);
#endif
{
if (type_semaphore == (SemaphoreInfo *) NULL)
AcquireSemaphoreInfo(&type_semaphore);
- (void) LockSemaphoreInfo(type_semaphore);
+ LockSemaphoreInfo(type_semaphore);
if (type_list != (SplayTreeInfo *) NULL)
type_list=DestroySplayTree(type_list);
instantiate_type=MagickFalse;
- (void) UnlockSemaphoreInfo(type_semaphore);
+ UnlockSemaphoreInfo(type_semaphore);
DestroySemaphoreInfo(&type_semaphore);
}