]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Sun, 25 Mar 2018 14:15:04 +0000 (10:15 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sun, 25 Mar 2018 14:15:04 +0000 (10:15 -0400)
MagickCore/annotate.c
coders/svg.c

index 1050a72b791ccf69fe4a4f70c0f707edea8eb209..d9b3a527c21b722d0afc6d615629865884db6c74 100644 (file)
@@ -1012,8 +1012,29 @@ static MagickBooleanType RenderType(Image *image,const DrawInfo *draw_info,
   if ((type_info == (const TypeInfo *) NULL) &&
       (draw_info->family != (const char *) NULL))
     {
-      type_info=GetTypeInfoByFamily(draw_info->family,draw_info->style,
-        draw_info->stretch,draw_info->weight,exception);
+      char
+        **family;
+
+      int
+        number_families;
+
+      register ssize_t
+        i;
+
+      /*
+        Parse font family list.
+      */
+      family=StringToArgv(draw_info->family,&number_families);
+      for (i=1; i < (ssize_t) number_families; i++)
+      {
+        type_info=GetTypeInfoByFamily(family[i],draw_info->style,
+          draw_info->stretch,draw_info->weight,exception);
+        if (type_info != (const TypeInfo *) NULL)
+          break;
+      }
+      for (i=0; i < (ssize_t) number_families; i++)
+        family[i]=DestroyString(family[i]);
+      family=(char **) RelinquishMagickMemory(family);
       if (type_info == (const TypeInfo *) NULL)
         (void) ThrowMagickException(exception,GetMagickModule(),TypeWarning,
           "UnableToReadFont","`%s'",draw_info->family);
index 4ae349775eca4637b804a2b84f5324453d57d76f..2f5011576b3e7c12e73f2c647bdddf98e7200915 100644 (file)
@@ -995,7 +995,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
         }
       if (LocaleCompare((const char *) name,"clipPath") == 0)
         {
-          (void) FormatLocaleFile(svg_info->file,"push clip-path '%s'\n",id);
+          (void) FormatLocaleFile(svg_info->file,"push clip-path \"%s\"\n",id);
           break;
         }
       break;
@@ -1061,7 +1061,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
       if (LocaleCompare((const char *) name,"linearGradient") == 0)
         {
           (void) FormatLocaleFile(svg_info->file,
-            "push gradient '%s' linear %g,%g %g,%g\n",id,
+            "push gradient \"%s\" linear %g,%g %g,%g\n",id,
             svg_info->segment.x1,svg_info->segment.y1,svg_info->segment.x2,
             svg_info->segment.y2);
           break;
@@ -1079,7 +1079,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
       if (LocaleCompare((const char *) name,"pattern") == 0)
         {
           (void) FormatLocaleFile(svg_info->file,
-            "push pattern '%s' %g,%g %g,%g\n",id,
+            "push pattern \"%s\" %g,%g %g,%g\n",id,
             svg_info->bounds.x,svg_info->bounds.y,svg_info->bounds.width,
             svg_info->bounds.height);
           break;
@@ -1102,7 +1102,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
       if (LocaleCompare((const char *) name,"radialGradient") == 0)
         {
           (void) FormatLocaleFile(svg_info->file,
-            "push gradient '%s' radial %g,%g %g,%g %g\n",
+            "push gradient \"%s\" radial %g,%g %g,%g %g\n",
             id,svg_info->element.cx,svg_info->element.cy,
             svg_info->element.major,svg_info->element.minor,
             svg_info->element.angle);
@@ -1121,9 +1121,9 @@ static void SVGStartElement(void *context,const xmlChar *name,
       if (LocaleCompare((const char *) name,"svg") == 0)
         {
           (void) FormatLocaleFile(svg_info->file,"push graphic-context\n");
-          (void) FormatLocaleFile(svg_info->file,"fill 'black'\n");
+          (void) FormatLocaleFile(svg_info->file,"fill \"black\"\n");
           (void) FormatLocaleFile(svg_info->file,"fill-opacity 1\n");
-          (void) FormatLocaleFile(svg_info->file,"stroke 'none'\n");
+          (void) FormatLocaleFile(svg_info->file,"stroke \"none\"\n");
           (void) FormatLocaleFile(svg_info->file,"stroke-width 1\n");
           (void) FormatLocaleFile(svg_info->file,"stroke-opacity 1\n");
           break;
@@ -1156,7 +1156,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
                 *text;
 
               text=EscapeString(svg_info->text,'\'');
-              (void) FormatLocaleFile(svg_info->file,"text %g,%g '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"text %g,%g \"%s\"\n",
                 svg_info->bounds.x-svg_info->center.x,svg_info->bounds.y-
                 svg_info->center.y,text);
               text=DestroyString(text);
@@ -1203,18 +1203,18 @@ static void SVGStartElement(void *context,const xmlChar *name,
         {
           if (LocaleCompare(keyword,"clip-path") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"clip-path '%s'\n",value);
+              (void) FormatLocaleFile(svg_info->file,"clip-path \"%s\"\n",value);
               break;
             }
           if (LocaleCompare(keyword,"clip-rule") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"clip-rule '%s'\n",value);
+              (void) FormatLocaleFile(svg_info->file,"clip-rule \"%s\"\n",value);
               break;
             }
           if (LocaleCompare(keyword,"clipPathUnits") == 0)
             {
               (void) CloneString(&units,value);
-              (void) FormatLocaleFile(svg_info->file,"clip-units '%s'\n",value);
+              (void) FormatLocaleFile(svg_info->file,"clip-units \"%s\"\n",value);
               break;
             }
           if (LocaleCompare(keyword,"color") == 0)
@@ -1264,43 +1264,43 @@ static void SVGStartElement(void *context,const xmlChar *name,
             {
               if (LocaleCompare(value,"currentColor") == 0)
                 {
-                  (void) FormatLocaleFile(svg_info->file,"fill '%s'\n",color);
+                  (void) FormatLocaleFile(svg_info->file,"fill \"%s\"\n",color);
                   break;
                 }
-              (void) FormatLocaleFile(svg_info->file,"fill '%s'\n",value);
+              (void) FormatLocaleFile(svg_info->file,"fill \"%s\"\n",value);
               break;
             }
           if (LocaleCompare(keyword,"fillcolor") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"fill '%s'\n",value);
+              (void) FormatLocaleFile(svg_info->file,"fill \"%s\"\n",value);
               break;
             }
           if (LocaleCompare(keyword,"fill-rule") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"fill-rule '%s'\n",value);
+              (void) FormatLocaleFile(svg_info->file,"fill-rule \"%s\"\n",value);
               break;
             }
           if (LocaleCompare(keyword,"fill-opacity") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"fill-opacity '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"fill-opacity \"%s\"\n",
                 value);
               break;
             }
           if (LocaleCompare(keyword,"font-family") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"font-family '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"font-family \"%s\"\n",
                 value);
               break;
             }
           if (LocaleCompare(keyword,"font-stretch") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"font-stretch '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"font-stretch \"%s\"\n",
                 value);
               break;
             }
           if (LocaleCompare(keyword,"font-style") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"font-style '%s'\n",value);
+              (void) FormatLocaleFile(svg_info->file,"font-style \"%s\"\n",value);
               break;
             }
           if (LocaleCompare(keyword,"font-size") == 0)
@@ -1328,7 +1328,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
             }
           if (LocaleCompare(keyword,"font-weight") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"font-weight '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"font-weight \"%s\"\n",
                 value);
               break;
             }
