Class: Ucode::Models::Audit::CodepointRange

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/ucode/models/audit/codepoint_range.rb

Overview

A contiguous run of covered codepoints.

first_cp/last_cp are inclusive integer endpoints. A single-codepoint "range" has first_cp == last_cp and renders as U+XXXX (no dash).

Produced by the cmap coverage coalescer from the font's cmap. The range view replaces a flat per-codepoint list — a 60k-codepoint CJK font produces tens of ranges rather than 60k strings.

Instance Method Summary collapse

Instance Method Details

#to_sString

Human-readable form: U+XXXX for single codepoints, U+XXXX-U+XXXX for true ranges.

Returns:

  • (String)


29
30
31
32
33
34
35
# File 'lib/ucode/models/audit/codepoint_range.rb', line 29

def to_s
  if first_cp == last_cp
    format("U+%04<cp>X", cp: first_cp)
  else
    format("U+%04<first>X-U+%04<last>X", first: first_cp, last: last_cp)
  end
end