Commit Graph

11 Commits

Author SHA1 Message Date
Allan Odgaard
f05426378c Update testing system for text framework 2013-07-26 13:53:58 +02:00
Allan Odgaard
ea2cf8d875 Add CR to default trim character set 2013-06-22 21:02:45 +07:00
Allan Odgaard
fd60fd25c7 Change strtol → std::stol (C++11)
I initially wanted to do this change globally, but std::stoX will throw an exception if it fails to parse something and we use strtoX a few places where parsing nothing (and getting back zero) is fine.
2013-02-08 11:20:35 +01:00
Allan Odgaard
e75e7ec8e5 Change text::format → std::to_string (C++11) 2013-02-08 11:20:34 +01:00
Allan Odgaard
20378c426e A full match should rank highest 2013-01-18 13:34:57 +01:00
Allan Odgaard
ebab500ba3 Use std::map/set instead of C arrays
These types come with a find() method and avoids having to use helper functions to get the begin/end of the array (for linear search).
2012-09-20 12:22:20 +02:00
Allan Odgaard
39f0ea518b Use tuple instead of lexicographical_compare 2012-09-20 12:22:20 +02:00
Allan Odgaard
cbe91ff831 Assume compiler support for explicit keyword
Since we require a fairly recent clang for other features, there is no reason to test for this one.
2012-08-29 14:27:35 +02:00
Allan Odgaard
be63bda3e7 Support East Asian Width
There is a bunch of functions that deal with the logical column count and these now all count code points with the “east asian width” (unicode) property set as two columns.

This closes issue #206.
2012-08-18 21:29:05 +02:00
Allan Odgaard
45f847d01e Add text::is_east_asian_width
This checks if the character needs to be counted as double-width (for soft wrap and similar).

I used the following script to generate the tables, it should be improved to collapse the ranges:

    #!/usr/bin/ruby

    fixed, start, stop = [ ], [ ], [ ]
    open('|curl -Ls http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt') do |io|
      io.grep(/^([0-9A-F]+)(?:..([0-9A-F]+))?;[A-Za-z]*W/) do
        if $2
          start << "0x#$1"
          stop << "0x#$2"
        else
          fixed << "0x#$1"
        end
      end
    end
    puts "static uint32_t Fixed[]      = { #{fixed.join(', ')} };\n"
    puts "static uint32_t RangeBegin[] = { #{start.join(', ')} };\n"
    puts "static uint32_t RangeEnd[]   = { #{stop.join(', ')} };\n"
2012-08-18 21:29:05 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00