@@ -1489,7 +1489,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
           if (LocaleCompare(keyword,"gradientUnits") == 0)
             {
               (void) CloneString(&units,value);
-              (void) FormatLocaleFile(svg_info->file,"gradient-units '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"gradient-units \"%s\"\n",
                 value);
               break;
             }
@@ -1538,7 +1538,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
             }
           if (LocaleCompare(keyword,"opacity") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"opacity '%s'\n",value);
+              (void) FormatLocaleFile(svg_info->file,"opacity \"%s\"\n",value);
               break;
             }
           break;
@@ -1616,10 +1616,10 @@ static void SVGStartElement(void *context,const xmlChar *name,
             {
               if (LocaleCompare(value,"currentColor") == 0)
                 {
-                  (void) FormatLocaleFile(svg_info->file,"stroke '%s'\n",color);
+                  (void) FormatLocaleFile(svg_info->file,"stroke \"%s\"\n",color);
                   break;
                 }
-              (void) FormatLocaleFile(svg_info->file,"stroke '%s'\n",value);
+              (void) FormatLocaleFile(svg_info->file,"stroke \"%s\"\n",value);
               break;
             }
           if (LocaleCompare(keyword,"stroke-antialiasing") == 0)
@@ -1642,25 +1642,25 @@ static void SVGStartElement(void *context,const xmlChar *name,
             }
           if (LocaleCompare(keyword,"stroke-linecap") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"stroke-linecap '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"stroke-linecap \"%s\"\n",
                 value);
               break;
             }
           if (LocaleCompare(keyword,"stroke-linejoin") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"stroke-linejoin '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"stroke-linejoin \"%s\"\n",
                 value);
               break;
             }
           if (LocaleCompare(keyword,"stroke-miterlimit") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"stroke-miterlimit '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"stroke-miterlimit \"%s\"\n",
                 value);
               break;
             }
           if (LocaleCompare(keyword,"stroke-opacity") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"stroke-opacity '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"stroke-opacity \"%s\"\n",
                 value);
               break;
             }
