Class: CTioga2::Graphics::Styles::LaTeXFont

Inherits:
Object
  • Object
show all
Defined in:
lib/ctioga2/graphics/styles/texts.rb

Overview

A LaTeX font. It should be applied to text using the function #fontify.

todo add real font attributes (family, and so on…)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLaTeXFont

Returns a new instance of LaTeXFont.



261
262
263
# File 'lib/ctioga2/graphics/styles/texts.rb', line 261

def initialize
  # Nothing to be done
end

Instance Attribute Details

#font_commandObject

The font command (bf, sf…). Naive but effective !



259
260
261
# File 'lib/ctioga2/graphics/styles/texts.rb', line 259

def font_command
  @font_command
end

Class Method Details

.from_text(txt) ⇒ Object



265
266
267
268
269
270
# File 'lib/ctioga2/graphics/styles/texts.rb', line 265

def self.from_text(txt)
  # For now, only the naive way of things:
  font = self.new
  font.font_command = txt
  return font
end

Instance Method Details

#fontify(txt) ⇒ Object

Returns text wrapping txt with the appropriate functions to get the appropriate font in LaTeX.



274
275
276
277
278
279
# File 'lib/ctioga2/graphics/styles/texts.rb', line 274

def fontify(txt)
  if @font_command
    return "{\\#{@font_command} #{txt}}"
  end
  return txt
end