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.



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

def initialize
  # Nothing to be done
end

Instance Attribute Details

#font_commandObject

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



324
325
326
# File 'lib/ctioga2/graphics/styles/texts.rb', line 324

def font_command
  @font_command
end

Class Method Details

.from_text(txt) ⇒ Object



330
331
332
333
334
335
# File 'lib/ctioga2/graphics/styles/texts.rb', line 330

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.



339
340
341
342
343
344
# File 'lib/ctioga2/graphics/styles/texts.rb', line 339

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