module UnderOs::UI::Style::Fonts

Constants

BUTTONS_ALIGMENTS_MAP
TEXTNODES_ALIGMENTS_MAP

Public Instance Methods

fontFamily() click to toggle source
# File lib/under_os/ui/style/fonts.rb, line 8
def fontFamily
  @view.font.familyName
end
fontFamily=(value) click to toggle source
# File lib/under_os/ui/style/fonts.rb, line 12
def fontFamily=(value)
  @view.font = UIFont.fontWithName(value, size: @view.font.pointSize)
end
fontSize() click to toggle source
# File lib/under_os/ui/style/fonts.rb, line 16
def fontSize
  @view.font.pointSize
end
fontSize=(value) click to toggle source
# File lib/under_os/ui/style/fonts.rb, line 20
def fontSize=(value)
  @view.font  = @view.font.fontWithSize(value)
  @view.sizeToFit if @type == :icon
end
textAlign() click to toggle source
# File lib/under_os/ui/style/fonts.rb, line 25
def textAlign
  if @view.is_a?(UIButton)
    BUTTONS_ALIGMENTS_MAP.key(@view.contentHorizontalAlignment)
  elsif @view.respond_to?(:textAlignment)
    TEXTNODES_ALIGMENTS_MAP.key(@view.textAlignment)
  end
end
textAlign=(value) click to toggle source
# File lib/under_os/ui/style/fonts.rb, line 33
def textAlign=(value)
  if @view.is_a?(UIButton)
    @view.contentHorizontalAlignment = BUTTONS_ALIGMENTS_MAP[value.to_s] || BUTTONS_ALIGMENTS_MAP['left']
  elsif @view.respond_to?(:textAlignment)
    @view.textAlignment = TEXTNODES_ALIGMENTS_MAP[value.to_s] || BUTTONS_ALIGMENTS_MAP['left']
  end
end