Class: RubyRTF::Font

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-rtf/font.rb

Overview

Holds the information for a given font

Constant Summary collapse

FAMILIES =

The font families

[:nil, :roman, :swiss, :modern, :script, :decor, :tech, :bldl]
PITCHES =

The font pitch values

[:default, :fixed, :variable]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = '') ⇒ RubyRTF::Font

Creates a new font

Parameters:

  • name (String) (defaults to: '')

    The font name to set (default: ”)



41
42
43
44
45
46
47
# File 'lib/ruby-rtf/font.rb', line 41

def initialize(name = '')
  @family_command = :nil
  @name = name
  @alternate_name = ''
  @non_tagged_name = ''
  @panose = ''
end

Instance Attribute Details

#alternate_nameString

Returns The alternate name for this font.

Returns:

  • (String)

    The alternate name for this font



11
12
13
# File 'lib/ruby-rtf/font.rb', line 11

def alternate_name
  @alternate_name
end

#character_setInteger

Returns The character set number for the font.

Returns:

  • (Integer)

    The character set number for the font



23
24
25
# File 'lib/ruby-rtf/font.rb', line 23

def character_set
  @character_set
end

#family_commandSymbol

Returns The font family command.

Returns:

  • (Symbol)

    The font family command



29
30
31
# File 'lib/ruby-rtf/font.rb', line 29

def family_command
  @family_command
end

#nameString

Returns The font name.

Returns:

  • (String)

    The font name



8
9
10
# File 'lib/ruby-rtf/font.rb', line 8

def name
  @name
end

#non_tagged_nameString

Returns The non-tagged name for the font.

Returns:

  • (String)

    The non-tagged name for the font



26
27
28
# File 'lib/ruby-rtf/font.rb', line 26

def non_tagged_name
  @non_tagged_name
end

#numberInteger

Returns The font numberb.

Returns:

  • (Integer)

    The font numberb



5
6
7
# File 'lib/ruby-rtf/font.rb', line 5

def number
  @number
end

#panoseString

Returns The panose number for the font.

Returns:

  • (String)

    The panose number for the font



14
15
16
# File 'lib/ruby-rtf/font.rb', line 14

def panose
  @panose
end

#pitchSymbol

Returns The pitch information for this font.

Returns:

  • (Symbol)

    The pitch information for this font



20
21
22
# File 'lib/ruby-rtf/font.rb', line 20

def pitch
  @pitch
end

#themeSymbol

Returns The theme for this font.

Returns:

  • (Symbol)

    The theme for this font



17
18
19
# File 'lib/ruby-rtf/font.rb', line 17

def theme
  @theme
end

Instance Method Details

#cleanup_namesNil

Cleans up the various font names

Returns:

  • (Nil)


60
61
62
63
64
# File 'lib/ruby-rtf/font.rb', line 60

def cleanup_names
  @name = cleanup_name(@name)
  @alternate_name = cleanup_name(@alternate_name)
  @non_tagged_name = cleanup_name(@non_tagged_name)
end

#to_sString

Convert to string format

Returns:

  • (String)

    The string representation



69
70
71
# File 'lib/ruby-rtf/font.rb', line 69

def to_s
  "#{number}: #{name}"
end