fontconfig: Branch 'main' - 2 commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 src/fcfreetype.c |   35 +++++++++++++++++++++++++++--------
 src/ftglue.c     |    5 ++++-
 src/ftglue.h     |    3 ++-
 3 files changed, 33 insertions(+), 10 deletions(-)

New commits:
commit 5e058033fe6b4caddd4eddd3a9e0289ef69c5748
Merge: bd83c04 e8fc006
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Mon Sep 30 09:25:27 2024 +0000

    Merge branch 'issues/426' into 'main'
    
    Improve hinting detection for fonthashint object
    
    Closes #426
    
    See merge request fontconfig/fontconfig!331

commit e8fc0065905a34965ed8eb52dc70095ad7ccd965
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Mon Sep 30 17:11:25 2024 +0900

    Improve hinting detection for fonthashint object
    
    Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/426

diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index a3ddf99..50f382f 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -32,6 +32,7 @@
 #include FT_FREETYPE_H
 #include FT_ADVANCES_H
 #include FT_TRUETYPE_TABLES_H
+#include FT_TRUETYPE_TAGS_H
 #include FT_SFNT_NAMES_H
 #include FT_TRUETYPE_IDS_H
 #include FT_TYPE1_TABLES_H
@@ -2708,10 +2709,8 @@ FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks FC_UNUSED, int *spac
 }
 
 
-#define TTAG_GPOS  FT_MAKE_TAG( 'G', 'P', 'O', 'S' )
-#define TTAG_GSUB  FT_MAKE_TAG( 'G', 'S', 'U', 'B' )
+/* Graphite Rules Table */
 #define TTAG_SILF  FT_MAKE_TAG( 'S', 'i', 'l', 'f')
-#define TTAG_prep  FT_MAKE_TAG( 'p', 'r', 'e', 'p' )
 
 #define OTLAYOUT_HEAD	    "otlayout:"
 #define OTLAYOUT_HEAD_LEN   9
@@ -2762,7 +2761,7 @@ compareulong (const void *a, const void *b)
 }
 
 static FcBool
-FindTable (FT_Face face, FT_ULong tabletag)
+FindTable (FT_Face face, FT_ULong tabletag, FT_ULong *tablesize)
 {
     FT_Stream  stream = face->stream;
     FT_Error   error;
@@ -2770,7 +2769,7 @@ FindTable (FT_Face face, FT_ULong tabletag)
     if (!stream)
         return FcFalse;
 
-    if (( error = ftglue_face_goto_table( face, tabletag, stream ) ))
+    if (( error = ftglue_face_goto_table( face, tabletag, stream, tablesize ) ))
 	return FcFalse;
 
     return FcTrue;
@@ -2788,7 +2787,7 @@ GetScriptTags(FT_Face face, FT_ULong tabletag, FT_ULong **stags)
     if (!stream)
         return 0;
 
-    if (( error = ftglue_face_goto_table( face, tabletag, stream ) ))
+    if (( error = ftglue_face_goto_table( face, tabletag, stream, NULL ) ))
 	return 0;
 
     base_offset = ftglue_stream_pos ( stream );
@@ -2911,9 +2910,29 @@ bail:
 }
 
 static FcBool
-FcFontHasHint (FT_Face face)
+FcFontHasHint(FT_Face face)
 {
-    return FindTable (face, TTAG_prep);
+    FT_ULong size;
+
+    /* For a workaround of gttools fix-nonhinting.
+     * See https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/426
+     */
+    if (FcDebug() & FC_DBG_SCANV)
+    {
+	FT_ULong ret;
+
+	fprintf(stderr, "*** Has hint:\n");
+	fprintf(stderr, "    fpgm table: %s\n",
+		FindTable(face, TTAG_fpgm, NULL) ? "True" : "False");
+	fprintf(stderr, "    cvt table: %s\n",
+		FindTable(face, TTAG_cvt, NULL) ? "True" : "False");
+	fprintf(stderr, "    prep table: %s\n",
+		FindTable(face, TTAG_prep, &ret) ? "True" : "False");
+        fprintf(stderr, "    prep size: %lu\n", ret);
+    }
+    return FindTable(face, TTAG_fpgm, NULL) ||
+	FindTable(face, TTAG_cvt, NULL) ||
+	(FindTable (face, TTAG_prep, &size) && size > 7);
 }
 
 
diff --git a/src/ftglue.c b/src/ftglue.c
index 7490a8c..f6ad79c 100644
--- a/src/ftglue.c
+++ b/src/ftglue.c
@@ -166,7 +166,8 @@ ftglue_stream_frame_exit( FT_Stream  stream )
 FTGLUE_APIDEF( FT_Error )
 ftglue_face_goto_table( FT_Face    face,
                         FT_ULong   the_tag,
-                        FT_Stream  stream )
+                        FT_Stream  stream,
+                        FT_ULong  *table_size )
 {
   FT_Error  error;
 
@@ -238,6 +239,8 @@ ftglue_face_goto_table( FT_Face    face,
       {
         LOG(( "TrueType table (start: %ld) (size: %ld)\n", start, size ));
         error = ftglue_stream_seek( stream, start );
+	if (table_size)
+	  *table_size = size;
         goto FoundIt;
       }
     }
diff --git a/src/ftglue.h b/src/ftglue.h
index 650ee28..5399249 100644
--- a/src/ftglue.h
+++ b/src/ftglue.h
@@ -104,7 +104,8 @@ ftglue_stream_frame_exit( FT_Stream  stream );
 FTGLUE_API( FT_Error )
 ftglue_face_goto_table( FT_Face    face,
                         FT_ULong   tag,
-                        FT_Stream  stream );
+                        FT_Stream  stream,
+                        FT_ULong  *table_size );
 
 FT_END_HEADER
 



[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux