Module: Fontisan::Unicode::Plane

Defined in:
lib/fontisan/unicode/plane.rb

Overview

Unicode plane metadata. A plane is a contiguous range of 65,536 codepoints; cp >> 16 is the plane number.

Plane labels follow the Unicode standard names. Unassigned planes fall back to "Plane_N". This is a pure-data module — no I/O, no state, no dependency on tables or stitcher.

Constant Summary collapse

BMP =
0
SMP =
1
SIP =
2
TIP =
3
SSP =
14

Class Method Summary collapse

Class Method Details

.label(plane) ⇒ String

Returns human-readable plane label.

Parameters:

  • plane (Integer)

Returns:

  • (String)

    human-readable plane label



26
27
28
29
30
31
32
33
34
35
# File 'lib/fontisan/unicode/plane.rb', line 26

def self.label(plane)
  case plane
  when BMP then "BMP"
  when SMP then "SMP"
  when SIP then "SIP"
  when TIP then "TIP"
  when SSP then "SSP"
  else "Plane_#{plane}"
  end
end

.label_of(codepoint) ⇒ String

Returns label of the plane containing codepoint.

Parameters:

  • codepoint (Integer)

Returns:

  • (String)

    label of the plane containing codepoint



39
40
41
# File 'lib/fontisan/unicode/plane.rb', line 39

def self.label_of(codepoint)
  label(of(codepoint))
end

.of(codepoint) ⇒ Integer

Returns plane number (0..16).

Parameters:

  • codepoint (Integer)

Returns:

  • (Integer)

    plane number (0..16)



20
21
22
# File 'lib/fontisan/unicode/plane.rb', line 20

def self.of(codepoint)
  codepoint >> 16
end