class PDF::Reader::FontDescriptor

def initialize(ohash, fd_hash)

def initialize(ohash, fd_hash)
  @ascent                = ohash.object(fd_hash[:Ascent])    || 0
  @descent               = ohash.object(fd_hash[:Descent])   || 0
  @missing_width         = ohash.object(fd_hash[:MissingWidth]) || 0
  @font_bounding_box     = ohash.object(fd_hash[:FontBBox])  || [0,0,0,0]
  @avg_width             = ohash.object(fd_hash[:AvgWidth])  || 0
  @cap_height            = ohash.object(fd_hash[:CapHeight]) || 0
  @font_flags            = ohash.object(fd_hash[:Flags])     || 0
  @italic_angle          = ohash.object(fd_hash[:ItalicAngle])
  @font_name             = ohash.object(fd_hash[:FontName]).to_s
  @leading               = ohash.object(fd_hash[:Leading])   || 0
  @max_width             = ohash.object(fd_hash[:MaxWidth])  || 0
  @stem_v                = ohash.object(fd_hash[:StemV])
  @x_height              = ohash.object(fd_hash[:XHeight])
  @font_stretch          = ohash.object(fd_hash[:FontStretch]) || :Normal
  @font_weight           = ohash.object(fd_hash[:FontWeight])  || 400
  @font_family           = ohash.object(fd_hash[:FontFamily])
  # A FontDescriptor may have an embedded font program in FontFile
  # (Type 1 Font Program), FontFile2 (TrueType font program), or
  # FontFile3 (Other font program as defined by Subtype entry)
  # Subtype entries:
  # 1) Type1C:        Type 1 Font Program in Compact Font Format
  # 2) CIDFontType0C: Type 0 Font Program in Compact Font Format
  # 3) OpenType:      OpenType Font Program
  # see Section 9.9, PDF 32000-1:2008, pp 288-292
  @font_program_stream = ohash.object(fd_hash[:FontFile2])
  #TODO handle FontFile and FontFile3
  @is_ttf = true if @font_program_stream
end