How to use CFFFont method in wpt

Best JavaScript code snippet using wpt

subset.js

Source:subset.js Github

copy

Full Screen

...61 let buf = subset.encode();62 let stream = new r.DecodeStream(buf);63 let CFFFont = font._tables['CFF '].constructor;64 let CFFGlyph = iterable[0].constructor;65 let cff = new CFFFont(stream);66 let glyph = new CFFGlyph(1, [], { stream, 'CFF ': cff });67 assert.equal(glyph.path.toSVG(), font.glyphsForString('h')[0].path.toSVG());68 });69 it('should handle CID fonts', function () {70 let f = fontkit.openSync(new URL('data/NotoSansCJK/NotoSansCJKkr-Regular.otf', import.meta.url));71 let subset = f.createSubset();72 let iterable = f.glyphsForString('갈휸');73 for (let i = 0; i < iterable.length; i++) {74 let glyph = iterable[i];75 subset.includeGlyph(glyph);76 }77 let buf = subset.encode();78 let stream = new r.DecodeStream(buf);79 let CFFFont = font._tables['CFF '].constructor;80 let CFFGlyph = iterable[0].constructor;81 let cff = new CFFFont(stream);82 let glyph = new CFFGlyph(1, [], { stream, 'CFF ': cff });83 assert.equal(glyph.path.toSVG(), f.glyphsForString('갈')[0].path.toSVG());84 assert.equal(cff.topDict.FDArray.length, 2);85 assert.deepEqual(cff.topDict.FDSelect.fds, [0, 1, 1]);86 });87 it('should produce a subset with asian punctuation corretly', function () {88 const koreanFont = fontkit.openSync(new URL('data/NotoSansCJK/NotoSansCJKkr-Regular.otf', import.meta.url));89 const subset = koreanFont.createSubset();90 const iterable = koreanFont.glyphsForString('a。d');91 for (let i = 0; i < iterable.length; i++) {92 const glyph = iterable[i];93 subset.includeGlyph(glyph);94 }95 let buf = subset.encode();96 const stream = new r.DecodeStream(buf);97 let CFFFont = font._tables['CFF '].constructor;98 let CFFGlyph = iterable[0].constructor;99 const cff = new CFFFont(stream);100 let glyph = new CFFGlyph(1, [], { stream, 'CFF ': cff });101 assert.equal(glyph.path.toSVG(), koreanFont.glyphsForString('a')[0].path.toSVG());102 glyph = new CFFGlyph(2, [], { stream, 'CFF ': cff });103 assert.equal(glyph.path.toSVG(), koreanFont.glyphsForString('。')[0].path.toSVG());104 glyph = new CFFGlyph(3, [], { stream, 'CFF ': cff });105 assert.equal(glyph.path.toSVG(), koreanFont.glyphsForString('d')[0].path.toSVG());106 });107 });...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1let tables = {};2export default tables;3// Required Tables4import cmap from './cmap';5import head from './head';6import hhea from './hhea';7import hmtx from './hmtx';8import maxp from './maxp';9import name from './name';10import OS2 from './OS2';11import post from './post';12tables.cmap = cmap;13tables.head = head;14tables.hhea = hhea;15tables.hmtx = hmtx;16tables.maxp = maxp;17tables.name = name;18tables['OS/2'] = OS2;19tables.post = post;20// TrueType Outlines21import cvt from './cvt';22import fpgm from './fpgm';23import loca from './loca';24import prep from './prep';25import glyf from './glyf';26tables.fpgm = fpgm;27tables.loca = loca;28tables.prep = prep;29tables['cvt '] = cvt;30tables.glyf = glyf;31// PostScript Outlines32import CFFFont from '../cff/CFFFont';33import VORG from './VORG';34tables['CFF '] = CFFFont;35tables['CFF2'] = CFFFont;36tables.VORG = VORG;37// Bitmap Glyphs38import EBLC from './EBLC';39import sbix from './sbix';40import COLR from './COLR';41import CPAL from './CPAL';42tables.EBLC = EBLC;43tables.CBLC = tables.EBLC;44tables.sbix = sbix;45tables.COLR = COLR;46tables.CPAL = CPAL;47// Advanced OpenType Tables48import BASE from './BASE';49import GDEF from './GDEF';50import GPOS from './GPOS';51import GSUB from './GSUB';52import JSTF from './JSTF';53tables.BASE = BASE;54tables.GDEF = GDEF;55tables.GPOS = GPOS;56tables.GSUB = GSUB;57tables.JSTF = JSTF;58// OpenType variations tables59import HVAR from './HVAR';60tables.HVAR = HVAR;61// Other OpenType Tables62import DSIG from './DSIG';63import gasp from './gasp';64import hdmx from './hdmx';65import kern from './kern';66import LTSH from './LTSH';67import PCLT from './PCLT';68import VDMX from './VDMX';69import vhea from './vhea';70import vmtx from './vmtx';71tables.DSIG = DSIG;72tables.gasp = gasp;73tables.hdmx = hdmx;74tables.kern = kern;75tables.LTSH = LTSH;76tables.PCLT = PCLT;77tables.VDMX = VDMX;78tables.vhea = vhea;79tables.vmtx = vmtx;80// Apple Advanced Typography Tables81import avar from './avar';82import bsln from './bsln';83import feat from './feat';84import fvar from './fvar';85import gvar from './gvar';86import just from './just';87import morx from './morx';88import opbd from './opbd';89tables.avar = avar;90tables.bsln = bsln;91tables.feat = feat;92tables.fvar = fvar;93tables.gvar = gvar;94tables.just = just;95tables.morx = morx;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var fs = require('fs');3var pdf = require('html-pdf');4var html = '<h1>Test PDF</h1>';5var options = { format: 'Letter' };6pdf.create(html, options).toFile('./businesscard.pdf', function(err, res) {7 if (err) return console.log(err);8});9var pdf = require('html-pdf');10var html = '<h1>Test PDF</h1>';11var options = { format: 'Letter' };12pdf.create(html, options).toFile('./businesscard.pdf', function(err, res) {13 if (err) return console.log(err);14});15var pdf = require('html-pdf');16var html = '<h1>Test PDF</h1>';17var options = { format: 'Letter' };18pdf.create(html, options).toFile('./businesscard.pdf', function(err, res) {19 if (err) return console.log(err);20});21var pdf = require('html-pdf');22var html = '<h1>Test PDF</h1>';23var options = { format: 'Letter' };24pdf.create(html, options).toFile('./businesscard.pdf', function(err, res) {25 if (err) return console.log(err);26});27var pdf = require('html-pdf');28var html = '<h1>Test PDF</h1>';29var options = { format: 'Letter' };30pdf.create(html, options).toFile('./businesscard.pdf', function(err, res) {31 if (err) return console.log(err);32});33var pdf = require('html-pdf');34var html = '<h1>Test PDF</h1>';35var options = { format: 'Letter

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var fs = require('fs');3var font = new wptools.CFFFont(fs.readFileSync('font.otf'));4var c = font.charToGlyph('a');5console.log(c);6console.log(c.contours);7console.log(c.contours[0]);8console.log(c.contours[0].points);9console.log(c.contours[0].points[0]);10console.log(c.contours[0].points[0].x);11console.log(c.contours[0].points[0].y);

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2 if (err) {3 console.log(err);4 } else {5 console.log(font);6 }7});8const wptools = require('wptools');9 if (err) {10 console.log(err);11 } else {12 console.log(font);13 }14});15const wptools = require('wptools');16 if (err) {17 console.log(err);18 } else {19 console.log(font);20 }21});22const wptools = require('wptools');23 if (err) {24 console.log(err);25 } else {26 console.log(font);27 }28});29const wptools = require('wptools');30 if (err) {31 console.log(err);32 } else {33 console.log(font);34 }35});36const wptools = require('wptools');37 if (err) {38 console.log(err);39 } else {40 console.log(font);41 }42});43const wptools = require('wptools');44 if (err) {45 console.log(err);46 } else {47 console.log(font);48 }49});50const wptools = require('wptools');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var font = new wptools.CFFFont();3font.load('font.cff', function() {4 console.log(font);5});6var wptools = require('wptools');7var font = new wptools.CFFFont();8font.load('font.cff', function() {9 console.log(font);10});11var wptools = require('wptools');12var font = new wptools.CFFFont();13font.load('font.cff', function() {14 console.log(font);15});16var wptools = require('wptools');17var font = new wptools.CFFFont();18font.load('font.cff', function() {19 console.log(font);20});21var wptools = require('wptools');22var font = new wptools.CFFFont();23font.load('font.cff', function() {24 console.log(font);25});26var wptools = require('wptools');27var font = new wptools.CFFFont();28font.load('font.cff', function() {29 console.log(font);30});31var wptools = require('wptools');32var font = new wptools.CFFFont();33font.load('font.cff', function() {34 console.log(font);35});36var wptools = require('wptools');37var font = new wptools.CFFFont();38font.load('font.cff', function() {39 console.log(font);40});41var wptools = require('wptools');42var font = new wptools.CFFFont();43font.load('font.cff', function() {44 console.log(font);45});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptext = require('wptext');2var cff = new wptext.CFFFont();3cff.loadFromFile('test.cff');4console.log(cff.fontName());5console.log(cff.fontVersion());6console.log(cff.notice());7console.log(cff.fullName());8console.log(cff.familyName());9console.log(cff.weight());10console.log(cff.boundingBox());11console.log(cff.italicAngle());12console.log(cff.isFixedPitch());13console.log(cff.underlinePosition());14console.log(cff.underlineThickness());15console.log(cff.charSet());16console.log(cff.encoding());17console.log(cff.charStrings());18console.log(cff.charStringWidth('A'));19console.log(cff.charStringWidth('B'));20console.log(cff.charStringWidth('C'));21console.log(cff.charStringWidth('D'));22console.log(cff.charStringWidth('E'));23console.log(cff.charStringWidth('F'));24console.log(cff.charStringWidth('G'));25console.log(cff.charStringWidth('H'));26console.log(cff.charStringWidth('I'));27console.log(cff.charStringWidth('J'));28console.log(cff.charStringWidth('K'));29console.log(cff.charStringWidth('L'));30console.log(cff.charStringWidth('M'));31console.log(cff.charStringWidth('N'));