@@ -1688,20 +1688,20 @@ static void SVGStartElement(void *context,const xmlChar *name,
                      if (LocaleCompare(keyword,"clip-path") == 0)
                        {
                          (void) FormatLocaleFile(svg_info->file,
-                           "clip-path '%s'\n",value);
+                           "clip-path \"%s\"\n",value);
                          break;
                        }
                     if (LocaleCompare(keyword,"clip-rule") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "clip-rule '%s'\n",value);
+                          "clip-rule \"%s\"\n",value);
                         break;
                       }
                      if (LocaleCompare(keyword,"clipPathUnits") == 0)
                        {
                          (void) CloneString(&units,value);
                          (void) FormatLocaleFile(svg_info->file,
-                          "clip-units '%s'\n",value);
+                          "clip-units \"%s\"\n",value);
                          break;
                        }
                     if (LocaleCompare(keyword,"color") == 0)
@@ -1719,51 +1719,51 @@ static void SVGStartElement(void *context,const xmlChar *name,
                          if (LocaleCompare(value,"currentColor") == 0)
                            {
                              (void) FormatLocaleFile(svg_info->file,
-                               "fill '%s'\n",color);
+                               "fill \"%s\"\n",color);
                              break;
                            }
                         if (LocaleCompare(value,"#000000ff") == 0)
                           (void) FormatLocaleFile(svg_info->file,
                             "fill '#000000'\n");
                         else
-                          (void) FormatLocaleFile(svg_info->file,"fill '%s'\n",
+                          (void) FormatLocaleFile(svg_info->file,"fill \"%s\"\n",
                             value);
                         break;
                       }
                     if (LocaleCompare(keyword,"fillcolor") == 0)
                       {
-                        (void) FormatLocaleFile(svg_info->file,"fill '%s'\n",
+                        (void) FormatLocaleFile(svg_info->file,"fill \"%s\"\n",
                           value);
                         break;
                       }
                     if (LocaleCompare(keyword,"fill-rule") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "fill-rule '%s'\n",value);
+                          "fill-rule \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"fill-opacity") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "fill-opacity '%s'\n",value);
+                          "fill-opacity \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"font-family") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "font-family '%s'\n",value);
+                          "font-family \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"font-stretch") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "font-stretch '%s'\n",value);
+                          "font-stretch \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"font-style") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "font-style '%s'\n",value);
+                          "font-style \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"font-size") == 0)
@@ -1777,7 +1777,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
                     if (LocaleCompare(keyword,"font-weight") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "font-weight '%s'\n",value);
+                          "font-weight \"%s\"\n",value);
                         break;
                       }
                     break;
@@ -1794,7 +1794,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
                     if (LocaleCompare(keyword,"opacity") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "opacity '%s'\n",value);
+                          "opacity \"%s\"\n",value);
                         break;
                       }
                     break;
@@ -1812,7 +1812,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
                          if (LocaleCompare(value,"currentColor") == 0)
                            {
                              (void) FormatLocaleFile(svg_info->file,
-                               "stroke '%s'\n",color);
+                               "stroke \"%s\"\n",color);
                              break;
                            }
                         if (LocaleCompare(value,"#000000ff") == 0)
