File: default_ignorable_char_q.rb

package info (click to toggle)
ruby-unicode-utils 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,988 kB
  • sloc: ruby: 1,877; makefile: 4
file content (22 lines) | stat: -rw-r--r-- 685 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# -*- encoding: utf-8 -*-

require "unicode_utils/read_cdata"

module UnicodeUtils

  PROP_DEFAULT_IGNORABLE_SET =
    Impl.read_code_point_set("prop_set_default_ignorable") # :nodoc:

  # True if the given character has the Unicode property
  # Default_Ingorable_Code_Point (see section 5.3 in Unicode 6.0.0).
  #
  # When a system (e.g. font) can't display a default ignorable
  # code point, it is allowed to simply ignore, i.e. skip it (as
  # opposed to other characters, which must at least be displayed with
  # a replacement character).
  def default_ignorable_char?(char)
    PROP_DEFAULT_IGNORABLE_SET.include?(char.ord)
  end
  module_function :default_ignorable_char?

end