[Midnightbsd-cvs] mports [23967] trunk/x11-fonts/fontconfig/files/patch-src_fclang.c: add file

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Aug 27 22:54:25 EDT 2018


Revision: 23967
          http://svnweb.midnightbsd.org/mports/?rev=23967
Author:   laffer1
Date:     2018-08-27 22:54:25 -0400 (Mon, 27 Aug 2018)
Log Message:
-----------
add file

Added Paths:
-----------
    trunk/x11-fonts/fontconfig/files/patch-src_fclang.c

Added: trunk/x11-fonts/fontconfig/files/patch-src_fclang.c
===================================================================
--- trunk/x11-fonts/fontconfig/files/patch-src_fclang.c	                        (rev 0)
+++ trunk/x11-fonts/fontconfig/files/patch-src_fclang.c	2018-08-28 02:54:25 UTC (rev 23967)
@@ -0,0 +1,51 @@
+--- src/fclang.c.orig	2017-09-21 04:44:27 UTC
++++ src/fclang.c
+@@ -183,6 +183,7 @@ FcLangNormalize (const FcChar8 *lang)
+ {
+     FcChar8 *result = NULL, *s, *orig;
+     char *territory, *encoding, *modifier;
++    char *script;
+     size_t llen, tlen = 0, mlen = 0;
+ 
+     if (!lang || !*lang)
+@@ -246,27 +247,33 @@ FcLangNormalize (const FcChar8 *lang)
+ 	    modifier = encoding;
+ 	}
+     }
+-    territory = strchr ((const char *) s, '_');
+-    if (!territory)
+-	territory = strchr ((const char *) s, '-');
++    territory = strrchr ((const char *) s, '_');
+     if (territory)
+     {
+ 	*territory = 0;
+ 	territory++;
+ 	tlen = strlen (territory);
+     }
++    /* There might by a script component, e.g. sr_Cyrl_RS at UTF-8.  We can't assume all legal locale
++       names are in the form <lang>_<country code>.<encoding>.  If the script component is here,
++       skip it to define the language properly (e.g. "sr" instead of "sr_Cyrl") */
++    script = strchr ((const char *) s, '_');
++    if (script)
++    {
++        *script = 0;
++    }
+     llen = strlen ((const char *) s);
+     if (llen < 2 || llen > 3)
+     {
+-	fprintf (stderr, "Fontconfig warning: ignoring %s: not a valid language tag\n",
+-		 lang);
++	fprintf (stderr, "Fontconfig warning: ignoring %s: not a valid language tag (%s)\n",
++		 s, lang);
+ 	goto bail0;
+     }
+     if (territory && (tlen < 2 || tlen > 3) &&
+ 	!(territory[0] == 'z' && tlen < 5))
+     {
+-	fprintf (stderr, "Fontconfig warning: ignoring %s: not a valid region tag\n",
+-		 lang);
++	fprintf (stderr, "Fontconfig warning: ignoring %s: not a valid region tag (%s)\n",
++		 territory, lang);
+ 	goto bail0;
+     }
+     if (territory)


Property changes on: trunk/x11-fonts/fontconfig/files/patch-src_fclang.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list