Class: Emfsvg::Font

Inherits:
Object
  • Object
show all
Defined in:
lib/emfsvg/device_context.rb

Overview

Font value object: minimal subset of LOGFONT for text rendering.

Constant Summary collapse

DEFAULT_HEIGHT =
0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(face_name: nil, height: DEFAULT_HEIGHT, weight: 0, italic: false, underline: false, strikeout: false, escapement: 0, charset: 0) ⇒ Font

Returns a new instance of Font.



211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/emfsvg/device_context.rb', line 211

def initialize(face_name: nil, height: DEFAULT_HEIGHT, weight: 0,
               italic: false, underline: false, strikeout: false,
               escapement: 0, charset: 0)
  @face_name = face_name
  @height = height
  @weight = weight
  @italic = italic
  @underline = underline
  @strikeout = strikeout
  @escapement = escapement
  @charset = charset
end

Instance Attribute Details

#charsetObject (readonly)

Returns the value of attribute charset.



224
225
226
# File 'lib/emfsvg/device_context.rb', line 224

def charset
  @charset
end

#escapementObject (readonly)

Returns the value of attribute escapement.



224
225
226
# File 'lib/emfsvg/device_context.rb', line 224

def escapement
  @escapement
end

#face_nameObject (readonly)

Returns the value of attribute face_name.



224
225
226
# File 'lib/emfsvg/device_context.rb', line 224

def face_name
  @face_name
end

#heightObject (readonly)

Returns the value of attribute height.



224
225
226
# File 'lib/emfsvg/device_context.rb', line 224

def height
  @height
end

#italicObject (readonly)

Returns the value of attribute italic.



224
225
226
# File 'lib/emfsvg/device_context.rb', line 224

def italic
  @italic
end

#strikeoutObject (readonly)

Returns the value of attribute strikeout.



224
225
226
# File 'lib/emfsvg/device_context.rb', line 224

def strikeout
  @strikeout
end

#underlineObject (readonly)

Returns the value of attribute underline.



224
225
226
# File 'lib/emfsvg/device_context.rb', line 224

def underline
  @underline
end

#weightObject (readonly)

Returns the value of attribute weight.



224
225
226
# File 'lib/emfsvg/device_context.rb', line 224

def weight
  @weight
end

Class Method Details

.defaultObject



226
227
228
# File 'lib/emfsvg/device_context.rb', line 226

def self.default
  new
end

Instance Method Details

#bold?Boolean

Returns:

  • (Boolean)


230
231
232
# File 'lib/emfsvg/device_context.rb', line 230

def bold?
  weight >= 700
end

#dupObject



234
235
236
237
238
# File 'lib/emfsvg/device_context.rb', line 234

def dup
  Font.new(face_name: face_name, height: height, weight: weight,
           italic: italic, underline: underline, strikeout: strikeout,
           escapement: escapement, charset: charset)
end