Skip to content

Commit

Permalink
Introduce muli and poppins fonts.
Browse files Browse the repository at this point in the history
Font files fetched from Google Fonts via custom script.
CSP directive enhanced to contain 'fonts' declaration for loading
via 'self' or data: URIs (and dev server)
Common variables introduced for using new fonts
  • Loading branch information
petemill authored and bsclifton committed Dec 5, 2017
1 parent 8c3ef5e commit 4c43ff3
Show file tree
Hide file tree
Showing 103 changed files with 817 additions and 8 deletions.
10 changes: 5 additions & 5 deletions app/browser/api/textCalc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {makeImmutable} = require('../../common/state/immutableUtil')
const globalStyles = require('../../renderer/components/styles/global')

const fontSize = globalStyles.spacing.bookmarksItemFontSize
const fontFamily = globalStyles.defaultFontFamily
const fontFamily = globalStyles.typography.default.family

const calcText = (item, type) => {
const title = type === siteTags.BOOKMARK
Expand All @@ -34,7 +34,7 @@ const calcText = (item, type) => {
let ctx = document.createElement('canvas').getContext('2d')
ctx.font = '${fontSize} ${fontFamily}'
const width = ctx.measureText('${title}').width
return width
})()
`
Expand Down Expand Up @@ -84,7 +84,7 @@ const calcTextList = (list) => {
const bookmarks = []
const folders = []
const list = JSON.parse('${paramList}')
list.forEach(item => {
if (item.type === '${siteTags.BOOKMARK}') {
bookmarks.push({
Expand All @@ -100,12 +100,12 @@ const calcTextList = (list) => {
})
}
})
const result = {
bookmarks: bookmarks,
folders: folders
}
return JSON.stringify(result)
})()
`
Expand Down
2 changes: 2 additions & 0 deletions app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ let generateBraveManifest = () => {
'default-src': '\'self\'',
'form-action': '\'none\'',
'style-src': '\'self\' \'unsafe-inline\'',
'font-src': '\'self\' data:',
'img-src': '* data: file://*',
'frame-src': '\'self\' https://brave.com'
}
Expand All @@ -198,6 +199,7 @@ let generateBraveManifest = () => {
'http://' + devServer,
'ws://' + devServer].join(' ')
cspDirectives['style-src'] = '\'self\' \'unsafe-inline\' http://' + devServer
cspDirectives['font-src'] += ` http://${devServer}`
}

baseManifest.content_security_policy = concatCSP(cspDirectives)
Expand Down
27 changes: 24 additions & 3 deletions app/renderer/components/styles/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ const {opacityIncreaseKeyframes, tabFadeInKeyframes} = require('./animations')
* migrate customizable options to theme.js
*/

const defaultFontFamily = `-apple-system, BlinkMacSystemFont, "Segoe UI"` +
`, "Helvetica Neue", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans"` +
`, "Droid Sans", sans-serif`

const globalStyles = {
defaultFontFamily: `-apple-system, BlinkMacSystemFont, "Segoe UI"` +
`, "Helvetica Neue", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans"` +
`, "Droid Sans", sans-serif`,

breakpoint: {
breakpointWideViewport: '1000px',
Expand Down Expand Up @@ -100,6 +101,26 @@ const globalStyles = {
urlBarOutline: '#bbb',
alphaWhite: 'rgba(255,255,255,0.8)'
},
typography: {
// font for titles, labels in *most* cases (it's not a hard rule, consult a designer)
display: {
family: 'Poppins, ' + defaultFontFamily,
// spacing for fonts >= 30px (generally)
spacingLarge: '-0.4px',
// spacing for font >= 20px and < 30px
spacingMedium: '-0.2px',
// spacing for font < 20px
spacingRegular: 0
},
// font choices for flowing body text
body: {
family: `Muli, ` + defaultFontFamily
},
// system text
default: {
family: defaultFontFamily
}
},
radius: {
borderRadius: '4px',
borderRadiusTabs: '4px',
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions fonts/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require('./muli.css')
require('./poppins.css')
Loading

0 comments on commit 4c43ff3

Please sign in to comment.