Class: Fzeet::Windows::LOGFONT

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/fzeet/windows/gdi/Font.rb

Instance Method Summary collapse

Instance Method Details

#bold=(bold) ⇒ Object



29
# File 'lib/fzeet/windows/gdi/Font.rb', line 29

def bold=(bold) self[:lfWeight] = (bold) ? 700 : 0 end

#bold?Boolean

Returns:

  • (Boolean)


28
# File 'lib/fzeet/windows/gdi/Font.rb', line 28

def bold?; self[:lfWeight] >= 700 end

#faceObject



22
# File 'lib/fzeet/windows/gdi/Font.rb', line 22

def face; self[:lfFaceName].to_s end

#face=(face) ⇒ Object



23
# File 'lib/fzeet/windows/gdi/Font.rb', line 23

def face=(face) self[:lfFaceName] = face end

#italic=(italic) ⇒ Object



32
# File 'lib/fzeet/windows/gdi/Font.rb', line 32

def italic=(italic) self[:lfItalic] = (italic) ? 1 : 0 end

#italic?Boolean

Returns:

  • (Boolean)


31
# File 'lib/fzeet/windows/gdi/Font.rb', line 31

def italic?; self[:lfItalic] == 1 end

#sizeObject



25
# File 'lib/fzeet/windows/gdi/Font.rb', line 25

def size; -Rational(self[:lfHeight] * 72, Application.devcaps[:logpixelsy]) end

#size=(size) ⇒ Object



26
# File 'lib/fzeet/windows/gdi/Font.rb', line 26

def size=(size) self[:lfHeight] = -Windows.MulDiv((size * 10).to_i, Application.devcaps[:logpixelsy], 720) end

#strikeout=(strikeout) ⇒ Object



38
# File 'lib/fzeet/windows/gdi/Font.rb', line 38

def strikeout=(strikeout) self[:lfStrikeOut] = (strikeout) ? 1 : 0 end

#strikeout?Boolean

Returns:

  • (Boolean)


37
# File 'lib/fzeet/windows/gdi/Font.rb', line 37

def strikeout?; self[:lfStrikeOut] == 1 end

#underline=(underline) ⇒ Object



35
# File 'lib/fzeet/windows/gdi/Font.rb', line 35

def underline=(underline) self[:lfUnderline] = (underline) ? 1 : 0 end

#underline?Boolean

Returns:

  • (Boolean)


34
# File 'lib/fzeet/windows/gdi/Font.rb', line 34

def underline?; self[:lfUnderline] == 1 end

#update(from) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fzeet/windows/gdi/Font.rb', line 40

def update(from)
	case from
	when PropertyStore
		from.each { |k, v|
			case k
			when UI_PKEY_FontProperties_Family; self.face = v.wstring
			when UI_PKEY_FontProperties_Size; self.size = v.decimal.to_f
			when UI_PKEY_FontProperties_Bold; self.bold = v.uint == 2
			when UI_PKEY_FontProperties_Italic; self.italic = v.uint == 2
			when UI_PKEY_FontProperties_Underline; self.underline = v.uint == 2
			when UI_PKEY_FontProperties_Strikethrough; self.strikeout = v.uint == 2
			end
		}
	else raise ArgumentError
	end

	self
end