Class: EideticRML::Styles::FontStyle

Inherits:
Style
  • Object
show all
Includes:
HasColor
Defined in:
lib/erml_styles.rb

Instance Method Summary collapse

Methods included from HasColor

#color

Methods inherited from Style

for_name, #from_points, #id, #initialize, #initialize_copy, register

Methods included from EideticRML::Support

#from_units, parse_measurement, parse_measurement_pts, #to_units

Constructor Details

This class inherits a constructor from EideticRML::Styles::Style

Instance Method Details

#apply(writer) ⇒ Object



128
129
130
131
# File 'lib/erml_styles.rb', line 128

def apply(writer)
  writer.line_height(line_height)
  writer.font(name, size, :style => style, :weight => weight, :color => color, :encoding => encoding, :sub_type => sub_type)
end

#encoding(value = nil) ⇒ Object



153
154
155
156
# File 'lib/erml_styles.rb', line 153

def encoding(value=nil)
  return @encoding || 'WinAnsiEncoding' if value.nil?
  @encoding = value
end

#line_height(value = nil) ⇒ Object



173
174
175
176
# File 'lib/erml_styles.rb', line 173

def line_height(value=nil)
  return @line_height || 1.7 if value.nil?
  @line_height = value.to_f
end

#name(value = nil) ⇒ Object



133
134
135
136
# File 'lib/erml_styles.rb', line 133

def name(value=nil)
  return @name || EideticPDF::PageWriter::DEFAULT_FONT[:name] if value.nil?
  @name = value
end

#size(value = nil) ⇒ Object



138
139
140
141
# File 'lib/erml_styles.rb', line 138

def size(value=nil)
  return @size || EideticPDF::PageWriter::DEFAULT_FONT[:size] if value.nil?
  @size = value.to_f
end

#strikeout(value = nil) ⇒ Object



143
144
145
146
# File 'lib/erml_styles.rb', line 143

def strikeout(value=nil)
  return @strikeout if value.nil?
  @strikeout = (value == true) || (value == 'true')
end

#style(value = nil) ⇒ Object



148
149
150
151
# File 'lib/erml_styles.rb', line 148

def style(value=nil)
  return @style || '' if value.nil?
  @style = value
end

#sub_type(value = nil) ⇒ Object



158
159
160
161
# File 'lib/erml_styles.rb', line 158

def sub_type(value=nil)
  return @sub_type || 'Type1' if value.nil?
  @sub_type = value
end

#underline(value = nil) ⇒ Object



163
164
165
166
# File 'lib/erml_styles.rb', line 163

def underline(value=nil)
  return @underline if value.nil?
  @underline = (value == true) || (value == 'true')
end

#weight(value = nil) ⇒ Object



168
169
170
171
# File 'lib/erml_styles.rb', line 168

def weight(value=nil)
  return @weight if value.nil?
  @weight = value
end