Skip to content

Commit

Permalink
Merge 6ef5aad into 3d11aac
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou authored Jul 7, 2020
2 parents 3d11aac + 6ef5aad commit c37a472
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/unicodeRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const getUnicodeRanges = (codePoints) => {
const ranges = [];
let start, end;

codePoints.sort();
codePoints.sort((a, b) => a - b);

for (let i = 0; i < codePoints.length; i++) {
start = codePoints[i];
Expand Down
2 changes: 1 addition & 1 deletion test/downloadGoogleFonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('downloadGoogleFonts', () => {
` font-family: 'Roboto';`,
` font-weight: 400;`,
` font-style: normal;`,
` unicode-range: U+0,U+64-7E,U+D,U+A0-FF,U+131,U+20-21,U+152-153,U+22-47,U+2C6,U+48-49,U+2DA,U+2DC,U+4A-52,U+2013-2014,U+2018-201A,U+201C-201E,U+2022,U+2026,U+2039-203A,U+2044,U+53,U+2074,U+20AC,U+54-57,U+2212,U+58-63;`,
` unicode-range: U+0,U+D,U+20-7E,U+A0-FF,U+131,U+152-153,U+2C6,U+2DA,U+2DC,U+2013-2014,U+2018-201A,U+201C-201E,U+2022,U+2026,U+2039-203A,U+2044,U+2074,U+20AC,U+2212;`,
` font-display: swap;`,
` src: `,
expect
Expand Down
4 changes: 2 additions & 2 deletions test/subsetFonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ describe('subsetFonts', function () {
fontFamilies: expect.it('to be a', Set),
codepoints: {
original: expect.it('to be an array'),
used: [101, 108, 111, 32, 72],
used: [32, 72, 101, 108, 111],
unused: expect.it('to be an array'),
},
},
Expand Down Expand Up @@ -3231,7 +3231,7 @@ describe('subsetFonts', function () {
expect(
originalFontFaceSrcRelation.from.text,
'to contain',
'unicode-range:U+64-7e,U+a0-ff,'
'unicode-range:U+20-7e,U+a0-ff,'
);
});
});
Expand Down
9 changes: 9 additions & 0 deletions test/unicodeRange.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const expect = require('unexpected');
const unicodeRange = require('../lib/unicodeRange');

describe('unicode range', function () {
// https://github.com/Munter/subfont/issues/106
it('should compress into a range', function () {
expect(unicodeRange([0x64, 0x20, 0x62, 0x63]), 'to equal', 'U+20,U+62-64');
});
});

0 comments on commit c37a472

Please sign in to comment.