How to use readTrueTypeCollectionHeader method in wpt

Best JavaScript code snippet using wpt

fonts.js

Source:fonts.js Github

copy

Full Screen

...935 entrySelector: ttf.getUint16(),936 rangeShift: ttf.getUint16()937 };938 }939 function readTrueTypeCollectionHeader(ttc) {940 var ttcTag = (0, _util.bytesToString)(ttc.getBytes(4));941 (0, _util.assert)(ttcTag === 'ttcf', 'Must be a TrueType Collection font.');942 var majorVersion = ttc.getUint16();943 var minorVersion = ttc.getUint16();944 var numFonts = ttc.getInt32() >>> 0;945 var offsetTable = [];946 for (var i = 0; i < numFonts; i++) {947 offsetTable.push(ttc.getInt32() >>> 0);948 }949 var header = {950 ttcTag: ttcTag,951 majorVersion: majorVersion,952 minorVersion: minorVersion,953 numFonts: numFonts,954 offsetTable: offsetTable955 };956 switch (majorVersion) {957 case 1:958 return header;959 case 2:960 header.dsigTag = ttc.getInt32() >>> 0;961 header.dsigLength = ttc.getInt32() >>> 0;962 header.dsigOffset = ttc.getInt32() >>> 0;963 return header;964 }965 throw new _util.FormatError('Invalid TrueType Collection majorVersion: ' + majorVersion + '.');966 }967 function readTrueTypeCollectionData(ttc, fontName) {968 var _readTrueTypeCollecti = readTrueTypeCollectionHeader(ttc),969 numFonts = _readTrueTypeCollecti.numFonts,970 offsetTable = _readTrueTypeCollecti.offsetTable;971 for (var i = 0; i < numFonts; i++) {972 ttc.pos = (ttc.start || 0) + offsetTable[i];973 var potentialHeader = readOpenTypeHeader(ttc);974 var potentialTables = readTables(ttc, potentialHeader.numTables);975 if (!potentialTables['name']) {976 throw new _util.FormatError('TrueType Collection font must contain a "name" table.');977 }978 var nameTable = readNameTable(potentialTables['name']);979 for (var j = 0, jj = nameTable.length; j < jj; j++) {980 for (var k = 0, kk = nameTable[j].length; k < kk; k++) {981 var nameEntry = nameTable[j][k];982 if (nameEntry && nameEntry.replace(/\s/g, '') === fontName) {...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptt = require('wptt');2var fs = require('fs');3var buffer = fs.readFileSync('test.ttf');4var font = new wptt(buffer);5console.log(font.readTrueTypeCollectionHeader());6### readTrueTypeCollectionHeader()7{8}9### readTrueTypeCollectionEntry()10{11}12### readTableDirectory()13{14 {15 },16 {17 },18 {19 },20 {21 },22 {23 },24 {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptt = require('wptt');2var fs = require('fs');3var file = fs.readFileSync('test.ttf');4var buffer = new Buffer(file);5var header = wptt.readTrueTypeCollectionHeader(buffer);6console.log(header);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptt = require('wptt');2var fs = require('fs');3var path = require('path');4var file = fs.readFileSync(path.join(__dirname, 'test.ttf'));5var buffer = new Buffer(file);6var header = wptt.readTrueTypeCollectionHeader(buffer);7console.log(header);8{ 9}10### readTrueTypeHeader(buffer)11var wptt = require('wptt');12var fs = require('fs');13var path = require('path');14var file = fs.readFileSync(path.join(__dirname, 'test.ttf'));15var buffer = new Buffer(file);16var header = wptt.readTrueTypeHeader(buffer);17console.log(header);18{ 19}20### readTableDirectoryEntry(buffer)21var wptt = require('wptt');22var fs = require('fs');23var path = require('path');24var file = fs.readFileSync(path.join(__dirname, 'test.ttf'));25var buffer = new Buffer(file);26var entry = wptt.readTableDirectoryEntry(buffer);27console.log(entry);28{ 29}30### readCmapTable(buffer)

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var fs = require('fs');3var buffer = fs.readFileSync('test.ttf');4var header = wpt.readTrueTypeCollectionHeader(buffer);5console.log(header);6[MIT License](LICENSE)

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptt = require('wptt');2const fs = require('fs');3const ttc = fs.readFileSync('test.ttc');4const wpttObj = new wptt();5const header = wpttObj.readTrueTypeCollectionHeader(ttc);6console.log(header);7{ version: '1.0',8 [ { sfntVersion: '0x00010000',9 tableDirectory: [Object] },10 { sfntVersion: '0x00010000',11 tableDirectory: [Object] } ] }12## readTrueTypeHeader(ttf)13const wptt = require('wptt');14const fs = require('fs');15const ttf = fs.readFileSync('test.ttf');16const wpttObj = new wptt();17const header = wpttObj.readTrueTypeHeader(ttf);18console.log(header);19{ version: '1.0',20 [ { sfntVersion: '0x00010000',21 tableDirectory: [Object] },22 { sfntVersion: '0x000

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptt = require('wptt');2const fs = require('fs');3let fontData = fs.readFileSync('test.ttf');4let header = wptt.readTrueTypeCollectionHeader(fontData);5console.log(header);6{ sfntVersion: 1953784678,7 offsetTable: [ { tag: 'ttcf', checkSum: 0, offset: 12 } ] }

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful