forked from sleepy-zone/fabritor-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5016e4c
commit 7288f5a
Showing
5 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as FontFaceObserver from 'fontfaceobserver'; | ||
import { v4 as uuidv4 } from 'uuid'; | ||
import { FONT_PRESET_FAMILY_LIST, LOG_PREFIX } from './constants'; | ||
|
||
export const loadFont = async (f: string) => { | ||
if (!f) return Promise.resolve(); | ||
const item = FONT_PRESET_FAMILY_LIST.find(_item => _item.value === f); | ||
if (!item) return Promise.resolve(); | ||
const font = new FontFaceObserver(); | ||
return font.load(null, 1000 * 100).catch((e) => { console.error(LOG_PREFIX, e); }); | ||
} | ||
|
||
export const uuid = () => { | ||
return uuidv4(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters