Class: Chem::CDX::CDXFontTable

Inherits:
Object
  • Object
show all
Defined in:
lib/chem/db/cdx.rb

Constant Summary collapse

CS =
{
  0=>'Unknown',
  37=>'EBCDICOEM',
  437=>'MSDOSUS',
  500=>'EBCDIC500V1',
  708=>'ASMO-708',
  709=>'ArabicASMO449P',
  710=>'ArabicTransparent',
  720=>'DOS-720',
  737=>'Greek437G',
  775=>'cp775',
  850=>'windows-850',
  852=>'ibm852',
  855=>'cp855',
  857=>'cp857',
  860=>'cp860',
  861=>'cp861',
  862=>'DOS-862',
  863=>'cp863',
  864=>'cp864',
  865=>'cp865',
  866=>'cp866',
  869=>'cp869',
  874=>'windows-874',
  875=>'EBCDIC',
  932=>'shift_jis',
  936=>'gb2312',
  949=>'ks_c_5601-1987',
  950=>'big5',
  1200=>'iso-10646',
  1250=>'windows-1250',
  1251=>'windows-1251',
  1252=>'iso-8859-1',
  1253=>'iso-8859-7',
  1254=>'iso-8859-9',
  1255=>'windows-1255',
  1256=>'windows-1256',
  1257=>'windows-1257',
  1258=>'windows-1258',
  1361=>'windows-1361',
  10000=>'x-mac-roman',
  10001=>'x-mac-japanese',
  10002=>'x-mac-tradchinese',
  10003=>'x-mac-korean',
  10004=>'x-mac-arabic',
  10005=>'x-mac-hebrew',
  10006=>'x-mac-greek',
  10007=>'x-mac-cyrillic',
  10008=>'x-mac-reserved',
  10009=>'x-mac-devanagari',
  10010=>'x-mac-gurmukhi',
  10011=>'x-mac-gujarati',
  10012=>'x-mac-oriya',
  10013=>'x-mac-nengali',
  10014=>'x-mac-tamil',
  10015=>'x-mac-telugu',
  10016=>'x-mac-kannada',
  10017=>'x-mac-Malayalam',
  10018=>'x-mac-sinhalese',
  10019=>'x-mac-burmese',
  10020=>'x-mac-khmer',
  10021=>'x-mac-thai',
  10022=>'x-mac-lao',
  10023=>'x-mac-georgian',
  10024=>'x-mac-armenian',
  10025=>'x-mac-simpChinese',
  10026=>'x-mac-tibetan',
  10027=>'x-mac-mongolian',
  10028=>'x-mac-ethiopic',
  10029=>'x-mac-ce',
  10030=>'x-mac-vietnamese',
  10031=>'x-mac-extArabic',
  10032=>'x-mac-uninterpreted',
  10079=>'x-mac-icelandic',
  10081=>'x-mac-turkis'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCDXFontTable

Returns a new instance of CDXFontTable.



684
685
686
# File 'lib/chem/db/cdx.rb', line 684

def initialize
  @fonts = []
end

Instance Attribute Details

#platformObject

Returns the value of attribute platform.



682
683
684
# File 'lib/chem/db/cdx.rb', line 682

def platform
  @platform
end

Instance Method Details

#charset(cs) ⇒ Object



785
786
787
# File 'lib/chem/db/cdx.rb', line 785

def charset cs
  CS[cs]
end

#push_font(font) ⇒ Object



688
689
690
# File 'lib/chem/db/cdx.rb', line 688

def push_font font
  @fonts.push(font)
end

#to_binObject



700
701
702
703
704
705
706
707
# File 'lib/chem/db/cdx.rb', line 700

def to_bin
  str = [@platform].pack('v')
  str += [@fonts.length].pack('v')
  @fonts.each do |font|
    str += [font.font_id, font.charset, font.name.length, font.name].pack('vvva*')
  end
  str
end

#to_xmlObject



692
693
694
695
696
697
698
# File 'lib/chem/db/cdx.rb', line 692

def to_xml
  str = "<fonttable>\n"
  @fonts.each do |font|
    str += "<font id=\"#{font.font_id}\" charset=\"#{charset(font.charset)}\" name=\"#{font.name}\"/>\n"
  end
  str + "</fonttable>\n"
end