Full Screen

Using AI Code Generation

copy

Full Screen

1var font = new CFFFont("fonts/Roboto-Regular.ttf");2var glyph = font.getGlyph(0x61);3var glyph2 = font.getGlyph(0x62);4var glyph3 = font.getGlyph(0x63);5var glyph4 = font.getGlyph(0x64);6var glyph5 = font.getGlyph(0x65);7var glyph6 = font.getGlyph(0x66);8var glyph7 = font.getGlyph(0x67);9var glyph8 = font.getGlyph(0x68);10var glyph9 = font.getGlyph(0x69);11var glyph10 = font.getGlyph(0x6A);12var glyph11 = font.getGlyph(0x6B);13var glyph12 = font.getGlyph(0x6C);14var glyph13 = font.getGlyph(0x6D);15var glyph14 = font.getGlyph(0x6E);16var glyph15 = font.getGlyph(0x6F);17var glyph16 = font.getGlyph(0x70);18var glyph17 = font.getGlyph(0x71);19var glyph18 = font.getGlyph(0x72);20var glyph19 = font.getGlyph(0x73);21var glyph20 = font.getGlyph(0x74);22var glyph21 = font.getGlyph(0x75);23var glyph22 = font.getGlyph(0x76);24var glyph23 = font.getGlyph(0x77);25var glyph24 = font.getGlyph(0x78);26var glyph25 = font.getGlyph(0x79);27var glyph26 = font.getGlyph(0x7A);28var glyph27 = font.getGlyph(0x20);29var glyph28 = font.getGlyph(0x21);30var glyph29 = font.getGlyph(0x22);31var glyph30 = font.getGlyph(0x23);32var glyph31 = font.getGlyph(0x24);33var glyph32 = font.getGlyph(0x25);34var glyph33 = font.getGlyph(0x26);35var glyph34 = font.getGlyph(0x27);36var glyph35 = font.getGlyph(0x28);37var glyph36 = font.getGlyph(0x29);38var glyph37 = font.getGlyph(0x2A);39var glyph38 = font.getGlyph(0x2B);40var glyph39 = font.getGlyph(0x2C);

