diff --git a/core/core-frontend/src/components/dashboard/subject-setting/dashboard-style/OverallSetting.vue b/core/core-frontend/src/components/dashboard/subject-setting/dashboard-style/OverallSetting.vue index 4ba8ed0360..4be68cbf4f 100644 --- a/core/core-frontend/src/components/dashboard/subject-setting/dashboard-style/OverallSetting.vue +++ b/core/core-frontend/src/components/dashboard/subject-setting/dashboard-style/OverallSetting.vue @@ -241,7 +241,7 @@ import { LIGHT_THEME_DASHBOARD_BACKGROUND } from '@/utils/canvasStyle' import { - CHART_FONT_FAMILY, + CHART_FONT_FAMILY_ORIGIN, DEFAULT_COLOR_CASE_DARK, DEFAULT_COLOR_CASE_LIGHT, DEFAULT_TAB_COLOR_CASE_DARK, @@ -274,7 +274,7 @@ const props = defineProps({ default: 'light' } }) -const fontFamily = CHART_FONT_FAMILY.concat( +const fontFamily = CHART_FONT_FAMILY_ORIGIN.concat( appearanceStore.fontList.map(ele => ({ name: ele.name, value: ele.name diff --git a/core/core-frontend/src/components/visualization/CanvasBaseSetting.vue b/core/core-frontend/src/components/visualization/CanvasBaseSetting.vue index 5854484f87..518f7f480a 100644 --- a/core/core-frontend/src/components/visualization/CanvasBaseSetting.vue +++ b/core/core-frontend/src/components/visualization/CanvasBaseSetting.vue @@ -83,7 +83,7 @@ import { storeToRefs } from 'pinia' import { ElFormItem, ElIcon } from 'element-plus-secondary' import Icon from '../icon-custom/src/Icon.vue' import { useAppearanceStoreWithOut } from '@/store/modules/appearance' -import { CHART_FONT_FAMILY } from '@/views/chart/components/editor/util/chart' +import { CHART_FONT_FAMILY_ORIGIN } from '@/views/chart/components/editor/util/chart' import { adaptTitleFontFamilyAll } from '@/utils/canvasStyle' import { useI18n } from '@/hooks/web/useI18n' const snapshotStore = snapshotStoreWithOut() @@ -91,7 +91,7 @@ const { t } = useI18n() const dvMainStore = dvMainStoreWithOut() const { canvasStyleData } = storeToRefs(dvMainStore) const appearanceStore = useAppearanceStoreWithOut() -const fontFamily = CHART_FONT_FAMILY.concat( +const fontFamily = CHART_FONT_FAMILY_ORIGIN.concat( appearanceStore.fontList.map(ele => ({ name: ele.name, value: ele.name diff --git a/core/core-frontend/src/custom-component/component-list.ts b/core/core-frontend/src/custom-component/component-list.ts index dc2c348da1..0bee15dd6e 100644 --- a/core/core-frontend/src/custom-component/component-list.ts +++ b/core/core-frontend/src/custom-component/component-list.ts @@ -580,8 +580,7 @@ const list = [ color: '', padding: 4, verticalAlign: 'middle', - scrollSpeed: 0, - fontFamily: 'Microsoft YaHei' + scrollSpeed: 0 } } ] diff --git a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue index 6747e0535e..30fc433095 100644 --- a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue +++ b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue @@ -62,7 +62,7 @@ import { useEmitt } from '@/hooks/web/useEmitt' import { valueFormatter } from '@/views/chart/components/js/formatter' import { parseJson } from '@/views/chart/components/js/util' import { mappingColor } from '@/views/chart/components/js/panel/common/common_table' -import { CHART_FONT_FAMILY } from '@/views/chart/components/editor/util/chart' +import { CHART_FONT_FAMILY_ORIGIN } from '@/views/chart/components/editor/util/chart' import { useAppearanceStoreWithOut } from '@/store/modules/appearance' const snapshotStore = snapshotStoreWithOut() const errMsg = ref('') @@ -137,7 +137,7 @@ const myValue = ref('') const systemFontFamily = appearanceStore.fontList.map(item => item.name) const curFontFamily = () => { let result = '' - CHART_FONT_FAMILY.concat( + CHART_FONT_FAMILY_ORIGIN.concat( appearanceStore.fontList.map(ele => ({ name: ele.name, value: ele.name diff --git a/core/core-frontend/src/utils/canvasStyle.ts b/core/core-frontend/src/utils/canvasStyle.ts index 90f213ece8..f5de63e151 100644 --- a/core/core-frontend/src/utils/canvasStyle.ts +++ b/core/core-frontend/src/utils/canvasStyle.ts @@ -1,12 +1,15 @@ import { cos, sin } from '@/utils/translate' import { + CHART_FONT_FAMILY_MAP, + CHART_FONT_FAMILY_MAP_TRANS, DEFAULT_COLOR_CASE, - DEFAULT_COLOR_CASE_DARK + DEFAULT_COLOR_CASE_DARK, + DEFAULT_INDICATOR_STYLE } from '@/views/chart/components/editor/util/chart' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { useEmitt } from '@/hooks/web/useEmitt' -import { merge } from 'lodash-es' +import { defaultTo, merge } from 'lodash-es' const dvMainStore = dvMainStoreWithOut() export const LIGHT_THEME_COLOR_MAIN = '#000000' @@ -424,7 +427,10 @@ export function adaptCurTheme(customStyle, customAttr) { export function adaptTitleFontFamily(fontFamily, viewInfo) { if (viewInfo) { - viewInfo.customStyle['text']['fontFamily'] = fontFamily + viewInfo.customStyle['text']['fontFamily'] = defaultTo( + CHART_FONT_FAMILY_MAP_TRANS[fontFamily], + fontFamily + ) } } diff --git a/core/core-frontend/src/views/chart/components/editor/util/chart.ts b/core/core-frontend/src/views/chart/components/editor/util/chart.ts index b4f26b44cc..95ee323086 100644 --- a/core/core-frontend/src/views/chart/components/editor/util/chart.ts +++ b/core/core-frontend/src/views/chart/components/editor/util/chart.ts @@ -1112,6 +1112,20 @@ export const BASE_ECHARTS_SELECT = { } } +export const CHART_FONT_FAMILY_ORIGIN = [ + { name: '微软雅黑', value: 'Microsoft YaHei' }, + { name: '宋体', value: 'SimSun, "Songti SC", STSong' }, + { name: '黑体', value: 'SimHei, Helvetica' }, + { name: '楷体', value: 'KaiTi, "Kaiti SC", STKaiti' } +] + +export const CHART_FONT_FAMILY_MAP_TRANS = { + 'Microsoft YaHei': 'Microsoft YaHei', + 'SimSun, "Songti SC", STSong': 'SimSun', + 'SimHei, Helvetica': 'SimHei', + 'KaiTi, "Kaiti SC", STKaiti': 'KaiTi' +} + export const CHART_FONT_FAMILY = [ { name: '微软雅黑', value: 'Microsoft YaHei' }, { name: '宋体', value: 'SimSun' },