Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ssssota committed Dec 14, 2018
1 parent fb41582 commit 54d536d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules
dist
node_modules/
dist/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ npm run build:mac
# build for windows
npm run build:windows

#build for linux
# build for linux
npm run build:linux
```

Expand Down
20 changes: 11 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
const convert = require('color-convert')
const fontManager = require('font-manager')
// get all of the fonts
const fonts = fontManager.getAvailableFontsSync().sort((a, b) => {
const A = a.family.toUpperCase()
const B = b.family.toUpperCase()
if (A < B) return -1
if (A > B) return 1
return 0
})
console.log(fonts)
let fonts

const $container = document.querySelector('#container')
const $fontlist = document.querySelector('#fontlist')
Expand Down Expand Up @@ -40,7 +33,16 @@ let moreSettingHeight = 0

// onDOMContentLoaded func also main func
const onLoad = () => {
for (let i = fonts.length-1, last = ''; i >= 0; i--) {
fonts = fontManager.getAvailableFontsSync().sort((a, b) => {
const A = a.family.toUpperCase()
const B = b.family.toUpperCase()
if (A < B) return -1
if (A > B) return 1
return 0
})
console.log(fonts)

for (let i = fonts.length-1; i >= 0; i--) {
const family = fonts[i].family
const weight = fonts[i].weight
const isItalic = fonts[i].italic
Expand Down

0 comments on commit 54d536d

Please sign in to comment.