@@ -1820,7 +1820,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
                             "fill '#000000'\n");
                         else
                           (void) FormatLocaleFile(svg_info->file,
-                            "stroke '%s'\n",value);
+                            "stroke \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"stroke-antialiasing") == 0)
@@ -1846,25 +1846,25 @@ static void SVGStartElement(void *context,const xmlChar *name,
                     if (LocaleCompare(keyword,"stroke-linecap") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "stroke-linecap '%s'\n",value);
+                          "stroke-linecap \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"stroke-linejoin") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "stroke-linejoin '%s'\n",value);
+                          "stroke-linejoin \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"stroke-miterlimit") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "stroke-miterlimit '%s'\n",value);
+                          "stroke-miterlimit \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"stroke-opacity") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "stroke-opacity '%s'\n",value);
+                          "stroke-opacity \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"stroke-width") == 0)
@@ -1882,13 +1882,13 @@ static void SVGStartElement(void *context,const xmlChar *name,
                     if (LocaleCompare(keyword,"text-align") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "text-align '%s'\n",value);
+                          "text-align \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"text-anchor") == 0)
                       {
                         (void) FormatLocaleFile(svg_info->file,
-                          "text-anchor '%s'\n",value);
+                          "text-anchor \"%s\"\n",value);
                         break;
                       }
                     if (LocaleCompare(keyword,"text-decoration") == 0)
@@ -1929,13 +1929,13 @@ static void SVGStartElement(void *context,const xmlChar *name,
         {
           if (LocaleCompare(keyword,"text-align") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"text-align '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"text-align \"%s\"\n",
                 value);
               break;
             }
           if (LocaleCompare(keyword,"text-anchor") == 0)
             {
-              (void) FormatLocaleFile(svg_info->file,"text-anchor '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"text-anchor \"%s\"\n",
                 value);
               break;
             }
@@ -2370,7 +2370,7 @@ static void SVGEndElement(void *context,const xmlChar *name)
       if (LocaleCompare((const char *) name,"image") == 0)
         {
           (void) FormatLocaleFile(svg_info->file,
-            "image Over %g,%g %g,%g '%s'\n",svg_info->bounds.x,
+            "image Over %g,%g %g,%g \"%s\"\n",svg_info->bounds.x,
             svg_info->bounds.y,svg_info->bounds.width,svg_info->bounds.height,
             svg_info->url);
           (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
@@ -2406,7 +2406,7 @@ static void SVGEndElement(void *context,const xmlChar *name)
         }
       if (LocaleCompare((const char *) name,"path") == 0)
         {
-          (void) FormatLocaleFile(svg_info->file,"path '%s'\n",
+          (void) FormatLocaleFile(svg_info->file,"path \"%s\"\n",
             svg_info->vertices);
           (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
           break;
@@ -2467,7 +2467,7 @@ static void SVGEndElement(void *context,const xmlChar *name)
     {
       if (LocaleCompare((const char *) name,"stop") == 0)
         {
-          (void) FormatLocaleFile(svg_info->file,"stop-color '%s' %s\n",
+          (void) FormatLocaleFile(svg_info->file,"stop-color \"%s\" %s\n",
             svg_info->stop_color,svg_info->offset);
           break;
         }
@@ -2489,7 +2489,7 @@ static void SVGEndElement(void *context,const xmlChar *name)
                 *text;
 
               text=EscapeString(svg_info->text,'\'');
-              (void) FormatLocaleFile(svg_info->file,"text %g,%g '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"text %g,%g \"%s\"\n",
                 svg_info->bounds.x,svg_info->bounds.y,text);
               text=DestroyString(text);
               *svg_info->text='\0';
@@ -2511,7 +2511,7 @@ static void SVGEndElement(void *context,const xmlChar *name)
                 *text;
 
               text=EscapeString(svg_info->text,'\'');
-              (void) FormatLocaleFile(svg_info->file,"text %g,%g '%s'\n",
+              (void) FormatLocaleFile(svg_info->file,"text %g,%g \"%s\"\n",
                 svg_info->bounds.x,svg_info->bounds.y,text);
               text=DestroyString(text);
               draw_info=CloneDrawInfo(svg_info->image_info,(DrawInfo *) NULL);