Method: EastAsianWidthSimple#lookup_width

Defined in:
lib/east_asian_width_simple.rb

#lookup_width(codepoint) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/east_asian_width_simple.rb', line 30

def lookup_width(codepoint)
  property = lookup(codepoint)
  width = PROPERTY_TO_WIDTH_MAP[property]
  if width.nil?
    warn <<~WARNING_MESSAGE
      The code point 0x#{codepoint.to_s(16)} has the property "#{property}" \
      whose width is unknown.
    WARNING_MESSAGE
    return 1
  end
  width
end