A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Hopding/fontkit/commit/f674bf2e3c8a8e0a34083e19f0abe65df20520e3 below:

Remove use of spread operator (for React Native Android); Fix tests · Hopding/fontkit@f674bf2 · GitHub

1 1

import fontkit from '../src';

2 2

import assert from 'assert';

3 +

import fs from 'fs';

3 4 4 5

describe('character to glyph mapping', function() {

5 6

describe('basic cmap handling', function() {

6 -

let font = fontkit.openSync(__dirname + '/data/OpenSans/OpenSans-Regular.ttf');

7 +

const fontData = fs.readFileSync(__dirname + '/data/OpenSans/OpenSans-Regular.ttf');

8 +

const font = fontkit.create(fontData);

7 9 8 10

it('should get characterSet', function() {

9 11

assert(Array.isArray(font.characterSet));

@@ -30,20 +32,25 @@ describe('character to glyph mapping', function() {

30 32

});

31 33 32 34

it('should support unicode variation selectors', function() {

33 -

let font = fontkit.openSync(__dirname + '/data/fonttest/TestCMAP14.otf');

35 +

const fontData = fs.readFileSync(__dirname + '/data/fonttest/TestCMAP14.otf');

36 +

const font = fontkit.create(fontData);

37 + 34 38

let glyphs = font.glyphsForString('\u{82a6}\u{82a6}\u{E0100}\u{82a6}\u{E0101}');

35 39

assert.deepEqual(glyphs.map(g => g.id), [1, 1, 2]);

36 40

});

37 41 38 42

it('should support legacy encodings when no unicode cmap is found', function() {

39 -

let font = fontkit.openSync(__dirname + '/data/fonttest/TestCMAPMacTurkish.ttf');

43 +

const fontData = fs.readFileSync(__dirname + '/data/fonttest/TestCMAPMacTurkish.ttf');

44 +

const font = fontkit.create(fontData);

45 + 40 46

let glyphs = font.glyphsForString("“ABÇĞIİÖŞÜ”");

41 47

assert.deepEqual(glyphs.map(g => g.id), [200, 34, 35, 126, 176, 42, 178, 140, 181, 145, 201]);

42 48

});

43 49

});

44 50 45 51

describe('opentype features', function() {

46 -

let font = fontkit.openSync(__dirname + '/data/SourceSansPro/SourceSansPro-Regular.otf');

52 +

const fontData = fs.readFileSync(__dirname + '/data/SourceSansPro/SourceSansPro-Regular.otf');

53 +

const font = fontkit.create(fontData);

47 54 48 55

it('should list available features', () =>

49 56

assert.deepEqual(font.availableFeatures, [

@@ -73,7 +80,8 @@ describe('character to glyph mapping', function() {

73 80

});

74 81 75 82

describe('AAT features', function() {

76 -

let font = fontkit.openSync(__dirname + '/data/Play/Play-Regular.ttf');

83 +

const fontData = fs.readFileSync(__dirname + '/data/Play/Play-Regular.ttf');

84 +

const font = fontkit.create(fontData);

77 85 78 86

it('should list available features', () => assert.deepEqual(font.availableFeatures, [ 'tnum', 'sups', 'subs', 'numr', 'onum', 'lnum', 'liga', 'kern' ]));

79 87

@@ -99,7 +107,9 @@ describe('character to glyph mapping', function() {

99 107

});

100 108 101 109

it('should apply indic reordering features', function() {

102 -

let f = fontkit.openSync(__dirname + '/data/Khmer/Khmer.ttf');

110 +

const fontData = fs.readFileSync(__dirname + '/data/Khmer/Khmer.ttf');

111 +

const font = fontkit.create(fontData);

112 + 103 113

let {glyphs} = f.layout('ខ្ញុំអាចញ៉ាំកញ្ចក់បាន ដោយគ្មានបញ្ហា');

104 114

assert.deepEqual(glyphs.map(g => g.id), [

105 115

45, 153, 177, 112, 248, 188, 49, 296, 44, 187, 149, 44, 117, 236, 188, 63, 3, 107,

@@ -118,13 +128,17 @@ describe('character to glyph mapping', function() {

118 128 119 129

describe('glyph id to strings', function () {

120 130

it('should return strings from cmap that map to a given glyph', function () {

121 -

let font = fontkit.openSync(__dirname + '/data/OpenSans/OpenSans-Regular.ttf');

131 +

const fontData = fs.readFileSync(__dirname + '/data/OpenSans/OpenSans-Regular.ttf');

132 +

const font = fontkit.create(fontData);

133 + 122 134

let strings = font.stringsForGlyph(68);

123 135

assert.deepEqual(strings, ['a']);

124 136

});

125 137 126 138

it('should return strings from AAT morx table that map to the given glyph', function () {

127 -

let font = fontkit.openSync(__dirname + '/data/Play/Play-Regular.ttf');

139 +

const fontData = fs.readFileSync(__dirname + '/data/Play/Play-Regular.ttf');

140 +

const font = fontkit.create(fontData);

141 + 128 142

let strings = font.stringsForGlyph(767);

129 143

assert.deepEqual(strings, ['ffi']);

130 144

});


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4