svn commit: r400653 - in head/x11-fonts/fontconfig: . files

Koop Mast kwm at FreeBSD.org
Mon Nov 2 13:41:05 UTC 2015


Author: kwm
Date: Mon Nov  2 13:41:03 2015
New Revision: 400653
URL: https://svnweb.freebsd.org/changeset/ports/400653

Log:
  Teach fontconfig that LANG and LC_* settings with more than 2 components
  are fine and actualy supported by POSIX even if Linux doesn't.
  
  This should fix font issues with the projects/collation branch.
  
  Submitted by:	bapt@, marino@
  Obtained from:	DragonFly BSD

Added:
  head/x11-fonts/fontconfig/files/patch-src_fclang.c   (contents, props changed)
Modified:
  head/x11-fonts/fontconfig/Makefile

Modified: head/x11-fonts/fontconfig/Makefile
==============================================================================
--- head/x11-fonts/fontconfig/Makefile	Mon Nov  2 13:12:13 2015	(r400652)
+++ head/x11-fonts/fontconfig/Makefile	Mon Nov  2 13:41:03 2015	(r400653)
@@ -1,10 +1,9 @@
 # Created by: Joe Marcus Clarke <marcus at FreeBSD.org>
 # $FreeBSD$
-#   $MCom: ports/trunk/x11-fonts/fontconfig/Makefile 18637 2013-07-27 09:15:21Z kwm $
 
 PORTNAME=	fontconfig
 PORTVERSION=	2.11.1
-PORTREVISION?=	0
+PORTREVISION?=	1
 PORTEPOCH?=	1
 CATEGORIES=	x11-fonts
 MASTER_SITES=	http://www.freedesktop.org/software/fontconfig/release/

Added: head/x11-fonts/fontconfig/files/patch-src_fclang.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11-fonts/fontconfig/files/patch-src_fclang.c	Mon Nov  2 13:41:03 2015	(r400653)
@@ -0,0 +1,50 @@
+--- src/fclang.c.orig	2014-01-20 08:14:20 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)
+@@ -241,26 +242,32 @@ 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))
+     {
+-	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)


More information about the svn-ports-all mailing list