diff --git a/scripts/copy-h5-nav-assets.cjs b/scripts/copy-h5-nav-assets.cjs index 245f95e..58b076e 100644 --- a/scripts/copy-h5-nav-assets.cjs +++ b/scripts/copy-h5-nav-assets.cjs @@ -41,6 +41,19 @@ const copyStaticSubtree = (subtree) => { console.log(`Copied ${subtree} assets to ${path.relative(projectRoot, targetDir)}`) } +const copyPublicStaticSubtree = (subtree) => { + const sourceDir = path.join(projectRoot, 'public', 'static', subtree) + const targetDir = path.join(h5Root, 'static', subtree) + + if (!fs.existsSync(sourceDir)) { + throw new Error(`Public static assets not found: ${sourceDir}`) + } + + fs.rmSync(targetDir, { recursive: true, force: true }) + copyDirectory(sourceDir, targetDir) + console.log(`Copied public static ${subtree} assets to ${path.relative(projectRoot, targetDir)}`) +} + const copyStaticFile = (fileName) => { const sourceFile = path.join(projectRoot, 'static', fileName) const targetFile = path.join(h5Root, 'static', fileName) @@ -61,6 +74,7 @@ copyStaticSubtree('sgs-map-sdk') copyStaticSubtree('three') copyStaticFile('exhibit-placeholder.jpg') copyStaticFile('hall-placeholder.jpg') +copyPublicStaticSubtree('Fonts') if (fs.existsSync(faviconSource)) { fs.copyFileSync(faviconSource, faviconTarget) diff --git a/src/components/map/ThreeMap.vue b/src/components/map/ThreeMap.vue index e5682d0..048b31e 100644 --- a/src/components/map/ThreeMap.vue +++ b/src/components/map/ThreeMap.vue @@ -75,7 +75,7 @@ type CameraPreset = 'top' | 'oblique' type TouchGestureMode = 'orbit' | 'pan' type ZoomCameraSource = 'button' | 'gesture' -const CANVAS_FONT_FAMILY = '"HarmonyOS Sans SC", "HarmonyOS Sans", "鸿蒙黑体", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif' +const CANVAS_FONT_FAMILY = '"鸿蒙黑体", "HarmonyOS Sans SC", "HarmonyOS Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif' const FLOOR_CAMERA_DISTANCE_FACTOR = 0.78 interface CameraFitOptions { diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 8885efe..6b4e4f0 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -1,7 +1,63 @@ +@font-face { + font-family: '鸿蒙黑体'; + src: url('/static/Fonts/HarmonyOS_SansSC_Thin.ttf') format('truetype'); + font-weight: 100; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: '鸿蒙黑体'; + src: url('/static/Fonts/HarmonyOS_SansSC_Light.ttf') format('truetype'); + font-weight: 300; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: '鸿蒙黑体'; + src: url('/static/Fonts/HarmonyOS_SansSC_Regular.ttf') format('truetype'); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: '鸿蒙黑体'; + src: url('/static/Fonts/HarmonyOS_SansSC_Medium.ttf') format('truetype'); + font-weight: 500; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: '鸿蒙黑体'; + src: url('/static/Fonts/HarmonyOS_SansSC_Semibold.ttf') format('truetype'); + font-weight: 600; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: '鸿蒙黑体'; + src: url('/static/Fonts/HarmonyOS_SansSC_Bold.ttf') format('truetype'); + font-weight: 700; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: '鸿蒙黑体'; + src: url('/static/Fonts/HarmonyOS_SansSC_Black.ttf') format('truetype'); + font-weight: 900; + font-style: normal; + font-display: swap; +} + /* CSS 变量定义 */ :root { /* 字体 */ - --museum-font-family: '鸿蒙黑体', 'HarmonyOS Sans SC', 'HarmonyOS Sans', 'Microsoft YaHei', 'PingFang SC', 'Noto Sans CJK SC', Arial, sans-serif; + --museum-font-family: '鸿蒙黑体', 'HarmonyOS Sans SC', 'HarmonyOS Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; /* 主色调 */ --museum-accent: #E0DF00;