Skip to content

Commit

Permalink
Merge ca9614c into 812c754
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Feb 6, 2021
2 parents 812c754 + ca9614c commit 9353d05
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 269 deletions.
36 changes: 0 additions & 36 deletions lib/convertFontBuffer.js

This file was deleted.

18 changes: 0 additions & 18 deletions lib/detectFontFormat.js

This file was deleted.

6 changes: 3 additions & 3 deletions lib/subsetFonts.js
Expand Up @@ -4,6 +4,7 @@ const urltools = require('urltools');

const fontTracer = require('font-tracer');
const fontSnapper = require('font-snapper');
const fontverter = require('fontverter');

const AssetGraph = require('assetgraph');
const compileQuery = require('assetgraph/lib/compileQuery');
Expand All @@ -26,7 +27,6 @@ const unquote = require('./unquote');
const normalizeFontPropertyValue = require('./normalizeFontPropertyValue');
const getCssRulesByProperty = require('./getCssRulesByProperty');
const unicodeRange = require('./unicodeRange');
const convertFontBuffer = require('./convertFontBuffer');

const googleFontsCssUrlRegex = /^(?:https?:)?\/\/fonts\.googleapis\.com\/css/;

Expand Down Expand Up @@ -453,7 +453,7 @@ async function getSubsetsForFontUsage(
fontUsage.subsets = {};
}

const buffer = await convertFontBuffer(
const buffer = await fontverter.convert(
fontAsset.rawSrc,
format,
'truetype'
Expand Down Expand Up @@ -620,7 +620,7 @@ async function createSelfHostedGoogleFontsCssAsset(
});
const srcFragments = [];
for (const format of formats) {
const rawSrc = await convertFontBuffer(cssFontFaceSrc.to.rawSrc, format);
const rawSrc = await fontverter.convert(cssFontFaceSrc.to.rawSrc, format);
const url = `${assetGraph.root}subfont/${
cssFontFaceSrc.to.baseName
}-${md5HexPrefix(rawSrc)}${extensionByFormat[format]}`;
Expand Down
6 changes: 3 additions & 3 deletions lib/subsetLocalFontWithHarfbuzz.js
Expand Up @@ -2,7 +2,7 @@
const fs = require('fs');
const readFileAsync = require('util').promisify(fs.readFile);
const _ = require('lodash');
const convertFontBuffer = require('./convertFontBuffer');
const fontverter = require('fontverter');

function HB_TAG(chunkName) {
return chunkName.split('').reduce(function (a, ch) {
Expand All @@ -25,7 +25,7 @@ const loadAndInitializeHarfbuzz = _.once(async () => {
async function subset(originalFont, targetFormat, text) {
const [exports, heapu8] = await loadAndInitializeHarfbuzz();

originalFont = await convertFontBuffer(originalFont, 'truetype');
originalFont = await fontverter.convert(originalFont, 'truetype');

const fontBuffer = exports.malloc(originalFont.byteLength);
heapu8.set(new Uint8Array(originalFont), fontBuffer);
Expand Down Expand Up @@ -81,7 +81,7 @@ async function subset(originalFont, targetFormat, text) {
exports.hb_blob_destroy(result);
exports.hb_face_destroy(subset);

return await convertFontBuffer(subsetFont, targetFormat, 'truetype');
return await fontverter.convert(subsetFont, targetFormat, 'truetype');
}

const limiter = require('p-limit')(1);
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -56,6 +56,7 @@
"font-snapper": "^1.2.0",
"font-tracer": "^2.0.1",
"fontkit": "^1.8.0",
"fontverter": "^1.0.0",
"gettemporaryfilepath": "^1.0.1",
"harfbuzzjs": "^0.1.3",
"lines-and-columns": "^1.1.6",
Expand All @@ -68,8 +69,6 @@
"puppeteer-core": "^3.1.0",
"specificity": "^0.4.1",
"urltools": "^0.4.1",
"wawoff2": "^1.0.2",
"woff2sfnt-sfnt2woff": "^1.0.0",
"yargs": "^15.4.0"
},
"devDependencies": {
Expand Down
153 changes: 0 additions & 153 deletions test/convertFontBuffer.js

This file was deleted.

54 changes: 0 additions & 54 deletions test/detectFontFormat.js

This file was deleted.

0 comments on commit 9353d05

Please sign in to comment.