Class: FontStruct
Overview
FontStruct
Subclass of Struct for representing text attributes.
Attributes
— fontface — height — style — weight — width — escapement — orientation — pitch_family — charset — point — color
Class Method
— new2(args)
Use new2 instead of new.
Methods
— params
Returns parameters that can be used for parameter of
SWin::LWFactory.newfont()
— spec
Returns text attributes for parameter of SWin::CommonDialog.chooseFont
— bold?
Returns whether the attributes means bold style
— bold=(flag)
Sets or resets bold style.
— italic?
Returns whether the attributes means italic style
— italic=(flag)
Sets or resets italic style.
— underlined?
Returns whether the attributes means underline style
— underlined=(flag)
Sets or resets underline style.
— striked?
Returns whether the attributes means strike-out style
— striked=(flag)
Sets or resets strike-out style.
Instance Attribute Summary collapse
-
#charset ⇒ Object
Returns the value of attribute charset.
-
#color ⇒ Object
Returns the value of attribute color.
-
#escapement ⇒ Object
Returns the value of attribute escapement.
-
#fontface ⇒ Object
Returns the value of attribute fontface.
-
#height ⇒ Object
Returns the value of attribute height.
-
#orientation ⇒ Object
Returns the value of attribute orientation.
-
#pitch_family ⇒ Object
Returns the value of attribute pitch_family.
-
#point ⇒ Object
Returns the value of attribute point.
-
#style ⇒ Object
Returns the value of attribute style.
-
#weight ⇒ Object
Returns the value of attribute weight.
-
#width ⇒ Object
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
- #bold=(flag) ⇒ Object
- #bold? ⇒ Boolean
- #italic=(flag) ⇒ Object
- #italic? ⇒ Boolean
- #params ⇒ Object
- #spec ⇒ Object
- #striked=(flag) ⇒ Object
- #striked? ⇒ Boolean
- #underlined=(flag) ⇒ Object
- #underlined? ⇒ Boolean
Instance Attribute Details
#charset ⇒ Object
Returns the value of attribute charset
109 110 111 |
# File 'lib/vr/rscutil.rb', line 109 def charset @charset end |
#color ⇒ Object
Returns the value of attribute color
109 110 111 |
# File 'lib/vr/rscutil.rb', line 109 def color @color end |
#escapement ⇒ Object
Returns the value of attribute escapement
109 110 111 |
# File 'lib/vr/rscutil.rb', line 109 def escapement @escapement end |
#fontface ⇒ Object
Returns the value of attribute fontface
109 110 111 |
# File 'lib/vr/rscutil.rb', line 109 def fontface @fontface end |
#height ⇒ Object
Returns the value of attribute height
109 110 111 |
# File 'lib/vr/rscutil.rb', line 109 def height @height end |
#orientation ⇒ Object
Returns the value of attribute orientation
109 110 111 |
# File 'lib/vr/rscutil.rb', line 109 def orientation @orientation end |
#pitch_family ⇒ Object
Returns the value of attribute pitch_family
109 110 111 |
# File 'lib/vr/rscutil.rb', line 109 def pitch_family @pitch_family end |
#point ⇒ Object
Returns the value of attribute point
109 110 111 |
# File 'lib/vr/rscutil.rb', line 109 def point @point end |
#style ⇒ Object
Returns the value of attribute style
109 110 111 |
# File 'lib/vr/rscutil.rb', line 109 def style @style end |
#weight ⇒ Object
Returns the value of attribute weight
109 110 111 |
# File 'lib/vr/rscutil.rb', line 109 def weight @weight end |
#width ⇒ Object
Returns the value of attribute width
109 110 111 |
# File 'lib/vr/rscutil.rb', line 109 def width @width end |
Class Method Details
.new2(*args) ⇒ Object
117 118 119 |
# File 'lib/vr/rscutil.rb', line 117 def self.new2(*args) new(*args.flatten) end |
Instance Method Details
#bold=(flag) ⇒ Object
130 131 132 |
# File 'lib/vr/rscutil.rb', line 130 def bold=(flag) self.weight = if flag then 600 else 300 end end |
#bold? ⇒ Boolean
133 134 135 |
# File 'lib/vr/rscutil.rb', line 133 def bold? (@weight>400) end |
#italic=(flag) ⇒ Object
137 138 139 140 141 142 143 |
# File 'lib/vr/rscutil.rb', line 137 def italic=(flag) if flag then self.style |= 1 # 1=SWINFONT_ITALIC else self.style &= 0xfffffffe end end |
#italic? ⇒ Boolean
144 145 146 |
# File 'lib/vr/rscutil.rb', line 144 def italic? (self.style&1)>0 end |
#params ⇒ Object
121 122 123 |
# File 'lib/vr/rscutil.rb', line 121 def params to_a[0,9] end |
#spec ⇒ Object
125 126 127 128 |
# File 'lib/vr/rscutil.rb', line 125 def spec a=self.to_a [ a[0,9],a[9],a[10] ] end |
#striked=(flag) ⇒ Object
159 160 161 162 163 164 165 |
# File 'lib/vr/rscutil.rb', line 159 def striked=(flag) if flag then self.style |= 4 # 4=SWINFONT_STRIKE else self.style &= 0xfffffffb end end |
#striked? ⇒ Boolean
166 167 168 |
# File 'lib/vr/rscutil.rb', line 166 def striked? (self.style&4)>0 end |
#underlined=(flag) ⇒ Object
148 149 150 151 152 153 154 |
# File 'lib/vr/rscutil.rb', line 148 def underlined=(flag) if flag then self.style |= 2 # 2=SWINFONT_ULINE else self.style &= 0xfffffffd end end |
#underlined? ⇒ Boolean
155 156 157 |
# File 'lib/vr/rscutil.rb', line 155 def underlined? (self.style&2)>0 end |