Method: ChemScanner::ChemDraw::BaseValue#cdx_styles

Defined in:
lib/chem_scanner/chem_draw/node/base_value.rb

#cdx_styles(data, runs) ⇒ Object

Output example: [{ start: 1, face: 96 }]



222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/chem_scanner/chem_draw/node/base_value.rb', line 222

def cdx_styles(data, runs)
  style_list = (0..runs - 1).each_with_object([]) do |sb, list|
    sr = data[sb * 10, 10]
    attr_list = (["start"] + TEXT_ATTRIBUTES)
    style = attr_list.each_with_object({}).with_index do |(attr, acc), id|
      acc[attr.to_sym] = read_int(sr[id * 2, 2], true)
    end

    list.push(style)
  end

  style_list.sort_by { |x| x[:start] }
end