mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
refactor: 命名修改 fontFamily -> fontName
This commit is contained in:
parent
3de955b0fc
commit
5657d3af05
@ -5,7 +5,7 @@ import { State } from './state'
|
||||
import { Slide, PPTElement, SlideTheme } from '@/types/slides'
|
||||
import { CreatingElement } from '@/types/edit'
|
||||
import { SYS_FONTS } from '@/configs/font'
|
||||
import { isSupportFontFamily } from '@/utils/fontFamily'
|
||||
import { isSupportFont } from '@/utils/font'
|
||||
|
||||
interface RemoveElementPropData {
|
||||
id: string;
|
||||
@ -65,7 +65,7 @@ export const mutations: MutationTree<State> = {
|
||||
},
|
||||
|
||||
[MutationTypes.SET_AVAILABLE_FONTS](state) {
|
||||
state.availableFonts = SYS_FONTS.filter(font => isSupportFontFamily(font.value))
|
||||
state.availableFonts = SYS_FONTS.filter(font => isSupportFont(font.value))
|
||||
},
|
||||
|
||||
[MutationTypes.SET_TOOLBAR_STATE](state, type) {
|
||||
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* 判断操作系统是否存在某字体
|
||||
* @param fontFamily 字体名
|
||||
* @param fontName 字体名
|
||||
*/
|
||||
export const isSupportFontFamily = (fontFamily: string) => {
|
||||
if (typeof fontFamily !== 'string') return false
|
||||
export const isSupportFont = (fontName: string) => {
|
||||
if (typeof fontName !== 'string') return false
|
||||
|
||||
const arial = 'Arial'
|
||||
if (fontFamily.toLowerCase() === arial.toLowerCase()) return true
|
||||
if (fontName.toLowerCase() === arial.toLowerCase()) return true
|
||||
|
||||
const size = 100
|
||||
const width = 100
|
||||
@ -32,5 +32,5 @@ export const isSupportFontFamily = (fontFamily: string) => {
|
||||
return [].slice.call(imageData).filter(item => item !== 0)
|
||||
}
|
||||
|
||||
return getDotArray(arial).join('') !== getDotArray(fontFamily).join('')
|
||||
return getDotArray(arial).join('') !== getDotArray(fontName).join('')
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user