MagickCore  7.0.3
type.c
Go to the documentation of this file.
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % TTTTT Y Y PPPP EEEEE %
7 % T Y Y P P E %
8 % T Y PPPP EEE %
9 % T Y P E %
10 % T Y P EEEEE %
11 % %
12 % %
13 % MagickCore Image Type Methods %
14 % %
15 % Software Design %
16 % Cristy %
17 % May 2001 %
18 % %
19 % %
20 % Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
22 % %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
25 % %
26 % https://imagemagick.org/script/license.php %
27 % %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
33 % %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %
36 %
37 */
38 
39 /*
40  Include declarations.
41 */
42 #include "MagickCore/studio.h"
43 #include "MagickCore/blob.h"
44 #include "MagickCore/client.h"
45 #include "MagickCore/configure.h"
46 #include "MagickCore/draw.h"
47 #include "MagickCore/exception.h"
50 #include "MagickCore/linked-list.h"
51 #include "MagickCore/log.h"
52 #include "MagickCore/memory_.h"
54 #include "MagickCore/nt-feature.h"
56 #include "MagickCore/option.h"
57 #include "MagickCore/semaphore.h"
58 #include "MagickCore/splay-tree.h"
59 #include "MagickCore/string_.h"
61 #include "MagickCore/type.h"
63 #include "MagickCore/token.h"
64 #include "MagickCore/utility.h"
66 #include "MagickCore/xml-tree.h"
67 #if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
68 # include "fontconfig/fontconfig.h"
69 #if (FC_VERSION < 20209)
70 #undef FC_WEIGHT_LIGHT
71 #define FC_WIDTH "width" /* Int */
72 #define FC_WIDTH_ULTRACONDENSED 50
73 #define FC_WIDTH_EXTRACONDENSED 63
74 #define FC_WIDTH_CONDENSED 75
75 #define FC_WIDTH_SEMICONDENSED 87
76 #define FC_WIDTH_NORMAL 100
77 #define FC_WIDTH_SEMIEXPANDED 113
78 #define FC_WIDTH_EXPANDED 125
79 #define FC_WIDTH_EXTRAEXPANDED 150
80 #define FC_WIDTH_ULTRAEXPANDED 200
81 
82 #define FC_WEIGHT_THIN 0
83 #define FC_WEIGHT_EXTRALIGHT 40
84 #define FC_WEIGHT_ULTRALIGHT FC_WEIGHT_EXTRALIGHT
85 #define FC_WEIGHT_LIGHT 50
86 #define FC_WEIGHT_BOOK 75
87 #define FC_WEIGHT_REGULAR 80
88 #define FC_WEIGHT_NORMAL FC_WEIGHT_REGULAR
89 #define FC_WEIGHT_MEDIUM 100
90 #define FC_WEIGHT_DEMIBOLD 180
91 #define FC_WEIGHT_SEMIBOLD FC_WEIGHT_DEMIBOLD
92 #define FC_WEIGHT_BOLD 200
93 #define FC_WEIGHT_EXTRABOLD 205
94 #define FC_WEIGHT_ULTRABOLD FC_WEIGHT_EXTRABOLD
95 #define FC_WEIGHT_BLACK 210
96 #define FC_WEIGHT_HEAVY FC_WEIGHT_BLACK
97 #endif
98 #endif
99 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
100 # include "MagickCore/nt-feature.h"
101 #endif
102 
103 /*
104  Define declarations.
105 */
106 #define MagickTypeFilename "type.xml"
107 
108 /*
109  Declare type map.
110 */
111 static const char
113  "<?xml version=\"1.0\"?>"
114  "<typemap>"
115  " <type stealth=\"True\" name=\"fixed\" family=\"helvetica\"/>"
116  " <type stealth=\"True\" name=\"helvetica\" family=\"helvetica\"/>"
117  "</typemap>";
118 
119 /*
120  Static declarations.
121 */
122 static SemaphoreInfo
124 
125 static SplayTreeInfo
127 
128 /*
129  Forward declarations.
130 */
131 static MagickBooleanType
133  LoadTypeCache(SplayTreeInfo *,const char *,const char *,const size_t,
134  ExceptionInfo *);
135 
136 /*
137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
138 % %
139 % %
140 % %
141 % A c q u i r e T y p e S p l a y T r e e %
142 % %
143 % %
144 % %
145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
146 %
147 % AcquireTypeCache() caches one or more type configuration files which
148 % provides a mapping between type attributes and a type name.
149 %
150 % The format of the AcquireTypeCache method is:
151 %
152 % SplayTreeInfo *AcquireTypeCache(const char *filename,
153 % ExceptionInfo *exception)
154 %
155 % A description of each parameter follows:
156 %
157 % o filename: the font file name.
158 %
159 % o exception: return any errors or warnings in this structure.
160 %
161 */
162 
163 static void *DestroyTypeNode(void *type_info)
164 {
165  register TypeInfo
166  *p;
167 
168  p=(TypeInfo *) type_info;
169  if (p->path != (char *) NULL)
170  p->path=DestroyString(p->path);
171  if (p->name != (char *) NULL)
172  p->name=DestroyString(p->name);
173  if (p->description != (char *) NULL)
175  if (p->family != (char *) NULL)
176  p->family=DestroyString(p->family);
177  if (p->encoding != (char *) NULL)
179  if (p->foundry != (char *) NULL)
181  if (p->format != (char *) NULL)
182  p->format=DestroyString(p->format);
183  if (p->metrics != (char *) NULL)
185  if (p->glyphs != (char *) NULL)
186  p->glyphs=DestroyString(p->glyphs);
187  return(RelinquishMagickMemory(p));
188 }
189 
190 static SplayTreeInfo *AcquireTypeCache(const char *filename,
191  ExceptionInfo *exception)
192 {
194  status;
195 
197  *cache;
198 
199  cache=NewSplayTree(CompareSplayTreeString,(void *(*)(void *)) NULL,
201  status=MagickTrue;
202 #if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT)
203  {
204  char
205  *font_path,
206  path[MagickPathExtent];
207 
208  const StringInfo
209  *option;
210 
212  *options;
213 
214  *path='\0';
215  options=GetConfigureOptions(filename,exception);
216  option=(const StringInfo *) GetNextValueInLinkedList(options);
217  while (option != (const StringInfo *) NULL)
218  {
220  status&=LoadTypeCache(cache,(const char *)
221  GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
222  option=(const StringInfo *) GetNextValueInLinkedList(options);
223  }
224  options=DestroyConfigureOptions(options);
225  font_path=GetEnvironmentValue("MAGICK_FONT_PATH");
226  if (font_path != (char *) NULL)
227  {
228  char
229  *xml;
230 
231  /*
232  Search MAGICK_FONT_PATH.
233  */
234  (void) FormatLocaleString(path,MagickPathExtent,"%s%s%s",font_path,
235  DirectorySeparator,filename);
236  xml=FileToString(path,~0UL,exception);
237  if (xml != (void *) NULL)
238  {
239  status&=LoadTypeCache(cache,xml,path,0,exception);
240  xml=DestroyString(xml);
241  }
242  font_path=DestroyString(font_path);
243  }
244  }
245 #endif
246  if (GetNumberOfNodesInSplayTree(cache) == 0)
247  status&=LoadTypeCache(cache,TypeMap,"built-in",0,exception);
248  return(cache);
249 }
250 
251 /*
252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
253 % %
254 % %
255 % %
256 + G e t T y p e I n f o %
257 % %
258 % %
259 % %
260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
261 %
262 % GetTypeInfo searches the type list for the specified name and if found
263 % returns attributes for that type.
264 %
265 % The format of the GetTypeInfo method is:
266 %
267 % const TypeInfo *GetTypeInfo(const char *name,ExceptionInfo *exception)
268 %
269 % A description of each parameter follows:
270 %
271 % o name: the type name.
272 %
273 % o exception: return any errors or warnings in this structure.
274 %
275 */
276 MagickExport const TypeInfo *GetTypeInfo(const char *name,
277  ExceptionInfo *exception)
278 {
279  assert(exception != (ExceptionInfo *) NULL);
280  if (IsTypeTreeInstantiated(exception) == MagickFalse)
281  return((const TypeInfo *) NULL);
282  if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0))
283  return((const TypeInfo *) GetRootValueFromSplayTree(type_cache));
284  return((const TypeInfo *) GetValueFromSplayTree(type_cache,name));
285 }
286 
287 /*
288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
289 % %
290 % %
291 % %
292 + G e t T y p e I n f o B y F a m i l y %
293 % %
294 % %
295 % %
296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
297 %
298 % GetTypeInfoByFamily() searches the type list for the specified family and if
299 % found returns attributes for that type.
300 %
301 % Type substitution and scoring algorithm contributed by Bob Friesenhahn.
302 %
303 % The format of the GetTypeInfoByFamily method is:
304 %
305 % const TypeInfo *GetTypeInfoByFamily(const char *family,
306 % const StyleType style,const StretchType stretch,
307 % const size_t weight,ExceptionInfo *exception)
308 %
309 % A description of each parameter follows:
310 %
311 % o family: the type family.
312 %
313 % o style: the type style.
314 %
315 % o stretch: the type stretch.
316 %
317 % o weight: the type weight.
318 %
319 % o exception: return any errors or warnings in this structure.
320 %
321 */
322 
323 MagickExport const TypeInfo *GetTypeInfoByFamily(const char *family,
324  const StyleType style,const StretchType stretch,const size_t weight,
325  ExceptionInfo *exception)
326 {
327  typedef struct _Fontmap
328  {
329  const char
330  name[17],
331  substitute[10];
332  } Fontmap;
333 
334  const TypeInfo
335  *type_info;
336 
337  register const TypeInfo
338  *p;
339 
340  register ssize_t
341  i;
342 
343  ssize_t
344  range;
345 
346  static const Fontmap
347  fontmap[] =
348  {
349  { "fixed", "courier" },
350  { "modern","courier" },
351  { "monotype corsiva", "courier" },
352  { "news gothic", "helvetica" },
353  { "system", "courier" },
354  { "terminal", "courier" },
355  { "wingdings", "symbol" }
356  };
357 
358  size_t
359  font_weight,
360  max_score,
361  score;
362 
363  /*
364  Check for an exact type match.
365  */
366  (void) GetTypeInfo("*",exception);
367  if (type_cache == (SplayTreeInfo *) NULL)
368  return((TypeInfo *) NULL);
369  font_weight=(size_t) (weight == 0 ? 400 : weight);
372  type_info=(const TypeInfo *) NULL;
374  while (p != (const TypeInfo *) NULL)
375  {
376  if (p->family == (char *) NULL)
377  {
379  continue;
380  }
381  if (family == (const char *) NULL)
382  {
383  if ((LocaleCompare(p->family,"arial") != 0) &&
384  (LocaleCompare(p->family,"helvetica") != 0))
385  {
387  continue;
388  }
389  }
390  else
391  if (LocaleCompare(p->family,family) != 0)
392  {
394  continue;
395  }
396  if ((style != UndefinedStyle) && (style != AnyStyle) && (p->style != style))
397  {
399  continue;
400  }
401  if ((stretch != UndefinedStretch) && (stretch != AnyStretch) &&
402  (p->stretch != stretch))
403  {
405  continue;
406  }
407  if (p->weight != font_weight)
408  {
410  continue;
411  }
412  type_info=p;
413  break;
414  }
416  if (type_info != (const TypeInfo *) NULL)
417  return(type_info);
418  /*
419  Check for types in the same family.
420  */
421  max_score=0;
425  while (p != (const TypeInfo *) NULL)
426  {
427  if (p->family == (char *) NULL)
428  {
430  continue;
431  }
432  if (family == (const char *) NULL)
433  {
434  if ((LocaleCompare(p->family,"arial") != 0) &&
435  (LocaleCompare(p->family,"helvetica") != 0))
436  {
438  continue;
439  }
440  }
441  else
442  if (LocaleCompare(p->family,family) != 0)
443  {
445  continue;
446  }
447  score=0;
448  if ((style == UndefinedStyle) || (style == AnyStyle) || (p->style == style))
449  score+=32;
450  else
451  if (((style == ItalicStyle) || (style == ObliqueStyle)) &&
452  ((p->style == ItalicStyle) || (p->style == ObliqueStyle)))
453  score+=25;
454  score+=(16*(800-((ssize_t) MagickMax(MagickMin(font_weight,900),p->weight)-
455  (ssize_t) MagickMin(MagickMin(font_weight,900),p->weight))))/800;
456  if ((stretch == UndefinedStretch) || (stretch == AnyStretch))
457  score+=8;
458  else
459  {
460  range=(ssize_t) UltraExpandedStretch-(ssize_t) NormalStretch;
461  score+=(8*(range-((ssize_t) MagickMax(stretch,p->stretch)-
462  (ssize_t) MagickMin(stretch,p->stretch))))/range;
463  }
464  if (score > max_score)
465  {
466  max_score=score;
467  type_info=p;
468  }
470  }
472  if (type_info != (const TypeInfo *) NULL)
473  return(type_info);
474  /*
475  Check for table-based substitution match.
476  */
477  for (i=0; i < (ssize_t) (sizeof(fontmap)/sizeof(fontmap[0])); i++)
478  {
479  if (family == (const char *) NULL)
480  {
481  if ((LocaleCompare(fontmap[i].name,"arial") != 0) &&
482  (LocaleCompare(fontmap[i].name,"helvetica") != 0))
483  continue;
484  }
485  else
486  if (LocaleCompare(fontmap[i].name,family) != 0)
487  continue;
488  type_info=GetTypeInfoByFamily(fontmap[i].substitute,style,stretch,weight,
489  exception);
490  break;
491  }
492  if (type_info != (const TypeInfo *) NULL)
493  {
495  "FontSubstitutionRequired","`%s'",type_info->family);
496  return(type_info);
497  }
498  if (family != (const char *) NULL)
499  type_info=GetTypeInfoByFamily((const char *) NULL,style,stretch,weight,
500  exception);
501  return(type_info);
502 }
503 
504 /*
505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
506 % %
507 % %
508 % %
509 % G e t T y p e I n f o L i s t %
510 % %
511 % %
512 % %
513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
514 %
515 % GetTypeInfoList() returns any fonts that match the specified pattern.
516 %
517 % The format of the GetTypeInfoList function is:
518 %
519 % const TypeInfo **GetTypeInfoList(const char *pattern,
520 % size_t *number_fonts,ExceptionInfo *exception)
521 %
522 % A description of each parameter follows:
523 %
524 % o pattern: Specifies a pointer to a text string containing a pattern.
525 %
526 % o number_fonts: This integer returns the number of types in the list.
527 %
528 % o exception: return any errors or warnings in this structure.
529 %
530 */
531 
532 #if defined(__cplusplus) || defined(c_plusplus)
533 extern "C" {
534 #endif
535 
536 static int TypeInfoCompare(const void *x,const void *y)
537 {
538  const TypeInfo
539  **p,
540  **q;
541 
542  p=(const TypeInfo **) x,
543  q=(const TypeInfo **) y;
544  if (LocaleCompare((*p)->path,(*q)->path) == 0)
545  return(LocaleCompare((*p)->name,(*q)->name));
546  return(LocaleCompare((*p)->path,(*q)->path));
547 }
548 
549 #if defined(__cplusplus) || defined(c_plusplus)
550 }
551 #endif
552 
553 MagickExport const TypeInfo **GetTypeInfoList(const char *pattern,
554  size_t *number_fonts,ExceptionInfo *exception)
555 {
556  const TypeInfo
557  **fonts;
558 
559  register const TypeInfo
560  *p;
561 
562  register ssize_t
563  i;
564 
565  /*
566  Allocate type list.
567  */
568  assert(pattern != (char *) NULL);
569  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
570  assert(number_fonts != (size_t *) NULL);
571  *number_fonts=0;
572  p=GetTypeInfo("*",exception);
573  if (p == (const TypeInfo *) NULL)
574  return((const TypeInfo **) NULL);
575  fonts=(const TypeInfo **) AcquireQuantumMemory((size_t)
576  GetNumberOfNodesInSplayTree(type_cache)+1UL,sizeof(*fonts));
577  if (fonts == (const TypeInfo **) NULL)
578  return((const TypeInfo **) NULL);
579  /*
580  Generate type list.
581  */
585  for (i=0; p != (const TypeInfo *) NULL; )
586  {
587  if ((p->stealth == MagickFalse) &&
588  (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
589  fonts[i++]=p;
591  }
593  qsort((void *) fonts,(size_t) i,sizeof(*fonts),TypeInfoCompare);
594  fonts[i]=(TypeInfo *) NULL;
595  *number_fonts=(size_t) i;
596  return(fonts);
597 }
598 
599 /*
600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
601 % %
602 % %
603 % %
604 % G e t T y p e L i s t %
605 % %
606 % %
607 % %
608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
609 %
610 % GetTypeList() returns any fonts that match the specified pattern.
611 %
612 % The format of the GetTypeList function is:
613 %
614 % char **GetTypeList(const char *pattern,size_t *number_fonts,
615 % ExceptionInfo *exception)
616 %
617 % A description of each parameter follows:
618 %
619 % o pattern: Specifies a pointer to a text string containing a pattern.
620 %
621 % o number_fonts: This integer returns the number of fonts in the list.
622 %
623 % o exception: return any errors or warnings in this structure.
624 %
625 */
626 
627 #if defined(__cplusplus) || defined(c_plusplus)
628 extern "C" {
629 #endif
630 
631 static int TypeCompare(const void *x,const void *y)
632 {
633  register const char
634  **p,
635  **q;
636 
637  p=(const char **) x;
638  q=(const char **) y;
639  return(LocaleCompare(*p,*q));
640 }
641 
642 #if defined(__cplusplus) || defined(c_plusplus)
643 }
644 #endif
645 
646 MagickExport char **GetTypeList(const char *pattern,size_t *number_fonts,
647  ExceptionInfo *exception)
648 {
649  char
650  **fonts;
651 
652  register const TypeInfo
653  *p;
654 
655  register ssize_t
656  i;
657 
658  /*
659  Allocate type list.
660  */
661  assert(pattern != (char *) NULL);
662  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
663  assert(number_fonts != (size_t *) NULL);
664  *number_fonts=0;
665  p=GetTypeInfo("*",exception);
666  if (p == (const TypeInfo *) NULL)
667  return((char **) NULL);
668  fonts=(char **) AcquireQuantumMemory((size_t)
669  GetNumberOfNodesInSplayTree(type_cache)+1UL,sizeof(*fonts));
670  if (fonts == (char **) NULL)
671  return((char **) NULL);
672  /*
673  Generate type list.
674  */
678  for (i=0; p != (const TypeInfo *) NULL; )
679  {
680  if ((p->stealth == MagickFalse) &&
681  (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
682  fonts[i++]=ConstantString(p->name);
684  }
686  qsort((void *) fonts,(size_t) i,sizeof(*fonts),TypeCompare);
687  fonts[i]=(char *) NULL;
688  *number_fonts=(size_t) i;
689  return(fonts);
690 }
691 
692 /*
693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
694 % %
695 % %
696 % %
697 + I s T y p e T r e e I n s t a n t i a t e d %
698 % %
699 % %
700 % %
701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
702 %
703 % IsTypeTreeInstantiated() determines if the type tree is instantiated. If
704 % not, it instantiates the tree and returns it.
705 %
706 % The format of the IsTypeInstantiated method is:
707 %
708 % MagickBooleanType IsTypeTreeInstantiated(ExceptionInfo *exception)
709 %
710 % A description of each parameter follows.
711 %
712 % o exception: return any errors or warnings in this structure.
713 %
714 */
715 
716 #if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
718  ExceptionInfo *exception)
719 {
720 #if !defined(FC_FULLNAME)
721 #define FC_FULLNAME "fullname"
722 #endif
723 
724  char
725  extension[MagickPathExtent],
726  name[MagickPathExtent];
727 
728  FcBool
729  result;
730 
731  FcChar8
732  *family,
733  *file,
734  *fullname,
735  *style;
736 
737  FcConfig
738  *font_config;
739 
740  FcFontSet
741  *font_set;
742 
743  FcObjectSet
744  *object_set;
745 
746  FcPattern
747  *pattern;
748 
749  FcResult
750  status;
751 
752  int
753  slant,
754  width,
755  weight;
756 
757  register ssize_t
758  i;
759 
760  TypeInfo
761  *type_info;
762 
763  /*
764  Load system fonts.
765  */
766  (void) exception;
767  result=FcInit();
768  if (result == 0)
769  return(MagickFalse);
770  font_config=FcConfigGetCurrent();
771  if (font_config == (FcConfig *) NULL)
772  return(MagickFalse);
773  FcConfigSetRescanInterval(font_config,0);
774  font_set=(FcFontSet *) NULL;
775  object_set=FcObjectSetBuild(FC_FULLNAME,FC_FAMILY,FC_STYLE,FC_SLANT,
776  FC_WIDTH,FC_WEIGHT,FC_FILE,(char *) NULL);
777  if (object_set != (FcObjectSet *) NULL)
778  {
779  pattern=FcPatternCreate();
780  if (pattern != (FcPattern *) NULL)
781  {
782  font_set=FcFontList(font_config,pattern,object_set);
783  FcPatternDestroy(pattern);
784  }
785  FcObjectSetDestroy(object_set);
786  }
787  if (font_set == (FcFontSet *) NULL)
788  {
789  FcConfigDestroy(font_config);
790  return(MagickFalse);
791  }
792  for (i=0; i < (ssize_t) font_set->nfont; i++)
793  {
794  status=FcPatternGetString(font_set->fonts[i],FC_FAMILY,0,&family);
795  if (status != FcResultMatch)
796  continue;
797  status=FcPatternGetString(font_set->fonts[i],FC_FILE,0,&file);
798  if (status != FcResultMatch)
799  continue;
800  *extension='\0';
801  GetPathComponent((const char *) file,ExtensionPath,extension);
802  if ((*extension != '\0') && (LocaleCompare(extension,"gz") == 0))
803  continue;
804  type_info=(TypeInfo *) AcquireMagickMemory(sizeof(*type_info));
805  if (type_info == (TypeInfo *) NULL)
806  continue;
807  (void) memset(type_info,0,sizeof(*type_info));
808  type_info->path=ConstantString("System Fonts");
809  type_info->signature=MagickCoreSignature;
810  (void) CopyMagickString(name,"Unknown",MagickPathExtent);
811  status=FcPatternGetString(font_set->fonts[i],FC_FULLNAME,0,&fullname);
812  if ((status == FcResultMatch) && (fullname != (FcChar8 *) NULL))
813  (void) CopyMagickString(name,(const char *) fullname,MagickPathExtent);
814  else
815  {
816  if (family != (FcChar8 *) NULL)
817  (void) CopyMagickString(name,(const char *) family,MagickPathExtent);
818  status=FcPatternGetString(font_set->fonts[i],FC_STYLE,0,&style);
819  if ((status == FcResultMatch) && (style != (FcChar8 *) NULL) &&
820  (LocaleCompare((const char *) style,"Regular") != 0))
821  {
822  (void) ConcatenateMagickString(name," ",MagickPathExtent);
823  (void) ConcatenateMagickString(name,(const char *) style,
825  }
826  }
827  type_info->name=ConstantString(name);
828  (void) SubstituteString(&type_info->name," ","-");
829  type_info->family=ConstantString((const char *) family);
830  status=FcPatternGetInteger(font_set->fonts[i],FC_SLANT,0,&slant);
831  type_info->style=NormalStyle;
832  if (slant == FC_SLANT_ITALIC)
833  type_info->style=ItalicStyle;
834  if (slant == FC_SLANT_OBLIQUE)
835  type_info->style=ObliqueStyle;
836  status=FcPatternGetInteger(font_set->fonts[i],FC_WIDTH,0,&width);
837  type_info->stretch=NormalStretch;
838  if (width >= FC_WIDTH_ULTRACONDENSED)
839  type_info->stretch=UltraCondensedStretch;
840  if (width >= FC_WIDTH_EXTRACONDENSED)
841  type_info->stretch=ExtraCondensedStretch;
842  if (width >= FC_WIDTH_CONDENSED)
843  type_info->stretch=CondensedStretch;
844  if (width >= FC_WIDTH_SEMICONDENSED)
845  type_info->stretch=SemiCondensedStretch;
846  if (width >= FC_WIDTH_NORMAL)
847  type_info->stretch=NormalStretch;
848  if (width >= FC_WIDTH_SEMIEXPANDED)
849  type_info->stretch=SemiExpandedStretch;
850  if (width >= FC_WIDTH_EXPANDED)
851  type_info->stretch=ExpandedStretch;
852  if (width >= FC_WIDTH_EXTRAEXPANDED)
853  type_info->stretch=ExtraExpandedStretch;
854  if (width >= FC_WIDTH_ULTRAEXPANDED)
855  type_info->stretch=UltraExpandedStretch;
856  type_info->weight=400;
857  status=FcPatternGetInteger(font_set->fonts[i],FC_WEIGHT,0,&weight);
858  if (weight >= FC_WEIGHT_THIN)
859  type_info->weight=100;
860  if (weight >= FC_WEIGHT_EXTRALIGHT)
861  type_info->weight=200;
862  if (weight >= FC_WEIGHT_LIGHT)
863  type_info->weight=300;
864  if (weight >= FC_WEIGHT_NORMAL)
865  type_info->weight=400;
866  if (weight >= FC_WEIGHT_MEDIUM)
867  type_info->weight=500;
868  if (weight >= FC_WEIGHT_DEMIBOLD)
869  type_info->weight=600;
870  if (weight >= FC_WEIGHT_BOLD)
871  type_info->weight=700;
872  if (weight >= FC_WEIGHT_EXTRABOLD)
873  type_info->weight=800;
874  if (weight >= FC_WEIGHT_BLACK)
875  type_info->weight=900;
876  type_info->glyphs=ConstantString((const char *) file);
877  (void) AddValueToSplayTree(type_cache,type_info->name,type_info);
878  }
879  FcFontSetDestroy(font_set);
880  FcConfigDestroy(font_config);
881  return(MagickTrue);
882 }
883 #endif
884 
886 {
887  if (type_cache == (SplayTreeInfo *) NULL)
888  {
889  if (type_semaphore == (SemaphoreInfo *) NULL)
892  if (type_cache == (SplayTreeInfo *) NULL)
893  {
895  *splay_tree;
896 
897  splay_tree=AcquireTypeCache(MagickTypeFilename,exception);
898 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
899  (void) NTAcquireTypeCache(splay_tree,exception);
900 #endif
901 #if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
902  (void) LoadFontConfigFonts(splay_tree,exception);
903 #endif
904  type_cache=splay_tree;
905  }
907  }
908  return(type_cache != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
909 }
910 
911 /*
912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
913 % %
914 % %
915 % %
916 % L i s t T y p e I n f o %
917 % %
918 % %
919 % %
920 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
921 %
922 % ListTypeInfo() lists the fonts to a file.
923 %
924 % The format of the ListTypeInfo method is:
925 %
926 % MagickBooleanType ListTypeInfo(FILE *file,ExceptionInfo *exception)
927 %
928 % A description of each parameter follows.
929 %
930 % o file: An pointer to a FILE.
931 %
932 % o exception: return any errors or warnings in this structure.
933 %
934 */
936 {
937  char
938  weight[MagickPathExtent];
939 
940  const char
941  *family,
942  *glyphs,
943  *name,
944  *path,
945  *stretch,
946  *style;
947 
948  const TypeInfo
949  **type_info;
950 
951  register ssize_t
952  i;
953 
954  size_t
955  number_fonts;
956 
957  if (file == (FILE *) NULL)
958  file=stdout;
959  number_fonts=0;
960  type_info=GetTypeInfoList("*",&number_fonts,exception);
961  if (type_info == (const TypeInfo **) NULL)
962  return(MagickFalse);
963  *weight='\0';
964  path=(const char *) NULL;
965  for (i=0; i < (ssize_t) number_fonts; i++)
966  {
967  if (type_info[i]->stealth != MagickFalse)
968  continue;
969  if (((path == (const char *) NULL) ||
970  (LocaleCompare(path,type_info[i]->path) != 0)) &&
971  (type_info[i]->path != (char *) NULL))
972  (void) FormatLocaleFile(file,"\nPath: %s\n",type_info[i]->path);
973  path=type_info[i]->path;
974  name="unknown";
975  if (type_info[i]->name != (char *) NULL)
976  name=type_info[i]->name;
977  family="unknown";
978  if (type_info[i]->family != (char *) NULL)
979  family=type_info[i]->family;
980  style=CommandOptionToMnemonic(MagickStyleOptions,type_info[i]->style);
981  stretch=CommandOptionToMnemonic(MagickStretchOptions,type_info[i]->stretch);
982  glyphs="unknown";
983  if (type_info[i]->glyphs != (char *) NULL)
984  glyphs=type_info[i]->glyphs;
985  (void) FormatLocaleString(weight,MagickPathExtent,"%.20g",(double)
986  type_info[i]->weight);
987  (void) FormatLocaleFile(file," Font: %s\n",name);
988  (void) FormatLocaleFile(file," family: %s\n",family);
989  (void) FormatLocaleFile(file," style: %s\n",style);
990  (void) FormatLocaleFile(file," stretch: %s\n",stretch);
991  (void) FormatLocaleFile(file," weight: %s\n",weight);
992  (void) FormatLocaleFile(file," glyphs: %s\n",glyphs);
993  }
994  (void) fflush(file);
995  type_info=(const TypeInfo **) RelinquishMagickMemory((void *) type_info);
996  return(MagickTrue);
997 }
998 
999 /*
1000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1001 % %
1002 % %
1003 % %
1004 + L o a d T y p e C a c h e %
1005 % %
1006 % %
1007 % %
1008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1009 %
1010 % LoadTypeCache() loads the type configurations which provides a mapping
1011 % between type attributes and a type name.
1012 %
1013 % The format of the LoadTypeCache method is:
1014 %
1015 % MagickBooleanType LoadTypeCache(SplayTreeInfo *cache,const char *xml,
1016 % const char *filename,const size_t depth,ExceptionInfo *exception)
1017 %
1018 % A description of each parameter follows:
1019 %
1020 % o xml: The type list in XML format.
1021 %
1022 % o filename: The type list filename.
1023 %
1024 % o depth: depth of <include /> statements.
1025 %
1026 % o exception: return any errors or warnings in this structure.
1027 %
1028 */
1029 
1030 static inline MagickBooleanType SetTypeNodePath(const char *filename,
1031  char *font_path,const char *token,char **target)
1032 {
1033  char
1034  *path;
1035 
1036  path=ConstantString(token);
1037 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
1038  if (strchr(path,'@') != (char *) NULL)
1039  SubstituteString(&path,"@ghostscript_font_path@",font_path);
1040 #endif
1041  if (IsPathAccessible(path) == MagickFalse)
1042  {
1043  /*
1044  Relative path.
1045  */
1046  path=DestroyString(path);
1047  GetPathComponent(filename,HeadPath,font_path);
1050  (void) ConcatenateMagickString(font_path,token,MagickPathExtent);
1051  path=ConstantString(font_path);
1052 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
1053  if (strchr(path,'@') != (char *) NULL)
1054  SubstituteString(&path,"@ghostscript_font_path@","");
1055 #endif
1056  if (IsPathAccessible(path) == MagickFalse)
1057  {
1058  path=DestroyString(path);
1059  return(MagickFalse);
1060  }
1061  }
1062 
1063  *target=path;
1064  return(MagickTrue);
1065 }
1066 
1067 static MagickBooleanType LoadTypeCache(SplayTreeInfo *cache,const char *xml,
1068  const char *filename,const size_t depth,ExceptionInfo *exception)
1069 {
1070  char
1071  font_path[MagickPathExtent],
1072  keyword[MagickPathExtent],
1073  *token;
1074 
1075  const char
1076  *q;
1077 
1079  status;
1080 
1081  size_t
1082  extent;
1083 
1084  TypeInfo
1085  *type_info;
1086 
1087  /*
1088  Load the type map file.
1089  */
1091  "Loading type configure file \"%s\" ...",filename);
1092  if (xml == (const char *) NULL)
1093  return(MagickFalse);
1094  status=MagickTrue;
1095  type_info=(TypeInfo *) NULL;
1096  token=AcquireString(xml);
1097  extent=strlen(token)+MagickPathExtent;
1098 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
1099  /*
1100  Determine the Ghostscript font path.
1101  */
1102  *font_path='\0';
1103  if (NTGhostscriptFonts(font_path,MagickPathExtent-2))
1105 #endif
1106  for (q=(char *) xml; *q != '\0'; )
1107  {
1108  /*
1109  Interpret XML.
1110  */
1111  (void) GetNextToken(q,&q,extent,token);
1112  if (*token == '\0')
1113  break;
1114  (void) CopyMagickString(keyword,token,MagickPathExtent);
1115  if (LocaleNCompare(keyword,"<!DOCTYPE",9) == 0)
1116  {
1117  /*
1118  Doctype element.
1119  */
1120  while ((LocaleNCompare(q,"]>",2) != 0) && (*q != '\0'))
1121  (void) GetNextToken(q,&q,extent,token);
1122  continue;
1123  }
1124  if (LocaleNCompare(keyword,"<!--",4) == 0)
1125  {
1126  /*
1127  Comment element.
1128  */
1129  while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0'))
1130  (void) GetNextToken(q,&q,extent,token);
1131  continue;
1132  }
1133  if (LocaleCompare(keyword,"<include") == 0)
1134  {
1135  /*
1136  Include element.
1137  */
1138  while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
1139  {
1140  (void) CopyMagickString(keyword,token,MagickPathExtent);
1141  (void) GetNextToken(q,&q,extent,token);
1142  if (*token != '=')
1143  continue;
1144  (void) GetNextToken(q,&q,extent,token);
1145  if (LocaleCompare(keyword,"file") == 0)
1146  {
1147  if (depth > MagickMaxRecursionDepth)
1148  (void) ThrowMagickException(exception,GetMagickModule(),
1149  ConfigureError,"IncludeNodeNestedTooDeeply","`%s'",token);
1150  else
1151  {
1152  char
1153  path[MagickPathExtent],
1154  *file_xml;
1155 
1157  *sans_exception;
1158 
1159  *path='\0';
1160  GetPathComponent(filename,HeadPath,path);
1161  if (*path != '\0')
1164  if (*token == *DirectorySeparator)
1165  (void) CopyMagickString(path,token,MagickPathExtent);
1166  else
1167  (void) ConcatenateMagickString(path,token,MagickPathExtent);
1168  sans_exception=AcquireExceptionInfo();
1169  file_xml=FileToString(path,~0UL,sans_exception);
1170  sans_exception=DestroyExceptionInfo(sans_exception);
1171  if (file_xml != (char *) NULL)
1172  {
1173  status&=LoadTypeCache(cache,file_xml,path,depth+1,
1174  exception);
1175  file_xml=(char *) RelinquishMagickMemory(file_xml);
1176  }
1177  }
1178  }
1179  }
1180  continue;
1181  }
1182  if (LocaleCompare(keyword,"<type") == 0)
1183  {
1184  /*
1185  Type element.
1186  */
1187  type_info=(TypeInfo *) AcquireCriticalMemory(sizeof(*type_info));
1188  (void) memset(type_info,0,sizeof(*type_info));
1189  type_info->path=ConstantString(filename);
1190  type_info->signature=MagickCoreSignature;
1191  continue;
1192  }
1193  if (type_info == (TypeInfo *) NULL)
1194  continue;
1195  if ((LocaleCompare(keyword,"/>") == 0) ||
1196  (LocaleCompare(keyword,"</policy>") == 0))
1197  {
1198  status=AddValueToSplayTree(cache,type_info->name,type_info);
1199  if (status == MagickFalse)
1200  (void) ThrowMagickException(exception,GetMagickModule(),
1201  ResourceLimitError,"MemoryAllocationFailed","`%s'",type_info->name);
1202  type_info=(TypeInfo *) NULL;
1203  continue;
1204  }
1205  (void) GetNextToken(q,(const char **) NULL,extent,token);
1206  if (*token != '=')
1207  continue;
1208  (void) GetNextToken(q,&q,extent,token);
1209  (void) GetNextToken(q,&q,extent,token);
1210  switch (*keyword)
1211  {
1212  case 'E':
1213  case 'e':
1214  {
1215  if (LocaleCompare((char *) keyword,"encoding") == 0)
1216  {
1217  type_info->encoding=ConstantString(token);
1218  break;
1219  }
1220  break;
1221  }
1222  case 'F':
1223  case 'f':
1224  {
1225  if (LocaleCompare((char *) keyword,"face") == 0)
1226  {
1227  type_info->face=StringToUnsignedLong(token);
1228  break;
1229  }
1230  if (LocaleCompare((char *) keyword,"family") == 0)
1231  {
1232  type_info->family=ConstantString(token);
1233  break;
1234  }
1235  if (LocaleCompare((char *) keyword,"format") == 0)
1236  {
1237  type_info->format=ConstantString(token);
1238  break;
1239  }
1240  if (LocaleCompare((char *) keyword,"foundry") == 0)
1241  {
1242  type_info->foundry=ConstantString(token);
1243  break;
1244  }
1245  if (LocaleCompare((char *) keyword,"fullname") == 0)
1246  {
1247  type_info->description=ConstantString(token);
1248  break;
1249  }
1250  break;
1251  }
1252  case 'G':
1253  case 'g':
1254  {
1255  if (LocaleCompare((char *) keyword,"glyphs") == 0)
1256  {
1257  if (SetTypeNodePath(filename,font_path,token,&type_info->glyphs) ==
1258  MagickFalse)
1259  type_info=(TypeInfo *) DestroyTypeNode(type_info);
1260  break;
1261  }
1262  break;
1263  }
1264  case 'M':
1265  case 'm':
1266  {
1267  if (LocaleCompare((char *) keyword,"metrics") == 0)
1268  {
1269  if (SetTypeNodePath(filename,font_path,token,&type_info->metrics) ==
1270  MagickFalse)
1271  type_info=(TypeInfo *) DestroyTypeNode(type_info);
1272  break;
1273  }
1274  break;
1275  }
1276  case 'N':
1277  case 'n':
1278  {
1279  if (LocaleCompare((char *) keyword,"name") == 0)
1280  {
1281  type_info->name=ConstantString(token);
1282  break;
1283  }
1284  break;
1285  }
1286  case 'S':
1287  case 's':
1288  {
1289  if (LocaleCompare((char *) keyword,"stealth") == 0)
1290  {
1291  type_info->stealth=IsStringTrue(token);
1292  break;
1293  }
1294  if (LocaleCompare((char *) keyword,"stretch") == 0)
1295  {
1296  type_info->stretch=(StretchType) ParseCommandOption(
1298  break;
1299  }
1300  if (LocaleCompare((char *) keyword,"style") == 0)
1301  {
1303  MagickFalse,token);
1304  break;
1305  }
1306  break;
1307  }
1308  case 'W':
1309  case 'w':
1310  {
1311  if (LocaleCompare((char *) keyword,"weight") == 0)
1312  {
1313  ssize_t
1314  weight;
1315 
1317  if (weight == -1)
1318  weight=(ssize_t) StringToUnsignedLong(token);
1319  type_info->weight=(size_t) weight;
1320  break;
1321  }
1322  break;
1323  }
1324  default:
1325  break;
1326  }
1327  }
1328  token=(char *) RelinquishMagickMemory(token);
1329  return(status != 0 ? MagickTrue : MagickFalse);
1330 }
1331 
1332 /*
1333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1334 % %
1335 % %
1336 % %
1337 + T y p e C o m p o n e n t G e n e s i s %
1338 % %
1339 % %
1340 % %
1341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1342 %
1343 % TypeComponentGenesis() instantiates the type component.
1344 %
1345 % The format of the TypeComponentGenesis method is:
1346 %
1347 % MagickBooleanType TypeComponentGenesis(void)
1348 %
1349 */
1351 {
1352  if (type_semaphore == (SemaphoreInfo *) NULL)
1354  return(MagickTrue);
1355 }
1356 
1357 /*
1358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1359 % %
1360 % %
1361 % %
1362 + T y p e C o m p o n e n t T e r m i n u s %
1363 % %
1364 % %
1365 % %
1366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1367 %
1368 % TypeComponentTerminus() destroy type component.
1369 %
1370 % The format of the TypeComponentTerminus method is:
1371 %
1372 % void TypeComponentTerminus(void)
1373 %
1374 */
1376 {
1377  if (type_semaphore == (SemaphoreInfo *) NULL)
1380  if (type_cache != (SplayTreeInfo *) NULL)
1381  type_cache=DestroySplayTree(type_cache);
1384 }
static SemaphoreInfo * type_semaphore
Definition: type.c:123
size_t face
Definition: type.h:53
#define MagickMaxRecursionDepth
Definition: studio.h:344
MagickExport MagickBooleanType AddValueToSplayTree(SplayTreeInfo *splay_tree, const void *key, const void *value)
Definition: splay-tree.c:154
StyleType
Definition: type.h:40
MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:450
static unsigned long StringToUnsignedLong(const char *magick_restrict value)
#define MagickTypeFilename
Definition: type.c:106
MagickExport ssize_t ParseCommandOption(const CommandOption option, const MagickBooleanType list, const char *options)
Definition: option.c:2968
MagickExport const TypeInfo * GetTypeInfo(const char *name, ExceptionInfo *exception)
Definition: type.c:276
char * description
Definition: type.h:56
char * metrics
Definition: type.h:71
MagickExport size_t ConcatenateMagickString(char *destination, const char *source, const size_t length)
Definition: string.c:426
MagickExport SemaphoreInfo * AcquireSemaphoreInfo(void)
Definition: semaphore.c:192
static SplayTreeInfo * type_cache
Definition: type.c:126
MagickExport MagickBooleanType ListTypeInfo(FILE *file, ExceptionInfo *exception)
Definition: type.c:935
static MagickBooleanType IsTypeTreeInstantiated(ExceptionInfo *)
Definition: type.c:885
MagickPrivate MagickBooleanType TypeComponentGenesis(void)
Definition: type.c:1350
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
Definition: exception.c:115
MagickExport ssize_t FormatLocaleString(char *magick_restrict string, const size_t length, const char *magick_restrict format,...)
Definition: locale.c:499
static void * AcquireCriticalMemory(const size_t size)
char * path
Definition: type.h:56
size_t weight
Definition: type.h:68
MagickExport size_t GetNextToken(const char *start, const char **end, const size_t extent, char *token)
Definition: token.c:173
Definition: log.h:52
MagickExport char * FileToString(const char *filename, const size_t extent, ExceptionInfo *exception)
Definition: string.c:1000
char * foundry
Definition: type.h:71
MagickExport void * GetNextValueInLinkedList(LinkedListInfo *list_info)
Definition: linked-list.c:305
static SplayTreeInfo * AcquireTypeCache(const char *filename, ExceptionInfo *exception)
Definition: type.c:190
MagickExport const void * GetNextValueInSplayTree(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:823
#define MagickCoreSignature
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:293
MagickExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
Definition: string.c:1215
MagickExport char ** GetTypeList(const char *pattern, size_t *number_fonts, ExceptionInfo *exception)
Definition: type.c:646
MagickExport LinkedListInfo * GetConfigureOptions(const char *filename, ExceptionInfo *exception)
Definition: configure.c:639
MagickExport void GetPathComponent(const char *path, PathType type, char *component)
Definition: utility.c:1213
MagickExport ssize_t FormatLocaleFile(FILE *file, const char *magick_restrict format,...)
Definition: locale.c:404
MagickBooleanType
Definition: magick-type.h:158
#define DirectorySeparator
Definition: studio.h:259
unsigned int MagickStatusType
Definition: magick-type.h:121
MagickExport char * AcquireString(const char *source)
Definition: string.c:129
char * family
Definition: type.h:56
MagickExport const char * CommandOptionToMnemonic(const CommandOption option, const ssize_t type)
Definition: option.c:2681
MagickExport void * AcquireQuantumMemory(const size_t count, const size_t quantum)
Definition: memory.c:543
MagickExport int LocaleNCompare(const char *p, const char *q, const size_t length)
Definition: locale.c:1570
StretchType stretch
Definition: type.h:65
StretchType
Definition: type.h:25
MagickExport MagickBooleanType NTAcquireTypeCache(SplayTreeInfo *, ExceptionInfo *)
MagickExport SplayTreeInfo * DestroySplayTree(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:682
MagickExport MagickBooleanType GlobExpression(const char *expression, const char *pattern, const MagickBooleanType case_insensitive)
Definition: token.c:352
#define MagickPathExtent
static void * DestroyTypeNode(void *type_info)
Definition: type.c:163
char * glyphs
Definition: type.h:71
MagickExport MagickBooleanType IsStringTrue(const char *value)
Definition: string.c:1425
Definition: type.h:50
static const char TypeMap[]
Definition: type.c:112
MagickExport SplayTreeInfo * NewSplayTree(int(*compare)(const void *, const void *), void *(*relinquish_key)(void *), void *(*relinquish_value)(void *))
Definition: splay-tree.c:1141
static MagickBooleanType SetTypeNodePath(const char *filename, char *font_path, const char *token, char **target)
Definition: type.c:1030
char * format
Definition: type.h:71
MagickExport MagickBooleanType ThrowMagickException(ExceptionInfo *exception, const char *module, const char *function, const size_t line, const ExceptionType severity, const char *tag, const char *format,...)
Definition: exception.c:1145
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1413
MagickExport MagickBooleanType IsPathAccessible(const char *path)
Definition: utility.c:1467
MagickExport const TypeInfo * GetTypeInfoByFamily(const char *family, const StyleType style, const StretchType stretch, const size_t weight, ExceptionInfo *exception)
Definition: type.c:323
MagickExport MagickBooleanType SubstituteString(char **string, const char *search, const char *replace)
Definition: string.c:2571
MagickExport char * GetEnvironmentValue(const char *name)
Definition: string.c:1182
MagickBooleanType stealth
Definition: type.h:78
MagickExport size_t CopyMagickString(char *destination, const char *source, const size_t length)
Definition: string.c:755
MagickExport const void * GetValueFromSplayTree(SplayTreeInfo *splay_tree, const void *key)
Definition: splay-tree.c:921
#define MagickMax(x, y)
Definition: image-private.h:26
MagickExport int LocaleCompare(const char *p, const char *q)
Definition: locale.c:1435
#define GetMagickModule()
Definition: log.h:28
MagickPrivate void TypeComponentTerminus(void)
Definition: type.c:1375
MagickExport int CompareSplayTreeString(const void *target, const void *source)
Definition: splay-tree.c:412
MagickExport const char * GetStringInfoPath(const StringInfo *string_info)
Definition: string.c:1302
static int TypeInfoCompare(const void *x, const void *y)
Definition: type.c:536
static MagickBooleanType LoadTypeCache(SplayTreeInfo *, const char *, const char *, const size_t, ExceptionInfo *)
Definition: type.c:1067
MagickExport char * DestroyString(char *string)
Definition: string.c:823
MagickExport void * AcquireMagickMemory(const size_t size)
Definition: memory.c:472
MagickExport void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:97
MagickExport const TypeInfo ** GetTypeInfoList(const char *pattern, size_t *number_fonts, ExceptionInfo *exception)
Definition: type.c:553
MagickExport const void * GetRootValueFromSplayTree(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:877
#define MagickMin(x, y)
Definition: image-private.h:27
Definition: type.h:46
MagickExport void ResetSplayTreeIterator(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:1472
MagickExport void * RelinquishMagickMemory(void *memory)
Definition: memory.c:1069
MagickExport size_t GetNumberOfNodesInSplayTree(const SplayTreeInfo *splay_tree)
Definition: splay-tree.c:976
static int TypeCompare(const void *x, const void *y)
Definition: type.c:631
char * encoding
Definition: type.h:71
size_t signature
Definition: type.h:81
#define MagickPrivate
#define MagickExport
StyleType style
Definition: type.h:62
MagickExport void RelinquishSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:351
MagickExport LinkedListInfo * DestroyConfigureOptions(LinkedListInfo *options)
Definition: configure.c:311
MagickExport char * ConstantString(const char *source)
Definition: string.c:700
char * name
Definition: type.h:56
MagickExport ExceptionInfo * DestroyExceptionInfo(ExceptionInfo *exception)
Definition: exception.c:418