MagickCore  7.0.7
Convert, Edit, Or Compose Bitmap Images
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-2018 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://www.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
112  *TypeMap = (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,
331  *substitute;
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  { NULL, NULL }
357  };
358 
359  size_t
360  font_weight,
361  max_score,
362  score;
363 
364  /*
365  Check for an exact type match.
366  */
367  (void) GetTypeInfo("*",exception);
368  if (type_cache == (SplayTreeInfo *) NULL)
369  return((TypeInfo *) NULL);
370  font_weight=weight == 0 ? 400 : weight;
373  type_info=(const TypeInfo *) NULL;
375  while (p != (const TypeInfo *) NULL)
376  {
377  if (p->family == (char *) NULL)
378  {
380  continue;
381  }
382  if (family == (const char *) NULL)
383  {
384  if ((LocaleCompare(p->family,"arial") != 0) &&
385  (LocaleCompare(p->family,"helvetica") != 0))
386  {
388  continue;
389  }
390  }
391  else
392  if (LocaleCompare(p->family,family) != 0)
393  {
395  continue;
396  }
397  if ((style != UndefinedStyle) && (style != AnyStyle) && (p->style != style))
398  {
400  continue;
401  }
402  if ((stretch != UndefinedStretch) && (stretch != AnyStretch) &&
403  (p->stretch != stretch))
404  {
406  continue;
407  }
408  if (p->weight != font_weight)
409  {
411  continue;
412  }
413  type_info=p;
414  break;
415  }
417  if (type_info != (const TypeInfo *) NULL)
418  return(type_info);
419  /*
420  Check for types in the same family.
421  */
422  max_score=0;
426  while (p != (const TypeInfo *) NULL)
427  {
428  if (p->family == (char *) NULL)
429  {
431  continue;
432  }
433  if (family == (const char *) NULL)
434  {
435  if ((LocaleCompare(p->family,"arial") != 0) &&
436  (LocaleCompare(p->family,"helvetica") != 0))
437  {
439  continue;
440  }
441  }
442  else
443  if (LocaleCompare(p->family,family) != 0)
444  {
446  continue;
447  }
448  score=0;
449  if ((style == UndefinedStyle) || (style == AnyStyle) || (p->style == style))
450  score+=32;
451  else
452  if (((style == ItalicStyle) || (style == ObliqueStyle)) &&
453  ((p->style == ItalicStyle) || (p->style == ObliqueStyle)))
454  score+=25;
455  score+=(16*(800-((ssize_t) MagickMax(MagickMin(font_weight,900),p->weight)-
456  (ssize_t) MagickMin(MagickMin(font_weight,900),p->weight))))/800;
457  if ((stretch == UndefinedStretch) || (stretch == AnyStretch))
458  score+=8;
459  else
460  {
461  range=(ssize_t) UltraExpandedStretch-(ssize_t) NormalStretch;
462  score+=(8*(range-((ssize_t) MagickMax(stretch,p->stretch)-
463  (ssize_t) MagickMin(stretch,p->stretch))))/range;
464  }
465  if (score > max_score)
466  {
467  max_score=score;
468  type_info=p;
469  }
471  }
473  if (type_info != (const TypeInfo *) NULL)
474  return(type_info);
475  /*
476  Check for table-based substitution match.
477  */
478  for (i=0; fontmap[i].name != (char *) NULL; i++)
479  {
480  if (family == (const char *) NULL)
481  {
482  if ((LocaleCompare(fontmap[i].name,"arial") != 0) &&
483  (LocaleCompare(fontmap[i].name,"helvetica") != 0))
484  continue;
485  }
486  else
487  if (LocaleCompare(fontmap[i].name,family) != 0)
488  continue;
489  type_info=GetTypeInfoByFamily(fontmap[i].substitute,style,stretch,weight,
490  exception);
491  break;
492  }
493  if (type_info != (const TypeInfo *) NULL)
494  {
496  "FontSubstitutionRequired","`%s'",type_info->family);
497  return(type_info);
498  }
499  if (family != (const char *) NULL)
500  type_info=GetTypeInfoByFamily((const char *) NULL,style,stretch,weight,
501  exception);
502  return(type_info);
503 }
504 
505 /*
506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
507 % %
508 % %
509 % %
510 % G e t T y p e I n f o L i s t %
511 % %
512 % %
513 % %
514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
515 %
516 % GetTypeInfoList() returns any fonts that match the specified pattern.
517 %
518 % The format of the GetTypeInfoList function is:
519 %
520 % const TypeInfo **GetTypeInfoList(const char *pattern,
521 % size_t *number_fonts,ExceptionInfo *exception)
522 %
523 % A description of each parameter follows:
524 %
525 % o pattern: Specifies a pointer to a text string containing a pattern.
526 %
527 % o number_fonts: This integer returns the number of types in the list.
528 %
529 % o exception: return any errors or warnings in this structure.
530 %
531 */
532 
533 #if defined(__cplusplus) || defined(c_plusplus)
534 extern "C" {
535 #endif
536 
537 static int TypeInfoCompare(const void *x,const void *y)
538 {
539  const TypeInfo
540  **p,
541  **q;
542 
543  p=(const TypeInfo **) x,
544  q=(const TypeInfo **) y;
545  if (LocaleCompare((*p)->path,(*q)->path) == 0)
546  return(LocaleCompare((*p)->name,(*q)->name));
547  return(LocaleCompare((*p)->path,(*q)->path));
548 }
549 
550 #if defined(__cplusplus) || defined(c_plusplus)
551 }
552 #endif
553 
554 MagickExport const TypeInfo **GetTypeInfoList(const char *pattern,
555  size_t *number_fonts,ExceptionInfo *exception)
556 {
557  const TypeInfo
558  **fonts;
559 
560  register const TypeInfo
561  *p;
562 
563  register ssize_t
564  i;
565 
566  /*
567  Allocate type list.
568  */
569  assert(pattern != (char *) NULL);
570  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
571  assert(number_fonts != (size_t *) NULL);
572  *number_fonts=0;
573  p=GetTypeInfo("*",exception);
574  if (p == (const TypeInfo *) NULL)
575  return((const TypeInfo **) NULL);
576  fonts=(const TypeInfo **) AcquireQuantumMemory((size_t)
577  GetNumberOfNodesInSplayTree(type_cache)+1UL,sizeof(*fonts));
578  if (fonts == (const TypeInfo **) NULL)
579  return((const TypeInfo **) NULL);
580  /*
581  Generate type list.
582  */
586  for (i=0; p != (const TypeInfo *) NULL; )
587  {
588  if ((p->stealth == MagickFalse) &&
589  (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
590  fonts[i++]=p;
592  }
594  qsort((void *) fonts,(size_t) i,sizeof(*fonts),TypeInfoCompare);
595  fonts[i]=(TypeInfo *) NULL;
596  *number_fonts=(size_t) i;
597  return(fonts);
598 }
599 
600 /*
601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
602 % %
603 % %
604 % %
605 % G e t T y p e L i s t %
606 % %
607 % %
608 % %
609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
610 %
611 % GetTypeList() returns any fonts that match the specified pattern.
612 %
613 % The format of the GetTypeList function is:
614 %
615 % char **GetTypeList(const char *pattern,size_t *number_fonts,
616 % ExceptionInfo *exception)
617 %
618 % A description of each parameter follows:
619 %
620 % o pattern: Specifies a pointer to a text string containing a pattern.
621 %
622 % o number_fonts: This integer returns the number of fonts in the list.
623 %
624 % o exception: return any errors or warnings in this structure.
625 %
626 */
627 
628 #if defined(__cplusplus) || defined(c_plusplus)
629 extern "C" {
630 #endif
631 
632 static int TypeCompare(const void *x,const void *y)
633 {
634  register const char
635  **p,
636  **q;
637 
638  p=(const char **) x;
639  q=(const char **) y;
640  return(LocaleCompare(*p,*q));
641 }
642 
643 #if defined(__cplusplus) || defined(c_plusplus)
644 }
645 #endif
646 
647 MagickExport char **GetTypeList(const char *pattern,size_t *number_fonts,
648  ExceptionInfo *exception)
649 {
650  char
651  **fonts;
652 
653  register const TypeInfo
654  *p;
655 
656  register ssize_t
657  i;
658 
659  /*
660  Allocate type list.
661  */
662  assert(pattern != (char *) NULL);
663  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
664  assert(number_fonts != (size_t *) NULL);
665  *number_fonts=0;
666  p=GetTypeInfo("*",exception);
667  if (p == (const TypeInfo *) NULL)
668  return((char **) NULL);
669  fonts=(char **) AcquireQuantumMemory((size_t)
670  GetNumberOfNodesInSplayTree(type_cache)+1UL,sizeof(*fonts));
671  if (fonts == (char **) NULL)
672  return((char **) NULL);
673  /*
674  Generate type list.
675  */
679  for (i=0; p != (const TypeInfo *) NULL; )
680  {
681  if ((p->stealth == MagickFalse) &&
682  (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
683  fonts[i++]=ConstantString(p->name);
685  }
687  qsort((void *) fonts,(size_t) i,sizeof(*fonts),TypeCompare);
688  fonts[i]=(char *) NULL;
689  *number_fonts=(size_t) i;
690  return(fonts);
691 }
692 
693 /*
694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
695 % %
696 % %
697 % %
698 + I s T y p e T r e e I n s t a n t i a t e d %
699 % %
700 % %
701 % %
702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
703 %
704 % IsTypeTreeInstantiated() determines if the type tree is instantiated. If
705 % not, it instantiates the tree and returns it.
706 %
707 % The format of the IsTypeInstantiated method is:
708 %
709 % MagickBooleanType IsTypeTreeInstantiated(ExceptionInfo *exception)
710 %
711 % A description of each parameter follows.
712 %
713 % o exception: return any errors or warnings in this structure.
714 %
715 */
716 
717 #if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
719  ExceptionInfo *exception)
720 {
721 #if !defined(FC_FULLNAME)
722 #define FC_FULLNAME "fullname"
723 #endif
724 
725  char
726  extension[MagickPathExtent],
727  name[MagickPathExtent];
728 
729  FcChar8
730  *family,
731  *file,
732  *fullname,
733  *style;
734 
735  FcConfig
736  *font_config;
737 
738  FcFontSet
739  *font_set;
740 
741  FcObjectSet
742  *object_set;
743 
744  FcPattern
745  *pattern;
746 
747  FcResult
748  status;
749 
750  int
751  slant,
752  width,
753  weight;
754 
755  register ssize_t
756  i;
757 
758  TypeInfo
759  *type_info;
760 
761  /*
762  Load system fonts.
763  */
764  (void) exception;
765  font_config=FcInitLoadConfigAndFonts();
766  if (font_config == (FcConfig *) NULL)
767  return(MagickFalse);
768  font_set=(FcFontSet *) NULL;
769  object_set=FcObjectSetBuild(FC_FULLNAME,FC_FAMILY,FC_STYLE,FC_SLANT,
770  FC_WIDTH,FC_WEIGHT,FC_FILE,(char *) NULL);
771  if (object_set != (FcObjectSet *) NULL)
772  {
773  pattern=FcPatternCreate();
774  if (pattern != (FcPattern *) NULL)
775  {
776  font_set=FcFontList(0,pattern,object_set);
777  FcPatternDestroy(pattern);
778  }
779  FcObjectSetDestroy(object_set);
780  }
781  if (font_set == (FcFontSet *) NULL)
782  {
783  FcConfigDestroy(font_config);
784  return(MagickFalse);
785  }
786  for (i=0; i < (ssize_t) font_set->nfont; i++)
787  {
788  status=FcPatternGetString(font_set->fonts[i],FC_FAMILY,0,&family);
789  if (status != FcResultMatch)
790  continue;
791  status=FcPatternGetString(font_set->fonts[i],FC_FILE,0,&file);
792  if (status != FcResultMatch)
793  continue;
794  *extension='\0';
795  GetPathComponent((const char *) file,ExtensionPath,extension);
796  if ((*extension != '\0') && (LocaleCompare(extension,"gz") == 0))
797  continue;
798  type_info=(TypeInfo *) AcquireMagickMemory(sizeof(*type_info));
799  if (type_info == (TypeInfo *) NULL)
800  continue;
801  (void) ResetMagickMemory(type_info,0,sizeof(*type_info));
802  type_info->path=ConstantString("System Fonts");
803  type_info->signature=MagickCoreSignature;
804  (void) CopyMagickString(name,"Unknown",MagickPathExtent);
805  status=FcPatternGetString(font_set->fonts[i],FC_FULLNAME,0,&fullname);
806  if ((status == FcResultMatch) && (fullname != (FcChar8 *) NULL))
807  (void) CopyMagickString(name,(const char *) fullname,MagickPathExtent);
808  else
809  {
810  if (family != (FcChar8 *) NULL)
811  (void) CopyMagickString(name,(const char *) family,MagickPathExtent);
812  status=FcPatternGetString(font_set->fonts[i],FC_STYLE,0,&style);
813  if ((status == FcResultMatch) && (style != (FcChar8 *) NULL) &&
814  (LocaleCompare((const char *) style,"Regular") != 0))
815  {
816  (void) ConcatenateMagickString(name," ",MagickPathExtent);
817  (void) ConcatenateMagickString(name,(const char *) style,
819  }
820  }
821  type_info->name=ConstantString(name);
822  (void) SubstituteString(&type_info->name," ","-");
823  type_info->family=ConstantString((const char *) family);
824  status=FcPatternGetInteger(font_set->fonts[i],FC_SLANT,0,&slant);
825  type_info->style=NormalStyle;
826  if (slant == FC_SLANT_ITALIC)
827  type_info->style=ItalicStyle;
828  if (slant == FC_SLANT_OBLIQUE)
829  type_info->style=ObliqueStyle;
830  status=FcPatternGetInteger(font_set->fonts[i],FC_WIDTH,0,&width);
831  type_info->stretch=NormalStretch;
832  if (width >= FC_WIDTH_ULTRACONDENSED)
833  type_info->stretch=UltraCondensedStretch;
834  if (width >= FC_WIDTH_EXTRACONDENSED)
835  type_info->stretch=ExtraCondensedStretch;
836  if (width >= FC_WIDTH_CONDENSED)
837  type_info->stretch=CondensedStretch;
838  if (width >= FC_WIDTH_SEMICONDENSED)
839  type_info->stretch=SemiCondensedStretch;
840  if (width >= FC_WIDTH_NORMAL)
841  type_info->stretch=NormalStretch;
842  if (width >= FC_WIDTH_SEMIEXPANDED)
843  type_info->stretch=SemiExpandedStretch;
844  if (width >= FC_WIDTH_EXPANDED)
845  type_info->stretch=ExpandedStretch;
846  if (width >= FC_WIDTH_EXTRAEXPANDED)
847  type_info->stretch=ExtraExpandedStretch;
848  if (width >= FC_WIDTH_ULTRAEXPANDED)
849  type_info->stretch=UltraExpandedStretch;
850  type_info->weight=400;
851  status=FcPatternGetInteger(font_set->fonts[i],FC_WEIGHT,0,&weight);
852  if (weight >= FC_WEIGHT_THIN)
853  type_info->weight=100;
854  if (weight >= FC_WEIGHT_EXTRALIGHT)
855  type_info->weight=200;
856  if (weight >= FC_WEIGHT_LIGHT)
857  type_info->weight=300;
858  if (weight >= FC_WEIGHT_NORMAL)
859  type_info->weight=400;
860  if (weight >= FC_WEIGHT_MEDIUM)
861  type_info->weight=500;
862  if (weight >= FC_WEIGHT_DEMIBOLD)
863  type_info->weight=600;
864  if (weight >= FC_WEIGHT_BOLD)
865  type_info->weight=700;
866  if (weight >= FC_WEIGHT_EXTRABOLD)
867  type_info->weight=800;
868  if (weight >= FC_WEIGHT_BLACK)
869  type_info->weight=900;
870  type_info->glyphs=ConstantString((const char *) file);
871  (void) AddValueToSplayTree(type_cache,type_info->name,type_info);
872  }
873  FcFontSetDestroy(font_set);
874  FcConfigDestroy(font_config);
875  return(MagickTrue);
876 }
877 #endif
878 
880 {
881  if (type_cache == (SplayTreeInfo *) NULL)
882  {
883  if (type_semaphore == (SemaphoreInfo *) NULL)
886  if (type_cache == (SplayTreeInfo *) NULL)
887  {
889  *splay_tree;
890 
891  splay_tree=AcquireTypeCache(MagickTypeFilename,exception);
892 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
893  (void) NTAcquireTypeCache(splay_tree,exception);
894 #endif
895 #if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
896  (void) LoadFontConfigFonts(splay_tree,exception);
897 #endif
898  type_cache=splay_tree;
899  }
901  }
902  return(type_cache != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
903 }
904 
905 /*
906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
907 % %
908 % %
909 % %
910 % L i s t T y p e I n f o %
911 % %
912 % %
913 % %
914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
915 %
916 % ListTypeInfo() lists the fonts to a file.
917 %
918 % The format of the ListTypeInfo method is:
919 %
920 % MagickBooleanType ListTypeInfo(FILE *file,ExceptionInfo *exception)
921 %
922 % A description of each parameter follows.
923 %
924 % o file: An pointer to a FILE.
925 %
926 % o exception: return any errors or warnings in this structure.
927 %
928 */
930 {
931  char
932  weight[MagickPathExtent];
933 
934  const char
935  *family,
936  *glyphs,
937  *name,
938  *path,
939  *stretch,
940  *style;
941 
942  const TypeInfo
943  **type_info;
944 
945  register ssize_t
946  i;
947 
948  size_t
949  number_fonts;
950 
951  if (file == (FILE *) NULL)
952  file=stdout;
953  number_fonts=0;
954  type_info=GetTypeInfoList("*",&number_fonts,exception);
955  if (type_info == (const TypeInfo **) NULL)
956  return(MagickFalse);
957  *weight='\0';
958  path=(const char *) NULL;
959  for (i=0; i < (ssize_t) number_fonts; i++)
960  {
961  if (type_info[i]->stealth != MagickFalse)
962  continue;
963  if (((path == (const char *) NULL) ||
964  (LocaleCompare(path,type_info[i]->path) != 0)) &&
965  (type_info[i]->path != (char *) NULL))
966  (void) FormatLocaleFile(file,"\nPath: %s\n",type_info[i]->path);
967  path=type_info[i]->path;
968  name="unknown";
969  if (type_info[i]->name != (char *) NULL)
970  name=type_info[i]->name;
971  family="unknown";
972  if (type_info[i]->family != (char *) NULL)
973  family=type_info[i]->family;
974  style=CommandOptionToMnemonic(MagickStyleOptions,type_info[i]->style);
975  stretch=CommandOptionToMnemonic(MagickStretchOptions,type_info[i]->stretch);
976  glyphs="unknown";
977  if (type_info[i]->glyphs != (char *) NULL)
978  glyphs=type_info[i]->glyphs;
979  (void) FormatLocaleString(weight,MagickPathExtent,"%.20g",(double)
980  type_info[i]->weight);
981  (void) FormatLocaleFile(file," Font: %s\n",name);
982  (void) FormatLocaleFile(file," family: %s\n",family);
983  (void) FormatLocaleFile(file," style: %s\n",style);
984  (void) FormatLocaleFile(file," stretch: %s\n",stretch);
985  (void) FormatLocaleFile(file," weight: %s\n",weight);
986  (void) FormatLocaleFile(file," glyphs: %s\n",glyphs);
987  }
988  (void) fflush(file);
989  type_info=(const TypeInfo **) RelinquishMagickMemory((void *) type_info);
990  return(MagickTrue);
991 }
992 
993 /*
994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
995 % %
996 % %
997 % %
998 + L o a d T y p e C a c h e %
999 % %
1000 % %
1001 % %
1002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1003 %
1004 % LoadTypeCache() loads the type configurations which provides a mapping
1005 % between type attributes and a type name.
1006 %
1007 % The format of the LoadTypeCache method is:
1008 %
1009 % MagickBooleanType LoadTypeCache(SplayTreeInfo *cache,const char *xml,
1010 % const char *filename,const size_t depth,ExceptionInfo *exception)
1011 %
1012 % A description of each parameter follows:
1013 %
1014 % o xml: The type list in XML format.
1015 %
1016 % o filename: The type list filename.
1017 %
1018 % o depth: depth of <include /> statements.
1019 %
1020 % o exception: return any errors or warnings in this structure.
1021 %
1022 */
1023 
1024 static inline MagickBooleanType SetTypeNodePath(const char *filename,
1025  char *font_path,const char *token,char **target)
1026 {
1027  char
1028  *path;
1029 
1030  path=ConstantString(token);
1031 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
1032  if (strchr(path,'@') != (char *) NULL)
1033  SubstituteString(&path,"@ghostscript_font_path@",font_path);
1034 #endif
1035  if (IsPathAccessible(path) == MagickFalse)
1036  {
1037  /*
1038  Relative path.
1039  */
1040  path=DestroyString(path);
1041  GetPathComponent(filename,HeadPath,font_path);
1044  (void) ConcatenateMagickString(font_path,token,MagickPathExtent);
1045  path=ConstantString(font_path);
1046 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
1047  if (strchr(path,'@') != (char *) NULL)
1048  SubstituteString(&path,"@ghostscript_font_path@","");
1049 #endif
1050  if (IsPathAccessible(path) == MagickFalse)
1051  {
1052  path=DestroyString(path);
1053  return(MagickFalse);
1054  }
1055  }
1056 
1057  *target=path;
1058  return(MagickTrue);
1059 }
1060 
1061 static MagickBooleanType LoadTypeCache(SplayTreeInfo *cache,const char *xml,
1062  const char *filename,const size_t depth,ExceptionInfo *exception)
1063 {
1064  char
1065  font_path[MagickPathExtent],
1066  keyword[MagickPathExtent],
1067  *token;
1068 
1069  const char
1070  *q;
1071 
1073  status;
1074 
1075  size_t
1076  extent;
1077 
1078  TypeInfo
1079  *type_info;
1080 
1081  /*
1082  Load the type map file.
1083  */
1085  "Loading type configure file \"%s\" ...",filename);
1086  if (xml == (const char *) NULL)
1087  return(MagickFalse);
1088  status=MagickTrue;
1089  type_info=(TypeInfo *) NULL;
1090  token=AcquireString(xml);
1091  extent=strlen(token)+MagickPathExtent;
1092 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
1093  /*
1094  Determine the Ghostscript font path.
1095  */
1096  *font_path='\0';
1097  if (NTGhostscriptFonts(font_path,MagickPathExtent-2))
1099 #endif
1100  for (q=(char *) xml; *q != '\0'; )
1101  {
1102  /*
1103  Interpret XML.
1104  */
1105  GetNextToken(q,&q,extent,token);
1106  if (*token == '\0')
1107  break;
1108  (void) CopyMagickString(keyword,token,MagickPathExtent);
1109  if (LocaleNCompare(keyword,"<!DOCTYPE",9) == 0)
1110  {
1111  /*
1112  Doctype element.
1113  */
1114  while ((LocaleNCompare(q,"]>",2) != 0) && (*q != '\0'))
1115  GetNextToken(q,&q,extent,token);
1116  continue;
1117  }
1118  if (LocaleNCompare(keyword,"<!--",4) == 0)
1119  {
1120  /*
1121  Comment element.
1122  */
1123  while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0'))
1124  GetNextToken(q,&q,extent,token);
1125  continue;
1126  }
1127  if (LocaleCompare(keyword,"<include") == 0)
1128  {
1129  /*
1130  Include element.
1131  */
1132  while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
1133  {
1134  (void) CopyMagickString(keyword,token,MagickPathExtent);
1135  GetNextToken(q,&q,extent,token);
1136  if (*token != '=')
1137  continue;
1138  GetNextToken(q,&q,extent,token);
1139  if (LocaleCompare(keyword,"file") == 0)
1140  {
1141  if (depth > 200)
1142  (void) ThrowMagickException(exception,GetMagickModule(),
1143  ConfigureError,"IncludeNodeNestedTooDeeply","`%s'",token);
1144  else
1145  {
1146  char
1147  path[MagickPathExtent],
1148  *file_xml;
1149 
1151  *sans_exception;
1152 
1153  *path='\0';
1154  GetPathComponent(filename,HeadPath,path);
1155  if (*path != '\0')
1158  if (*token == *DirectorySeparator)
1159  (void) CopyMagickString(path,token,MagickPathExtent);
1160  else
1161  (void) ConcatenateMagickString(path,token,MagickPathExtent);
1162  sans_exception=AcquireExceptionInfo();
1163  file_xml=FileToString(path,~0UL,sans_exception);
1164  sans_exception=DestroyExceptionInfo(sans_exception);
1165  if (file_xml != (char *) NULL)
1166  {
1167  status&=LoadTypeCache(cache,file_xml,path,depth+1,
1168  exception);
1169  file_xml=(char *) RelinquishMagickMemory(file_xml);
1170  }
1171  }
1172  }
1173  }
1174  continue;
1175  }
1176  if (LocaleCompare(keyword,"<type") == 0)
1177  {
1178  /*
1179  Type element.
1180  */
1181  type_info=(TypeInfo *) AcquireCriticalMemory(sizeof(*type_info));
1182  (void) ResetMagickMemory(type_info,0,sizeof(*type_info));
1183  type_info->path=ConstantString(filename);
1184  type_info->signature=MagickCoreSignature;
1185  continue;
1186  }
1187  if (type_info == (TypeInfo *) NULL)
1188  continue;
1189  if ((LocaleCompare(keyword,"/>") == 0) ||
1190  (LocaleCompare(keyword,"</policy>") == 0))
1191  {
1192  status=AddValueToSplayTree(cache,type_info->name,type_info);
1193  if (status == MagickFalse)
1194  (void) ThrowMagickException(exception,GetMagickModule(),
1195  ResourceLimitError,"MemoryAllocationFailed","`%s'",type_info->name);
1196  type_info=(TypeInfo *) NULL;
1197  continue;
1198  }
1199  GetNextToken(q,(const char **) NULL,extent,token);
1200  if (*token != '=')
1201  continue;
1202  GetNextToken(q,&q,extent,token);
1203  GetNextToken(q,&q,extent,token);
1204  switch (*keyword)
1205  {
1206  case 'E':
1207  case 'e':
1208  {
1209  if (LocaleCompare((char *) keyword,"encoding") == 0)
1210  {
1211  type_info->encoding=ConstantString(token);
1212  break;
1213  }
1214  break;
1215  }
1216  case 'F':
1217  case 'f':
1218  {
1219  if (LocaleCompare((char *) keyword,"face") == 0)
1220  {
1221  type_info->face=StringToUnsignedLong(token);
1222  break;
1223  }
1224  if (LocaleCompare((char *) keyword,"family") == 0)
1225  {
1226  type_info->family=ConstantString(token);
1227  break;
1228  }
1229  if (LocaleCompare((char *) keyword,"format") == 0)
1230  {
1231  type_info->format=ConstantString(token);
1232  break;
1233  }
1234  if (LocaleCompare((char *) keyword,"foundry") == 0)
1235  {
1236  type_info->foundry=ConstantString(token);
1237  break;
1238  }
1239  if (LocaleCompare((char *) keyword,"fullname") == 0)
1240  {
1241  type_info->description=ConstantString(token);
1242  break;
1243  }
1244  break;
1245  }
1246  case 'G':
1247  case 'g':
1248  {
1249  if (LocaleCompare((char *) keyword,"glyphs") == 0)
1250  {
1251  if (SetTypeNodePath(filename,font_path,token,&type_info->glyphs) ==
1252  MagickFalse)
1253  type_info=(TypeInfo *) DestroyTypeNode(type_info);
1254  break;
1255  }
1256  break;
1257  }
1258  case 'M':
1259  case 'm':
1260  {
1261  if (LocaleCompare((char *) keyword,"metrics") == 0)
1262  {
1263  if (SetTypeNodePath(filename,font_path,token,&type_info->metrics) ==
1264  MagickFalse)
1265  type_info=(TypeInfo *) DestroyTypeNode(type_info);
1266  break;
1267  }
1268  break;
1269  }
1270  case 'N':
1271  case 'n':
1272  {
1273  if (LocaleCompare((char *) keyword,"name") == 0)
1274  {
1275  type_info->name=ConstantString(token);
1276  break;
1277  }
1278  break;
1279  }
1280  case 'S':
1281  case 's':
1282  {
1283  if (LocaleCompare((char *) keyword,"stealth") == 0)
1284  {
1285  type_info->stealth=IsStringTrue(token);
1286  break;
1287  }
1288  if (LocaleCompare((char *) keyword,"stretch") == 0)
1289  {
1290  type_info->stretch=(StretchType) ParseCommandOption(
1292  break;
1293  }
1294  if (LocaleCompare((char *) keyword,"style") == 0)
1295  {
1297  MagickFalse,token);
1298  break;
1299  }
1300  break;
1301  }
1302  case 'W':
1303  case 'w':
1304  {
1305  if (LocaleCompare((char *) keyword,"weight") == 0)
1306  {
1307  ssize_t
1308  weight;
1309 
1311  if (weight == -1)
1312  weight=StringToUnsignedLong(token);
1313  type_info->weight=(size_t) weight;
1314  break;
1315  }
1316  break;
1317  }
1318  default:
1319  break;
1320  }
1321  }
1322  token=(char *) RelinquishMagickMemory(token);
1323  return(status != 0 ? MagickTrue : MagickFalse);
1324 }
1325 
1326 /*
1327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1328 % %
1329 % %
1330 % %
1331 + T y p e C o m p o n e n t G e n e s i s %
1332 % %
1333 % %
1334 % %
1335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1336 %
1337 % TypeComponentGenesis() instantiates the type component.
1338 %
1339 % The format of the TypeComponentGenesis method is:
1340 %
1341 % MagickBooleanType TypeComponentGenesis(void)
1342 %
1343 */
1345 {
1346  if (type_semaphore == (SemaphoreInfo *) NULL)
1348  return(MagickTrue);
1349 }
1350 
1351 /*
1352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1353 % %
1354 % %
1355 % %
1356 + T y p e C o m p o n e n t T e r m i n u s %
1357 % %
1358 % %
1359 % %
1360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1361 %
1362 % TypeComponentTerminus() destroy type component.
1363 %
1364 % The format of the TypeComponentTerminus method is:
1365 %
1366 % void TypeComponentTerminus(void)
1367 %
1368 */
1370 {
1371  if (type_semaphore == (SemaphoreInfo *) NULL)
1374  if (type_cache != (SplayTreeInfo *) NULL)
1375  type_cache=DestroySplayTree(type_cache);
1378 }
static SemaphoreInfo * type_semaphore
Definition: type.c:123
size_t face
Definition: type.h:52
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:2953
MagickExport const TypeInfo * GetTypeInfo(const char *name, ExceptionInfo *exception)
Definition: type.c:276
char * description
Definition: type.h:55
char * metrics
Definition: type.h:70
MagickExport size_t ConcatenateMagickString(char *destination, const char *source, const size_t length)
Definition: string.c:410
MagickExport SemaphoreInfo * AcquireSemaphoreInfo(void)
Definition: semaphore.c:192
static SplayTreeInfo * type_cache
Definition: type.c:126
MagickPrivate MagickBooleanType TypeComponentGenesis(void)
Definition: type.c:1344
MagickExport MagickBooleanType ListTypeInfo(FILE *file, ExceptionInfo *exception)
Definition: type.c:929
static MagickBooleanType IsTypeTreeInstantiated(ExceptionInfo *)
Definition: type.c:879
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
Definition: exception.c:108
MagickExport ssize_t FormatLocaleString(char *magick_restrict string, const size_t length, const char *magick_restrict format,...)
Definition: locale.c:473
char * path
Definition: type.h:55
size_t weight
Definition: type.h:67
Definition: log.h:52
MagickExport char * FileToString(const char *filename, const size_t extent, ExceptionInfo *exception)
Definition: string.c:985
char * foundry
Definition: type.h:70
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
MagickPrivate void TypeComponentTerminus(void)
Definition: type.c:1369
#define MagickCoreSignature
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:293
MagickExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
Definition: string.c:1283
MagickExport char ** GetTypeList(const char *pattern, size_t *number_fonts, ExceptionInfo *exception)
Definition: type.c:647
MagickExport LinkedListInfo * GetConfigureOptions(const char *filename, ExceptionInfo *exception)
Definition: configure.c:654
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:378
MagickBooleanType
Definition: magick-type.h:156
#define DirectorySeparator
Definition: studio.h:254
unsigned int MagickStatusType
Definition: magick-type.h:119
MagickExport char * AcquireString(const char *source)
Definition: string.c:124
char * family
Definition: type.h:55
MagickExport void * ResetMagickMemory(void *memory, int byte, const size_t size)
Definition: memory.c:1164
MagickExport const char * CommandOptionToMnemonic(const CommandOption option, const ssize_t type)
Definition: option.c:2666
MagickExport void * AcquireQuantumMemory(const size_t count, const size_t quantum)
Definition: memory.c:529
MagickExport int LocaleNCompare(const char *p, const char *q, const size_t length)
Definition: locale.c:1509
StretchType stretch
Definition: type.h:64
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:349
#define MagickPathExtent
static void * DestroyTypeNode(void *type_info)
Definition: type.c:163
char * glyphs
Definition: type.h:70
MagickExport MagickBooleanType IsStringTrue(const char *value)
Definition: string.c:1464
Definition: type.h:49
MagickExport MagickBooleanType static void * AcquireCriticalMemory(const size_t size)
MagickExport SplayTreeInfo * NewSplayTree(int(*compare)(const void *, const void *), void *(*relinquish_key)(void *), void *(*relinquish_value)(void *))
Definition: splay-tree.c:1141
static const char * TypeMap
Definition: type.c:112
static MagickBooleanType SetTypeNodePath(const char *filename, char *font_path, const char *token, char **target)
Definition: type.c:1024
char * format
Definition: type.h:70
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:1058
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1397
MagickExport MagickBooleanType IsPathAccessible(const char *path)
Definition: utility.c:1466
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:2535
MagickExport char * GetEnvironmentValue(const char *name)
Definition: string.c:1250
MagickBooleanType stealth
Definition: type.h:77
MagickExport size_t CopyMagickString(char *destination, const char *source, const size_t length)
Definition: string.c:742
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:1409
#define GetMagickModule()
Definition: log.h:28
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:1341
MagickExport void GetNextToken(const char *start, const char **end, const size_t extent, char *token)
Definition: token.c:171
static int TypeInfoCompare(const void *x, const void *y)
Definition: type.c:537
static MagickBooleanType LoadTypeCache(SplayTreeInfo *, const char *, const char *, const size_t, ExceptionInfo *)
Definition: type.c:1061
MagickExport char * DestroyString(char *string)
Definition: string.c:810
MagickExport void * AcquireMagickMemory(const size_t size)
Definition: memory.c:458
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:554
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:1038
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:632
char * encoding
Definition: type.h:70
size_t signature
Definition: type.h:80
#define MagickPrivate
#define MagickExport
StyleType style
Definition: type.h:61
MagickExport void RelinquishSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:351
MagickExport LinkedListInfo * DestroyConfigureOptions(LinkedListInfo *options)
Definition: configure.c:326
MagickExport char * ConstantString(const char *source)
Definition: string.c:687
char * name
Definition: type.h:55
MagickExport ExceptionInfo * DestroyExceptionInfo(ExceptionInfo *exception)
Definition: exception.c:417