[Fontconfig] fontconfig: Branch 'main' - 3 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 21 09:15:39 UTC 2023


 src/fcfreetype.c |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

New commits:
commit a264a2c0ca0be120c0fd2325f0d67ca4d5e81bd0
Author: Akira TAGOH <akira at tagoh.org>
Date:   Mon Aug 14 19:16:04 2023 +0900

    Work around decoding strings in Macintosh encoding for the name table.

diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index 2d11c7a..da7da83 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -722,6 +722,10 @@ retry:
 	{
 	    fromcode = "SJIS";
 	}
+	else if (sname->language_id == TT_MAC_LANGID_JAPANESE)
+	{
+	    fromcode = "SJIS";
+	}
 	else if (sname->language_id >= 0x100)
 	{
 	    /*
commit 34883cb414fb5d9e50eafc1f76d9c560e2bccc67
Author: Akira TAGOH <akira at tagoh.org>
Date:   Mon Aug 14 19:07:23 2023 +0900

    Retry to decode strings in the name table as UTF-16BE in some cases.
    
    Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/376

diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index 9b34286..2d11c7a 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -699,6 +699,7 @@ FcSfntNameTranscode (FT_SfntName *sname)
     iconv_t cd;
 #endif
     FcChar8 *utf8;
+    FcBool redecoded = FcFalse;
 
     for (i = 0; i < NUM_FC_FT_ENCODING; i++)
 	if (fcFtEncoding[i].platform_id == sname->platform_id &&
@@ -709,6 +710,7 @@ FcSfntNameTranscode (FT_SfntName *sname)
 	return 0;
     fromcode = fcFtEncoding[i].fromcode;
 
+retry:
     /*
      * Many names encoded for TT_PLATFORM_MACINTOSH are broken
      * in various ways. Kludge around them.
@@ -858,6 +860,13 @@ FcSfntNameTranscode (FT_SfntName *sname)
 	    {
 		iconv_close (cd);
 		free (utf8);
+		if (!redecoded)
+		{
+		    /* Regard the encoding as UTF-16BE and try again. */
+		    redecoded = FcTrue;
+		    fromcode = "UTF-16BE";
+		    goto retry;
+		}
 		return 0;
 	    }
 	}
@@ -865,6 +874,14 @@ FcSfntNameTranscode (FT_SfntName *sname)
 	*outbuf = '\0';
 	goto done;
     }
+#else
+    if (!redecoded)
+    {
+	/* Regard the encoding as UTF-16BE and try again. */
+	redecoded = FcTrue;
+	fromcode = "UTF-16BE";
+	goto retry;
+    }
 #endif
     return 0;
 done:
commit 81a26a6b62eb695becf998769b0c608defb0a66e
Author: Akira TAGOH <akira at tagoh.org>
Date:   Mon Aug 14 12:20:51 2023 +0900

    Update the encoding table for Simplified Chinese

diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index 17523fd..9b34286 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -93,7 +93,7 @@ static const FcFtEncoding   fcFtEncoding[] = {
  {  TT_PLATFORM_MICROSOFT,	TT_MS_ID_SYMBOL_CS,	"UTF-16BE" },
  {  TT_PLATFORM_MICROSOFT,	TT_MS_ID_UNICODE_CS,	"UTF-16BE" },
  {  TT_PLATFORM_MICROSOFT,	TT_MS_ID_SJIS,		"SJIS-WIN" },
- {  TT_PLATFORM_MICROSOFT,	TT_MS_ID_GB2312,	"GB2312" },
+ {  TT_PLATFORM_MICROSOFT,	TT_MS_ID_PRC,		"GB18030" },
  {  TT_PLATFORM_MICROSOFT,	TT_MS_ID_BIG_5,		"BIG-5" },
  {  TT_PLATFORM_MICROSOFT,	TT_MS_ID_WANSUNG,	"Wansung" },
  {  TT_PLATFORM_MICROSOFT,	TT_MS_ID_JOHAB,		"Johab" },


More information about the Fontconfig mailing list