def char_length() to_a.length end
def char_at(n) to_a()[n] end
def char() Character.get(to_a[0]) end
- def method_missing(mid, *args) char.method_missing(mid, *args) end
+# def method_missing(mid, *args) char.method_missing(mid, *args) end
def char_id() char.char_id() end
def get_char_attribute(a) char.get_char_attribute(a) end
def ucs() char.ucs() end
end
attr_reader :char_id
def mcs_utf8() Character.u4itou8(@char_id) end
+ def mcs_hex() sprintf("%x", @char_id) end
#----------------------------------------------------------------------
def self.get(char_id) CharacterFactory.instance.get(char_id) end #flyweightパターン
#----------------------------------------------------------------------
def ucs() #p 'ucs'
#ar = %w{ucs ucs-big5 ucs-cdp ucs-cns ucs-jis ucs-ks =>ucs =>ucs* =>ucs-jis}
- ar = %w{ucs ucs-jis ucs-big5 ucs-cdp ucs-cns ucs-ks =>ucs =>ucs* =>ucs-jis}
+ #ar = %w{ucs ucs-jis ucs-big5 ucs-cdp ucs-cns ucs-ks =>ucs =>ucs* =>ucs-jis}
+ ar = %w{ucs ucs-jis =>ucs-jis}
#並び順は恣意的で、ucs-jisを先に出している。本来はこれも指定できるようにするべき。
ar.each {|a| #p [a]
u = get_char_attribute(a)
assert_equal("⿰木神", char.ids)
assert_equal("⿰木神", char.decompose)
str = "榊"
- assert_equal("⿰木神", str.ids)
+ assert_equal("⿰木神", str.char.ids)
assert_equal("⿰木神", str.decompose)
assert_equal("⿰木⿰⺭申", str.decompose.decompose)
assert_equal("⿰木神", str.decompose!)
assert_match(/IDEOGRAPHIC DESCRIPTION CHARACTER/, Character.new(i).name)
}
- assert_match(/LEFT TO RIGHT/, "&U+2FF0;".de_er.name) #∫
- assert_match(/ABOVE TO BELOW/, "&U+2FF1;".de_er.name) #∨
- assert_match(/LEFT TO MIDDLE AND RIGHT/, "&U+2FF2;".de_er.name) #∬
- assert_match(/ABOVE TO MIDDLE AND BELOW/, "&U+2FF3;".de_er.name) #∀
- assert_match(/FULL SURROUND/, "&U+2FF4;".de_er.name) #∃
- assert_match(/SURROUND FROM ABOVE/, "&U+2FF5;".de_er.name) #∩
- assert_match(/SURROUND FROM BELOW/, "&U+2FF6;".de_er.name) #∪
- assert_match(/SURROUND FROM LEFT/, "&U+2FF7;".de_er.name) #⊂
- assert_match(/SURROUND FROM UPPER LEFT/, "&U+2FF8;".de_er.name) #√
- assert_match(/SURROUND FROM UPPER RIGHT/, "&U+2FF9;".de_er.name) #∂
- assert_match(/SURROUND FROM LOWER LEFT/, "&U+2FFA;".de_er.name) #∠
- assert_match(/OVERLAID/, "&U+2FFB;".de_er.name) #∵
+ assert_match(/LEFT TO RIGHT/, "&U+2FF0;".de_er.char.name) #∫
+ assert_match(/ABOVE TO BELOW/, "&U+2FF1;".de_er.char.name) #∨
+ assert_match(/LEFT TO MIDDLE AND RIGHT/, "&U+2FF2;".de_er.char.name) #∬
+ assert_match(/ABOVE TO MIDDLE AND BELOW/, "&U+2FF3;".de_er.char.name) #∀
+ assert_match(/FULL SURROUND/, "&U+2FF4;".de_er.char.name) #∃
+ assert_match(/SURROUND FROM ABOVE/, "&U+2FF5;".de_er.char.name) #∩
+ assert_match(/SURROUND FROM BELOW/, "&U+2FF6;".de_er.char.name) #∪
+ assert_match(/SURROUND FROM LEFT/, "&U+2FF7;".de_er.char.name) #⊂
+ assert_match(/SURROUND FROM UPPER LEFT/, "&U+2FF8;".de_er.char.name) #√
+ assert_match(/SURROUND FROM UPPER RIGHT/, "&U+2FF9;".de_er.char.name) #∂
+ assert_match(/SURROUND FROM LOWER LEFT/, "&U+2FFA;".de_er.char.name) #∠
+ assert_match(/OVERLAID/, "&U+2FFB;".de_er.char.name) #∵
end
def test_tree
assert_equal("[]", Tree.new().inspect)
assert_equal("林".ucs, "⿰木木".compose.ucs)
end
def test_find
- p "日雲".find #"曇"
+# p "日雲".find #"曇"
assert(4 <= "日雲".find .char_length) #"曇"
end
def test_compose_part