[HTML] 纯文本查看 复制代码
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>test</title>
<script src="jquery.min.js"></script>
</head>
<body>
<script src="require.js"></script>
<script>
var fontCarrier2 = require('../lib/index')
var options = {
id: 'font-4',
horizAdvX: 256,
vertAdvY: 256
}
var fontface = {
fontFamily: 'font-4',
fontWeight: '400',
fontStretch: 'normal',
unitsPerEm: 256,
ascent: 221,
descent: -61
}
var glyphMap = {
'纯': {
unicode: '纯',
glyphName: 'uni7EAF',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni32431'
},
'空': {
unicode: '空',
glyphName: 'uni7A7A',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni31354'
},
'白': {
unicode: '白',
glyphName: 'uni767D',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni30333'
},
' ': {
unicode: ' ',
glyphName: 'uni20',
d: '',
horizAdvX: 65,
vertAdvY: 256,
name: 'uni32'
},
'迷': {
unicode: '迷',
glyphName: 'uni8FF7',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni36855'
},
'你': {
unicode: '你',
glyphName: 'uni4F60',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni20320'
},
'简': {
unicode: '简',
glyphName: 'uni7B80',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni31616'
},
'硬': {
unicode: '硬',
glyphName: 'uni786C',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni30828'
},
'笔': {
unicode: '笔',
glyphName: 'uni7B14',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni31508'
},
'楷': {
unicode: '楷',
glyphName: 'uni6977',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni26999'
},
'书': {
unicode: '书',
glyphName: 'uni4E66',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni20070'
},
'字': {
unicode: '字',
glyphName: 'uni5B57',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni23383'
},
'体': {
unicode: '体',
glyphName: 'uni4F53',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni20307'
},
'测': {
unicode: '测',
glyphName: 'uni6D4B',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni27979'
},
'试': {
unicode: '试',
glyphName: 'uni8BD5',
d:
'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni35797'
},
'1': {
unicode: '1',
glyphName: 'uni31',
d: 'svg-data ...',
horizAdvX: 140,
vertAdvY: 256,
name: 'uni49'
},
',': {
unicode: ',',
glyphName: 'uniFF0C',
d: 'svg-data ...',
horizAdvX: 256,
vertAdvY: 256,
name: 'uni65292'
},
'2': {
unicode: '2',
glyphName: 'uni32',
d:
'svg-data ...',
horizAdvX: 140,
vertAdvY: 256,
name: 'uni50'
},
'3': {
unicode: '3',
glyphName: 'uni33',
d:
'svg-data ...',
horizAdvX: 140,
vertAdvY: 256,
name: 'uni51'
}
}
var font = fontCarrier2.create(options)
font.setFontface(fontface)
Object.keys(glyphMap).forEach(key => {
var tmplGlyph = new fontCarrier2.Glyph(glyphMap[key])
tmplGlyph.__viewbox = font.__viewbox
font.setGlyph(key, tmplGlyph)
})
font.output({
path: './test/font-4'
})
</script>
</body>
</html>