Class: Axlsx::Font
- Inherits:
-
Object
- Object
- Axlsx::Font
- Includes:
- OptionsParser
- Defined in:
- lib/axlsx/stylesheet/font.rb
Overview
The recommended way to manage fonts, and other styles is Styles#add_style
The Font class details a font instance for use in styling cells.
Instance Attribute Summary collapse
-
#b ⇒ Boolean
Indicates if the font should be rendered in bold.
-
#charset ⇒ Integer
The charset of the font.
-
#color ⇒ Color
The color of the font.
-
#condense ⇒ Boolean
Indicates if the font should be condensed.
-
#extend ⇒ Boolean
The font's extend property.
-
#family ⇒ Integer
The font's family.
-
#i ⇒ Boolean
Indicates if the font should be rendered italicized.
-
#name ⇒ String
The name of the font.
-
#outline ⇒ Boolean
Indicates if the font should be rendered with an outline.
-
#shadow ⇒ Boolean
Indicates if the font should be rendered with a shadow.
-
#strike ⇒ Boolean
Indicates if the font should be rendered with a strikthrough.
-
#sz ⇒ Integer
The size of the font.
-
#u ⇒ String
Indicates if the font should be rendered underlined It must be one of :none, :single, :double, :singleAccounting, :doubleAccounting, true, false.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Font
constructor
Creates a new Font.
-
#to_xml_string(str = +'')) ⇒ String
Serializes the object.
Methods included from OptionsParser
Constructor Details
#initialize(options = {}) ⇒ Font
Creates a new Font
25 26 27 |
# File 'lib/axlsx/stylesheet/font.rb', line 25 def initialize( = {}) end |
Instance Attribute Details
#b ⇒ Boolean
Indicates if the font should be rendered in bold
73 74 75 |
# File 'lib/axlsx/stylesheet/font.rb', line 73 def b @b end |
#charset ⇒ Integer
The following values are defined in the OOXML specification and are OS dependent values 0 ANSI_CHARSET 1 DEFAULT_CHARSET 2 SYMBOL_CHARSET 77 MAC_CHARSET 128 SHIFTJIS_CHARSET 129 HANGUL_CHARSET 130 JOHAB_CHARSET 134 GB2312_CHARSET 136 CHINESEBIG5_CHARSET 161 GREEK_CHARSET 162 TURKISH_CHARSET 163 VIETNAMESE_CHARSET 177 HEBREW_CHARSET 178 ARABIC_CHARSET 186 BALTIC_CHARSET 204 RUSSIAN_CHARSET 222 THAI_CHARSET 238 EASTEUROPE_CHARSET 255 OEM_CHARSET
The charset of the font
56 57 58 |
# File 'lib/axlsx/stylesheet/font.rb', line 56 def charset @charset end |
#color ⇒ Color
The color of the font
108 109 110 |
# File 'lib/axlsx/stylesheet/font.rb', line 108 def color @color end |
#condense ⇒ Boolean
Indicates if the font should be condensed
100 101 102 |
# File 'lib/axlsx/stylesheet/font.rb', line 100 def condense @condense end |
#extend ⇒ Boolean
The font's extend property
104 105 106 |
# File 'lib/axlsx/stylesheet/font.rb', line 104 def extend @extend end |
#family ⇒ Integer
The following are defined OOXML specification 0 Not applicable. 1 Roman 2 Swiss 3 Modern 4 Script 5 Decorative 6..14 Reserved for future use
The font's family
69 70 71 |
# File 'lib/axlsx/stylesheet/font.rb', line 69 def family @family end |
#i ⇒ Boolean
Indicates if the font should be rendered italicized
77 78 79 |
# File 'lib/axlsx/stylesheet/font.rb', line 77 def i @i end |
#name ⇒ String
The name of the font
31 32 33 |
# File 'lib/axlsx/stylesheet/font.rb', line 31 def name @name end |
#outline ⇒ Boolean
Indicates if the font should be rendered with an outline
92 93 94 |
# File 'lib/axlsx/stylesheet/font.rb', line 92 def outline @outline end |
#shadow ⇒ Boolean
Indicates if the font should be rendered with a shadow
96 97 98 |
# File 'lib/axlsx/stylesheet/font.rb', line 96 def shadow @shadow end |
#strike ⇒ Boolean
Indicates if the font should be rendered with a strikthrough
88 89 90 |
# File 'lib/axlsx/stylesheet/font.rb', line 88 def strike @strike end |
#sz ⇒ Integer
The size of the font.
112 113 114 |
# File 'lib/axlsx/stylesheet/font.rb', line 112 def sz @sz end |
#u ⇒ String
true or false is for backwards compatibility and is reassigned to :single or :none respectively
Indicates if the font should be rendered underlined It must be one of :none, :single, :double, :singleAccounting, :doubleAccounting, true, false
84 85 86 |
# File 'lib/axlsx/stylesheet/font.rb', line 84 def u @u end |
Instance Method Details
#to_xml_string(str = +'')) ⇒ String
Serializes the object
197 198 199 200 201 202 203 |
# File 'lib/axlsx/stylesheet/font.rb', line 197 def to_xml_string(str = +'') str << '<font>' Axlsx.instance_values_for(self).each do |k, v| v.is_a?(Color) ? v.to_xml_string(str) : (str << '<' << k.to_s << ' val="' << Axlsx.booleanize(v).to_s << '"/>') end str << '</font>' end |