Permalink
Browse files

Default to native system fonts

  • Loading branch information...
koenbok committed May 10, 2016
1 parent 7d32c8d commit d85c0fa7a5f9f99dae544eb9254d6be76bb03f41
Showing with 42 additions and 9 deletions.
  1. +12 −7 framer/Extras/ErrorDisplay.coffee
  2. +30 −2 framer/Utils.coffee
@@ -16,7 +16,7 @@ if Utils.isMobile()
else
Config.height = 40
Config.textInset = 12
Config.fontSize = 14
Config.fontSize = 13
class ErrorDisplay extends BaseClass
@@ -56,8 +56,8 @@ class ErrorDisplay extends BaseClass
clip: true
error.text.style =
font: "#{Config.fontSize}px/1em Helvetica"
lineHeight: "#{parseInt(error.text.height * 0.95)}px"
font: "#{Config.fontSize}px/1em #{Utils.deviceFont()}"
lineHeight: "#{error.text.height}px"
textAlign: "center"
wordWrap: "break-word"
textOverflow: "ellipsis"
@@ -81,13 +81,18 @@ class ErrorDisplay extends BaseClass
error = @createLayer()
error.scale = 1.1
error.animate
error.text.html = message
animation = error.animate
properties:
scale: 1
curve: "spring(800, 60, 10)"
curve: "spring(800, 55, 10)"
# Terrible hacky fix for blurred text bug on Chrome desktop
if Utils.isChrome() and Utils.isDesktop()
animation.onAnimationEnd ->
Utils.delay 0, -> error.text.html = message + " "
error.text.html = message
destroy: ->
@_context?.destroy()
View
@@ -292,10 +292,22 @@ Utils.webkitVersion = ->
version
Utils.isChrome = ->
return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor)
return /Chrome/.test(navigator.userAgent) and /Google Inc/.test(navigator.vendor)
Utils.isSafari = ->
return /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor)
return /Safari/.test(navigator.userAgent) and /Apple Computer/.test(navigator.vendor)
Utils.isAndroid = ->
return /(android)/i.test(navigator.userAgent)
Utils.isIOS = ->
return /(iPhone|iPod|iPad)/i.test(navigator.platform)
Utils.isMacOS = ->
return /Mac/.test(navigator.platform)
Utils.isWindows = ->
return /Win/.test(navigator.platform)
Utils.isTouch = ->
window.ontouchstart is null and
@@ -376,6 +388,22 @@ Utils.deviceType = ->
Utils.pathJoin = ->
Utils.arrayFromArguments(arguments).join("/")
Utils.deviceFont = (os) ->

This comment has been minimized.

@koenbok

koenbok May 10, 2016

Owner

Hello @benjaminnathan

# https://github.com/jonathantneal/system-font-css
if not os
os = "macos" if Utils.isMacOS()
os = "ios" if Utils.isIOS()
os = "android" if Utils.isAndroid()
os = "windows" if Utils.isWindows()
return "-apple-system, SF UI Text, Helvetica Neue" if os is "macos"
return "-apple-system, SF UI Text, Helvetica Neue" if os is "ios"
return "Roboto, Helvetica Neue" if os is "android"
return "Segoe UI" if os is "windows"
return "Helvetica"
######################################################
# MATH FUNCTIONS

0 comments on commit d85c0fa

Please sign in to comment.