Full Screen

Using AI Code Generation

copy

Full Screen

1var font = new CFFFont('Courier');2var doc = new PDFDocument({font: font});3doc.text('Hello World!');4doc.end();5var font = new CFFFont('Helvetica');6var doc = new PDFDocument({font: font});7doc.text('Hello World!');8doc.end();9var font = new CFFFont('Times-Roman');10var doc = new PDFDocument({font: font});11doc.text('Hello World!');12doc.end();13var font = new CFFFont('Times-Bold');14var doc = new PDFDocument({font: font});15doc.text('Hello World!');16doc.end();17var font = new CFFFont('Times-Italic');18var doc = new PDFDocument({font: font});19doc.text('Hello World!');20doc.end();21var font = new CFFFont('Times-BoldItalic');22var doc = new PDFDocument({font: font});23doc.text('Hello World!');24doc.end();25var font = new CFFFont('ZapfDingbats');26var doc = new PDFDocument({font: font});27doc.text('Hello World!');28doc.end();29var font = new CFFFont('Symbol');30var doc = new PDFDocument({font: font});31doc.text('Hello World!');32doc.end();33var font = new CFFFont('Courier-Bold');34var doc = new PDFDocument({font: font});35doc.text('Hello World!');36doc.end();37var font = new CFFFont('Courier-Oblique');

Full Screen

Using AI Code Generation

copy

Full Screen

1var fs = require('fs');2var pdf = require('wptext2pdf');3var font = new pdf.CFFFont('Arial');4font.size = 10;5font.color = 'black';6pdf.addFont(font);7pdf.addPage();8pdf.write('test.pdf', 'This is a test');9var fs = require('fs');10var pdf = require('wptext2pdf');11var font = new pdf.CFFFont('Arial');12font.size = 10;13font.color = 'black';14pdf.addFont(font);15pdf.addPage();16pdf.write('test.pdf', fs.readFileSync('test.html', 'utf8'));

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