Skip to content

Commit

Permalink
fix: load font first
Browse files Browse the repository at this point in the history
  • Loading branch information
humandetail committed Dec 13, 2023
1 parent 742a9d0 commit 2362e5e
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions packages/Chinese-chess/src/pages/OfflineGame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ onMounted(() => {
chatListRef.value &&
chatInputRef.value
) {
const ctrl = createController({
oMain: mainRef.value,
oManual: manualRef.value,
oChatList: chatListRef.value,
oChatInput: chatInputRef.value
})
ctrl.initGame()
ctrl.run()
const font = new FontFace('PieceFont', 'url(fzlsft.ttf)')
font.load().then(f => {
(document.fonts as any).add(f)
}).then(async () => await document.fonts.ready.then())
.then(() => {
const ctrl = createController({
oMain: mainRef.value!,
oManual: manualRef.value!,
oChatList: chatListRef.value!,
oChatInput: chatInputRef.value!
})
ctrl.initGame()
ctrl.run()
})
}
})
Expand Down

0 comments on commit 2362e5e

Please sign in to comment.