Sha256: 9ef31cc3f0d266d00d9532792711b6a7a8e05d01d48909082cf9805d6fece1c6
Contents?: true
Size: 1.14 KB
Versions: 9
Compression:
Stored size: 1.14 KB
Contents
== Description An early draft of a way to determine the size of the characters using <tt>EastAsianWidth.txt</tt>, based on the very early draft of a {Ruby interface to UnicodeData.txt}[https://github.com/runpaint/unicode-data] by runpaint. == Install Install the gem with gem install unicode-display_width == Usage require 'unicode/display_width' The easy way is to use the String#display_size method: "⚀".display_width #=> 1 '一'.display_width #=> 2 To obtain more detailed data, you can use the following syntax: Unicode::DiplayWidth.codepoint( c ) == Bugs / TODO Since it is not tested extensively, it does probably not work correctly for all characters... For example, there is a class of unicode characters, which is not exactly defined to be narrow or full-width ("ambiguous"). This gem currently gives them a size of 1, which is not always correct. Furthermore, the index data structure can be improved. == Copyright Copyright (c) 2011 Jan Lelis, http://rbjl.net, released under the MIT license. Contains code by runpaint: Copyright (c) 2009 Run Paint Run Run Contains EastAsianWidth.txt: Copyright (c) 1991-2010 Unicode, Inc. J-_-L
Version data entries
9 entries across 8 versions & 2 rubygems