freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 453722d 1/2: * src/tools/afblue.pl (convert_ascii_cha


From: Werner LEMBERG
Subject: [freetype2] master 453722d 1/2: * src/tools/afblue.pl (convert_ascii_chars): Don't ignore spaces.
Date: Sat, 05 Dec 2015 20:30:13 +0000

branch: master
commit 453722db8e0e7319c35a40eb592d7ead7d6d0211
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    * src/tools/afblue.pl (convert_ascii_chars): Don't ignore spaces.
    
    Instead, reduce multiple spaces to a single one.  We need this later
    for supporting character clusters in `afblue.dat'.
---
 ChangeLog           |    7 +++++++
 src/tools/afblue.pl |   15 +++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7446c25..b1801a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2015-12-05  Werner Lemberg  <address@hidden>
 
+       * src/tools/afblue.pl (convert_ascii_chars): Don't ignore spaces.
+
+       Instead, reduce multiple spaces to a single one.  We need this later
+       for supporting character clusters in `afblue.dat'.
+
+2015-12-05  Werner Lemberg  <address@hidden>
+
        * src/autofit/afblue.hin (GET_UTF8_CHAR): Use `do...while(0)'.
 
        * src/autofit/afblue.h: Regenerated.
diff --git a/src/tools/afblue.pl b/src/tools/afblue.pl
index 56b6452..a9c11b2 100644
--- a/src/tools/afblue.pl
+++ b/src/tools/afblue.pl
@@ -38,7 +38,8 @@ my $curr_max;          # Name of the current maximum value.
 
 my $curr_enum_element; # Name of the current enumeration element.
 my $curr_offset;       # The offset relative to current aux. variable.
-my $curr_elem_size;    # The size of the current string or block.
+my $curr_elem_size;    # The number of non-space characters in the current 
string or
+                       # the number of elements in the current block.
 
 my $have_sections = 0; # Boolean; set if start of a section has been seen.
 my $have_strings;      # Boolean; set if current section contains strings.
@@ -159,12 +160,14 @@ sub convert_ascii_chars
   # A series of ASCII characters in the printable range.
   my $s = shift;
 
-  # We ignore spaces.
-  $s =~ s/ //g;
+  # We reduce multiple space characters to a single one.
+  $s =~ s/ +/ /g;
 
-  my $count = $s =~ s/\G(.)/'$1', /g;
-  $curr_offset += $count;
-  $curr_elem_size += $count;
+  # Count all non-space characters.  Note that `()' applies a list context
+  # to the capture that is used to count the elements.
+  $curr_elem_size += () = $s =~ /[^ ]/g;
+
+  $curr_offset += $s =~ s/\G(.)/'$1', /g;
 
   return $s;
 }



reply via email to

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