-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #468 from yne/fix-quadratic
- Loading branch information
Showing
2 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import assert from 'assert'; | ||
import { hex } from '../testutil'; | ||
import Glyph from '../../src/glyph'; | ||
import glyphset from '../../src/glyphset'; | ||
import Path from '../../src/path'; | ||
import cff from '../../src/tables/cff'; | ||
|
||
describe('tables/cff.js', function () { | ||
const data = | ||
'01 00 04 01 00 01 01 01 03 70 73 00 01 01 01 32 ' + | ||
'F8 1B 00 F8 1C 02 F8 1C 03 F8 1D 04 1D 00 00 00 ' + | ||
'55 0F 1D 00 00 00 58 11 8B 1D 00 00 00 80 12 1E ' + | ||
'0A 12 5F 1E 0F 1E 0F 1E 0A 12 5F 1E 0F 1E 0F 0C ' + | ||
'07 00 04 01 01 02 04 06 0B 30 66 6E 77 6E 62 75 ' + | ||
'6D 70 73 00 00 00 01 8A 00 02 01 01 03 23 9B 0E ' + | ||
'9B 8B 8B 15 8C 8D 8B 8B 8C 89 08 89 8B 15 8C 8D ' + | ||
'8B 8B 8C 89 08 89 8B 15 8C 8D 8B 8B 8C 89 08 0E'; | ||
|
||
it('can make a cff tag table', function () { | ||
const options = { | ||
unitsPerEm: 8, | ||
version: '0', | ||
fullName: 'fn', | ||
postScriptName: 'ps', | ||
familyName: 'fn', | ||
weightName: 'wn', | ||
fontBBox: [0, 0, 0, 0], | ||
}; | ||
const path = new Path(); | ||
path.moveTo(0, 0); | ||
path.quadraticCurveTo(1, 3, 2, 0); | ||
path.moveTo(0, 0); | ||
path.quadraticCurveTo(1, 3, 2, 0); | ||
path.moveTo(0, 0); | ||
path.quadraticCurveTo(1, 3, 2, 0); | ||
const bumpsGlyph = new Glyph({ name: 'bumps', path, advanceWidth: 16 }); | ||
const nodefGlyph = new Glyph({ name: 'nodef', path: new Path(), advanceWidth: 16 }); | ||
const glyphSetFont = { unitsPerEm: 8 }; | ||
const glyphs = new glyphset.GlyphSet(glyphSetFont, [nodefGlyph, bumpsGlyph]); | ||
|
||
assert.deepEqual(data, hex(cff.make(glyphs, options).encode())); | ||
}); | ||
|
||
}); |