lib/sugarcube/symbol.rb in sugarcube-0.18.1 vs lib/sugarcube/symbol.rb in sugarcube-0.18.2
- old
+ new
@@ -205,11 +205,11 @@
@system_fonts = {
system: :"systemFontOfSize:",
bold: :"boldSystemFontOfSize:",
italic: :"italicSystemFontOfSize:",
- monospace: 'Monaco',
+ monospace: 'Courier New',
}
@font_sizes = {
label: :labelFontSize,
button: :buttonFontSize,
@@ -396,24 +396,36 @@
}
@autoresizemasks = {
none: UIViewAutoresizingNone,
- flexibleleft: UIViewAutoresizingFlexibleLeftMargin,
- flexiblewidth: UIViewAutoresizingFlexibleWidth,
- flexibleright: UIViewAutoresizingFlexibleRightMargin,
- flexibletop: UIViewAutoresizingFlexibleTopMargin,
- flexibleheight: UIViewAutoresizingFlexibleHeight,
- flexiblebottom: UIViewAutoresizingFlexibleBottomMargin,
+ flexible_left: UIViewAutoresizingFlexibleLeftMargin,
+ flexible_width: UIViewAutoresizingFlexibleWidth,
+ flexible_right: UIViewAutoresizingFlexibleRightMargin,
+ flexible_top: UIViewAutoresizingFlexibleTopMargin,
+ flexible_height: UIViewAutoresizingFlexibleHeight,
+ flexible_bottom: UIViewAutoresizingFlexibleBottomMargin,
- # aliases
- left: UIViewAutoresizingFlexibleLeftMargin,
- width: UIViewAutoresizingFlexibleWidth,
- right: UIViewAutoresizingFlexibleRightMargin,
- top: UIViewAutoresizingFlexibleTopMargin,
- height: UIViewAutoresizingFlexibleHeight,
- bottom: UIViewAutoresizingFlexibleBottomMargin,
+ # shorthands
+ full: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight,
+ fixed_top: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin,
+ fixed_bottom: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin,
+ fixed_left: UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleRightMargin,
+ fixed_right: UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin,
+
+ fixed_top_left: UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin,
+ fixed_top_middle: UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin,
+ fixed_top_right: UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin,
+ fixed_middle_left: UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin,
+ fixed_middle: UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin,
+ fixed_middle_right: UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin,
+ fixed_bottom_left: UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin,
+ fixed_bottom_middle: UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin,
+ fixed_bottom_right: UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin,
+
+ float_horizontal: UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin,
+ float_vertical: UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin,
}
@image_sourcetypes = {
camera: UIImagePickerControllerSourceTypeCamera,
library: UIImagePickerControllerSourceTypePhotoLibrary,
@@ -658,27 +670,27 @@
def uifont(size=nil)
size ||= UIFont.systemFontSize
# system fonts
if Symbol.system_fonts.has_key? self
font = look_in(Symbol.system_fonts)
- if size.is_a? Symbol
+ if size.is_a?(Symbol)
size = Symbol.font_sizes.fetch(size).uifontsize
end
+
if font.is_a?(Symbol)
- font = UIFont.send(font, size)
+ return UIFont.send(font, size)
else
- font.uifont(size)
+ return font.uifont(size)
end
else
size = look_in(font_sizes).uifontsize
- font = UIFont.systemFontOfSize(size)
+ return UIFont.systemFontOfSize(size)
end
- font
end
def uifontsize
size = look_in(Symbol.font_sizes)
- if size.is_a? Symbol
+ if size.is_a?(Symbol)
return UIFont.send(size)
end
return size.to_f
end