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

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

Overview

TODO:

Deprecate in favor of the latter class

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.



321
322
323
# File 'lib/ctioga2/graphics/styles/texts.rb', line 321

def initialize
  # Nothing to be done
end

Instance Attribute Details

#font_commandObject

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



319
320
321
# File 'lib/ctioga2/graphics/styles/texts.rb', line 319

def font_command
  @font_command
end

Class Method Details

.from_text(txt) ⇒ Object



325
326
327
328
329
330
# File 'lib/ctioga2/graphics/styles/texts.rb', line 325

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.



334
335
336
337
338
339
# File 'lib/ctioga2/graphics/styles/texts.rb', line 334

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