mirror of
https://github.com/palxiao/poster-design.git
synced 2025-07-28 04:10:31 +08:00
fix: font load bug
This commit is contained in:
parent
79da1c8031
commit
12af9f6937
@ -56,7 +56,7 @@
|
||||
|
||||
import { reactive, toRefs, computed, onUpdated, watch, onMounted, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
// import { fontWithDraw } from '@/utils/widgets/loadFontRule'
|
||||
import { fontMinWithDraw } from '@/utils/widgets/loadFontRule'
|
||||
import getGradientOrImg from './getGradientOrImg'
|
||||
import { wTextSetting } from './wTextSetting'
|
||||
import { useForceStore, useHistoryStore, useWidgetStore } from '@/store'
|
||||
@ -117,9 +117,9 @@ watch(
|
||||
|
||||
if (font.url && !isDone) {
|
||||
if (font.id && isDraw.value) {
|
||||
// 如果为绘制模式,且开启了字体抽取,那么会跳过加载字体url的逻辑
|
||||
// 此前该功能在demo中存在换行bug,实际上是由于抽取字体时忽略了空格导致的
|
||||
state.loading = false
|
||||
}
|
||||
if (fontMinWithDraw) {
|
||||
return
|
||||
}
|
||||
state.loading = !isDraw.value
|
||||
|
@ -2,14 +2,14 @@
|
||||
* @Author: ShawnPhang
|
||||
* @Date: 2023-08-23 17:37:16
|
||||
* @Description: 提取字体子集
|
||||
* @LastEditors: ShawnPhang <https://m.palxp.cn>, Jeremy Yu <https://github.com/JeremyYu-cn>
|
||||
* @LastEditTime: 2024-02-27 10:32:00
|
||||
* @LastEditors: ShawnPhang <https://m.palxp.cn>
|
||||
* @LastEditTime: 2024-12-28 19:52:55
|
||||
*/
|
||||
/**
|
||||
* 只有ttf/otf这种原始字体支持提取,如果服务端不支持该功能请设置false,以保证页面能加载字体。
|
||||
*/
|
||||
import _config from '@/config'
|
||||
export const fontWithDraw = _config.supportSubFont // true 开启,false 关闭
|
||||
export const fontMinWithDraw = _config.supportSubFont // true 开启,false 关闭
|
||||
|
||||
import api from '@/api'
|
||||
import { blob2Base64, generateFontStyle } from '@/common/methods/fonts/utils'
|
||||
|
@ -13,7 +13,7 @@ import { StyleValue, onMounted, reactive, nextTick } from 'vue'
|
||||
import api from '@/api'
|
||||
import Preload from '@/utils/plugins/preload'
|
||||
import FontFaceObserver from 'fontfaceobserver'
|
||||
import { fontWithDraw, font2style } from '@/utils/widgets/loadFontRule'
|
||||
import { fontMinWithDraw, font2style } from '@/utils/widgets/loadFontRule'
|
||||
import designBoard from '@/components/modules/layout/designBoard/index.vue'
|
||||
import zoomControl from '@/components/modules/layout/zoomControl/index.vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
@ -120,7 +120,7 @@ async function load() {
|
||||
// store.commit('setDPage', {...content.page, ...{backgroundImage}})
|
||||
}
|
||||
try {
|
||||
fontWithDraw && (await font2style(fontContent, fontData))
|
||||
fontMinWithDraw && (await font2style(fontContent, fontData))
|
||||
// console.log('1. base64 yes')
|
||||
const preload = new Preload(imgsData)
|
||||
await preload.doms()
|
||||
|
@ -2,8 +2,8 @@
|
||||
* @Author: Jeremy Yu
|
||||
* @Date: 2024-12-27 00:02:46
|
||||
* @Description: 图片生成HTML页面
|
||||
* @LastEditors: Jeremy Yu <https://book.yzmblog.top>
|
||||
* @LastEditTime: 2024-12-28 12:28:00
|
||||
* @LastEditors: ShawnPhang <https://m.palxp.cn>
|
||||
* @LastEditTime: 2024-12-28 19:54:55
|
||||
-->
|
||||
|
||||
<template>
|
||||
@ -28,7 +28,7 @@ import { onMounted, nextTick, ref, onUnmounted } from 'vue'
|
||||
import api from '@/api'
|
||||
import Preload from '@/utils/plugins/preload'
|
||||
import FontFaceObserver from 'fontfaceobserver'
|
||||
import { fontWithDraw, font2style } from '@/utils/widgets/loadFontRule'
|
||||
import { fontMinWithDraw, font2style } from '@/utils/widgets/loadFontRule'
|
||||
import designBoard from '@/components/modules/layout/designBoard/index.vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { TPageState } from '@/store/design/canvas/d'
|
||||
@ -119,7 +119,7 @@ async function load() {
|
||||
await preloadBg.imgs()
|
||||
}
|
||||
try {
|
||||
fontWithDraw && (await font2style(fontContent, fontData))
|
||||
fontMinWithDraw && (await font2style(fontContent, fontData))
|
||||
// console.log('1. base64 yes')
|
||||
const preload = new Preload(imgsData)
|
||||
await preload.doms()
|
||||
|
Loading…
x
Reference in New Issue
Block a user