Class: Fontisan::Models::Ucd::UcdChar
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Fontisan::Models::Ucd::UcdChar
- Defined in:
- lib/fontisan/models/ucd/ucd_char.rb
Overview
Single
UCDXML uses two forms:
<char cp="0041" name="..." script="Latin" block="Basic Latin" .../>
<char first-cp="3400" last-cp="4DBF" name="..." script="Han" .../>
The first form describes one codepoint. The second form describes a
closed range of codepoints that share the same properties (used for
CJK ideograph ranges where each codepoint would otherwise need its
own
Both forms can appear in the same document; cp is mutually
exclusive with first-cp/last-cp.
Instance Method Summary collapse
-
#codepoints ⇒ Object
The codepoints covered by this entry, as Integers.
-
#range? ⇒ Boolean
True if this entry describes a codepoint range rather than a single codepoint.
Instance Method Details
#codepoints ⇒ Object
The codepoints covered by this entry, as Integers. For a single-codepoint entry, returns a one-element array. For a range entry, returns the inclusive range as an array (caller should treat this lazily if the range is huge — CJK ranges can have tens of thousands of codepoints).
55 56 57 58 59 60 61 62 63 |
# File 'lib/fontisan/models/ucd/ucd_char.rb', line 55 def codepoints if range? (first_cp.to_i(16)..last_cp.to_i(16)).to_a elsif cp [cp.to_i(16)] else [] end end |
#range? ⇒ Boolean
True if this entry describes a codepoint range rather than a single codepoint.
46 47 48 |
# File 'lib/fontisan/models/ucd/ucd_char.rb', line 46 def range? !first_cp.nil? && !last_cp.nil? end |