How to use readCmapTable method in wpt

Best JavaScript code snippet using wpt

ttf.ts

Source:ttf.ts Github

copy

Full Screen

...382 }383 }384 const head = readHeadTable(reader, tables['head'].offset);385 const name = readNameTable(reader, tables['name'].offset);386 const { glyphIndexMap, ...cmap } = readCmapTable(387 reader,388 tables['cmap'].offset,389 );390 const maxp = readMaxpTable(reader, tables['maxp'].offset);391 const loca = readLocaTable(392 reader,393 tables['loca'].offset,394 maxp.numGlyphs,395 head.indexToLocFormat,396 );397 const hhea = readHheaTable(reader, tables['hhea'].offset);398 const hmtx = readHmtxTable(399 reader,400 tables['hmtx'].offset,...

Full Screen

Full Screen

ttf-reader.d.ts

Source:ttf-reader.d.ts Github

copy

Full Screen

1/**2 * TtfReader.ts class for EJ2-PDF3 */4import { TtfTableInfo } from './ttf-table-info';5import { Dictionary } from './../../collections/dictionary';6import { TtfMetrics } from './ttf-metrics';7import { TtfGlyphInfo } from './ttf-glyph-info';8export declare class TtfReader {9 private fontData;10 private readonly int32Size;11 private offset;12 tableDirectory: Dictionary<string, TtfTableInfo>;13 private isTtcFont;14 private isMacTtf;15 private lowestPosition;16 private metricsName;17 metrics: TtfMetrics;18 private maxMacIndex;19 private isFontPresent;20 private isMacTTF;21 private missedGlyphs;22 private tableNames;23 private entrySelectors;24 /**25 * Width table.26 */27 private width;28 /**29 * Indicates whether loca table is short.30 */31 bIsLocaShort: boolean;32 /**33 * Glyphs for Macintosh or Symbol fonts.34 */35 private macintoshDictionary;36 /**37 * Glyphs for Microsoft or Symbol fonts.38 */39 private microsoftDictionary;40 /**41 * Glyphs for Macintosh or Symbol fonts (glyph index - key, glyph - value).42 */43 private internalMacintoshGlyphs;44 /**45 * Glyphs for Microsoft or Symbol fonts (glyph index - key, glyph - value).46 */47 private internalMicrosoftGlyphs;48 /**49 * Gets glyphs for Macintosh or Symbol fonts (char - key, glyph - value).50 */51 private readonly macintosh;52 /**53 * Gets glyphs for Microsoft or Symbol fonts (char - key, glyph - value).54 */55 private readonly microsoft;56 /**57 * Gets glyphs for Macintosh or Symbol fonts (glyph index - key, glyph - value).58 */59 private readonly macintoshGlyphs;60 /**61 * Gets glyphs for Microsoft Unicode fonts (glyph index - key, glyph - value).62 */63 private readonly microsoftGlyphs;64 constructor(fontData: Uint8Array);65 private initialize;66 private readFontDictionary;67 private fixOffsets;68 private checkPreambula;69 private readNameTable;70 private readHeadTable;71 private readHorizontalHeaderTable;72 private readOS2Table;73 private readPostTable;74 /**75 * Reads Width of the glyphs.76 */77 private readWidthTable;78 /**79 * Reads the cmap table.80 */81 private readCmapTable;82 /**83 * Reads the cmap sub table.84 */85 private readCmapSubTable;86 /**87 * Reads Symbol cmap table.88 */89 private readAppleCmapTable;90 /**91 * Reads Symbol cmap table.92 */93 private readMicrosoftCmapTable;94 /**95 * Reads Trimed cmap table.96 */97 private readTrimmedCmapTable;98 private initializeFontName;99 private getTable;100 /**101 * Returns width of the glyph.102 */103 private getWidth;104 /**105 * Gets CMAP encoding based on platform ID and encoding ID.106 */107 private getCmapEncoding;108 /**109 * Adds glyph to the collection.110 */111 private addGlyph;112 /**113 * Initializes metrics.114 */115 private initializeMetrics;116 /**117 * Updates chars structure which is used in the case of ansi encoding (256 bytes).118 */119 private updateWidth;120 /**121 * Returns default glyph.122 */123 private getDefaultGlyph;124 /**125 * Reads unicode string from byte array.126 */127 private getString;128 /**129 * Reads loca table.130 */131 private readLocaTable;132 /**133 * Updates hash table of used glyphs.134 */135 private updateGlyphChars;136 /**137 * Checks if glyph is composite or not.138 */139 private processCompositeGlyph;140 /**141 * Creates new glyph tables based on chars that are used for output.142 */143 private generateGlyphTable;144 /**145 * Updates new Loca table.146 */147 private updateLocaTable;148 /**149 * Aligns number to be divisible on 4.150 */151 private align;152 /**153 * Returns font program data.154 */155 private getFontProgram;156 private getFontProgramLength;157 /**158 * Writing to destination buffer - checksums and sizes of used tables.159 */160 private writeCheckSums;161 /**162 * Gets checksum from source buffer.163 */164 private calculateCheckSum;165 /**166 * Writing to destination buffer - used glyphs.167 */168 private writeGlyphs;169 /**170 * Sets position value of font data.171 */172 setOffset(offset: number): void;173 /**174 * Creates font Internals175 * @private176 */177 createInternals(): void;178 /**179 * Gets glyph's info by char code.180 */181 getGlyph(charCode: string): TtfGlyphInfo;182 getGlyph(charCode: number): TtfGlyphInfo;183 /**184 * Gets hash table with chars indexed by glyph index.185 */186 getGlyphChars(chars: Dictionary<string, string>): Dictionary<number, number>;187 /**188 * Gets all glyphs.189 */190 getAllGlyphs(): TtfGlyphInfo[];191 /**192 * Reads a font's program.193 * @private194 */195 readFontProgram(chars: Dictionary<string, string>): number[];196 /**197 * Reconverts string to be in proper format saved into PDF file.198 */199 convertString(text: string): string;200 /**201 * Gets char width.202 */203 getCharWidth(code: string): number;204 private readString;205 private readFixed;206 private readInt32;207 private readUInt32;208 private readInt16;209 private readInt64;210 private readUInt16;211 /**212 * Reads ushort array.213 */214 private readUshortArray;215 private readBytes;216 private readByte;217 /**218 * Reads bytes to array in BigEndian order.219 * @private220 */221 read(buffer: number[], index: number, count: number): {222 buffer: number[];223 written: number;224 };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var path = require('path');3var cmapPath = path.join(__dirname, 'cmap.txt');4var cmapTable = wpt.readCmapTable(cmapPath);5console.log(cmapTable);6var wpt = require('wpt');7var path = require('path');8var cmapPath = path.join(__dirname, 'cmap.txt');9var cmapTable = wpt.readCmapTable(cmapPath);10wpt.writeCmapTable(cmapTable, 'cmap.json');11{12 {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('./wptools.js');2var fs = require('fs');3var buffer = fs.readFileSync('test.cmap');4var cmap = wptools.readCmapTable(buffer);5console.log(cmap);6var wptools = {};7wptools.readCmapTable = function(buffer) {8 var cmap = {};9 var offset = 0;10 cmap.version = buffer.readUInt16BE(offset);11 offset += 2;12 cmap.numTables = buffer.readUInt16BE(offset);13 offset += 2;14 cmap.tables = [];15 for (var i = 0; i < cmap.numTables; i++) {16 var table = {};17 table.platformID = buffer.readUInt16BE(offset);18 offset += 2;19 table.platformSpecificID = buffer.readUInt16BE(offset);20 offset += 2;21 table.offset = buffer.readUInt32BE(offset);22 offset += 4;23 cmap.tables.push(table);24 }25 return cmap;26};27module.exports = wptools;

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2wptools.readCmapTable('cmap', function (err, table) {3 if (err) {4 console.log(err);5 } else {6 console.log(table);7 }8});9var wptools = require('wptools');10var table = { ... };11wptools.writeCmapTable('cmap', table, function (err) {12 if (err) {13 console.log(err);14 } else {15 console.log('cmap table written successfully');16 }17});18### readCmapTable(filepath, callback)19wptools.readCmapTable('cmap', function (err, table) {20 if (err) {21 console.log(err);22 } else {23 console.log(table);24 }25});26### writeCmapTable(filepath, table, callback)27var table = { ... };28wptools.writeCmapTable('cmap', table, function (err) {29 if (err) {30 console.log(err);31 } else {32 console.log('cmap table written successfully');33 }34});35[MIT](LICENSE)

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wp-tools');2var fs = require('fs');3var path = require('path');4var filePath = path.join(__dirname, 'cmap.txt');5var cmapTable = wptools.readCmapTable(filePath);6console.log(cmapTable);7{ version: 0,8 [ { platformID: 3,

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptextlayout = require('wptextlayout');2var fs = require('fs');3var cmapTable = wptextlayout.readCmapTable(fs.readFileSync('path to cmap file'));4console.log(cmapTable);5var wptextlayout = require('wptextlayout');6var fs = require('fs');7var cmapTable = wptextlayout.readCmapTable(fs.readFileSync('path to cmap file'));8console.log(cmapTable);9var wptextlayout = require('wptextlayout');10var fs = require('fs');11var cmapTable = wptextlayout.readCmapTable(fs.readFileSync('path to cmap file'));12console.log(cmapTable);13var wptextlayout = require('wptextlayout');14var fs = require('fs');15var cmapTable = wptextlayout.readCmapTable(fs.readFileSync('path to cmap file'));16console.log(cmapTable);17var wptextlayout = require('wptextlayout');18var fs = require('fs');19var cmapTable = wptextlayout.readCmapTable(fs.readFileSync('path to cmap file'));20console.log(cmapTable);21var wptextlayout = require('wptextlayout');22var fs = require('fs');23var cmapTable = wptextlayout.readCmapTable(fs.readFileSync('path to cmap file'));24console.log(cmapTable);25var wptextlayout = require('wptextlayout');26var fs = require('fs');27var cmapTable = wptextlayout.readCmapTable(fs.readFileSync('path to cmap file'));28console.log(cmapTable);29var wptextlayout = require('wptextlayout');30var fs = require('fs');31var cmapTable = wptextlayout.readCmapTable(fs.readFileSync('path to cmap file'));32console.log(cmapTable);33var wptextlayout = require('wptextlayout');34var fs = require('fs');35var cmapTable = wptextlayout.readCmapTable(fs.readFileSync('path to cmap file'));36console.log(cmapTable);37var wptextlayout = require('wptextlayout');38var fs = require('fs');39var cmapTable = wptextlayout.readCmapTable(fs.readFileSync('path to cmap file'));40console.log(cmapTable);41var wptextlayout = require('wptextlayout');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var fs = require('fs');3var args = process.argv.slice(2);4var lang = args[0];5var page = args[1];6if (lang && page) {7 var wpt = new wptools(page, lang);8 wpt.readCmapTable(function(cmap) {9 fs.writeFile('cmap.json', JSON.stringify(cmap, null, 4), function(err) {10 if (err) {11 console.log(err);12 } else {13 console.log("cmap.json saved");14 }15 });16 });17} else {18 console.log('Usage: node test.js <lang> <page>');19}20{21 "cmap": {22 }23}24### wptools.readCmapTable(callback)

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