freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] GSoC-2020-priyesh 9d6cb48: [base] Fix the vertical alignment


From: Priyesh Kumar
Subject: [freetype2] GSoC-2020-priyesh 9d6cb48: [base] Fix the vertical alignment of printing of logs.
Date: Sun, 30 Aug 2020 04:19:47 -0400 (EDT)

branch: GSoC-2020-priyesh
commit 9d6cb4886b57132b48ec658e83191c11607f1c3a
Author: Priyeshkkumar <priyeshkkumar@gmail.com>
Commit: Priyeshkkumar <priyeshkkumar@gmail.com>

        [base] Fix the vertical alignment of printing of logs.
    
        * src/base/ftdebug.c (ft_log_handler): Updates to print logs after
        a fixed width for better vertical alignment.
    RLAP_COMPOUND.
    
        For glyphs with OVERLAP_SIMPLE or OVERLAP_COMPOUND, set
        FT_OUTLINE_OVERLAP to render them with direct oversampling, which
        mitigates artifacts (see 3bb512bc9f62).
---
 src/base/ftdebug.c | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c
index 296c5bb..0450876 100644
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -441,17 +441,34 @@ else
                               const char* string, void* data )
   {
     ( void ) data;
-     const char* features ;
+     char* features ;
      if( ft_timestamp_flag && ft_component_flag && ft_have_newline_char )
-      features = "[%h:%m  %t]    %c";
+        features = "[%h:%m  %t]";
      else if( ft_component_flag && ft_have_newline_char)
-      features = "[%t]    %c";
+      features = "[%t]";
      else if( ft_timestamp_flag && ft_have_newline_char )
-      features = "[%h:%m]    %c";
-     else
-      features = "%c";
+      features = "[%h:%m]";
+    else
+      features = "";
+
+    long int tag_length = strlen( *origin->tags );
+    long int features_length = strlen( features );
+
+    char features_[ features_length + 18 ];
+
+    strcpy( features_, features );
+
+    if( ft_have_newline_char && ( ft_component_flag || ft_timestamp_flag ) )
+    {
+          long int num_of_spaces = 15 - tag_length;
+          int i;
+          for( i = 0; i < num_of_spaces; i++ )
+            strcat( features_, " " );
+    }
+
+    strcat( features_, "%c" );
 
-          dlg_generic_outputf_stream( ft_fileptr, features, origin, string,
+          dlg_generic_outputf_stream( ft_fileptr, (const char*)features_, 
origin, string,
                                 dlg_default_output_styles, true );
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]