Socket
Socket
Sign inDemoInstall

opentype.js

Package Overview
Dependencies
2
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.1 to 1.3.2

2

package.json
{
"name": "opentype.js",
"description": "OpenType font parser",
"version": "1.3.1",
"version": "1.3.2",
"author": {

@@ -6,0 +6,0 @@ "name": "Frederik De Bleser",

@@ -11,2 +11,3 @@

========
* Create a bézier path out of a piece of text.

@@ -29,4 +30,10 @@ * Support for composite glyphs (accented letters).

var opentype = require('opentype.js');
const opentype = require('opentype.js');
import opentype from 'opentype.js'
import { load } from 'opentype.js'
Using TypeScript? [See this example](examples/typescript)
Note: OpenType.js uses ES6-style imports, so if you want to edit it and debug it in Node.js run `npm run build` first and use `npm run watch` to automatically rebuild when files change.

@@ -69,3 +76,3 @@

// Now let's display it on a canvas with id "canvas"
var ctx = document.getElementById('canvas').getContext('2d');
const ctx = document.getElementById('canvas').getContext('2d');

@@ -75,3 +82,3 @@ // Construct a Path object containing the letter shapes of the given text.

// Note that y is the position of the baseline.
var path = font.getPath('Hello, World!', 0, 150, 72);
const path = font.getPath('Hello, World!', 0, 150, 72);

@@ -98,3 +105,3 @@ // If you just want to draw the text you can also use font.draw(ctx, text, x, y, fontSize).

var font = opentype.parse(myBuffer);
const font = opentype.parse(myBuffer);

@@ -105,3 +112,3 @@ ### Loading a font synchronously (Node.js)

var font = opentype.loadSync('fonts/Roboto-Black.ttf');
const font = opentype.loadSync('fonts/Roboto-Black.ttf');

@@ -117,3 +124,3 @@ ### Writing a font

// Note that the .notdef glyph is required.
var notdefGlyph = new opentype.Glyph({
const notdefGlyph = new opentype.Glyph({
name: '.notdef',

@@ -125,7 +132,7 @@ unicode: 0,

var aPath = new opentype.Path();
const aPath = new opentype.Path();
aPath.moveTo(100, 0);
aPath.lineTo(100, 700);
// more drawing instructions...
var aGlyph = new opentype.Glyph({
const aGlyph = new opentype.Glyph({
name: 'A',

@@ -137,4 +144,4 @@ unicode: 65,

var glyphs = [notdefGlyph, aGlyph];
var font = new opentype.Font({
const glyphs = [notdefGlyph, aGlyph];
const font = new opentype.Font({
familyName: 'OpenTypeSans',

@@ -141,0 +148,0 @@ styleName: 'Medium',

@@ -1,3 +0,7 @@

1.3.1 (April 13, 2020)
1.3.2 (April 20, 2020)
=====================
* Re-export named exports with a default export and add a TypeScript import example
* 1.3.1 (April 13, 2020)
=====================
* Revert Fix Path.toPathData and Path.toSVG - X Axis is flipped (#369)

@@ -4,0 +8,0 @@

import * as opentype from './opentype.js';
export default opentype;
export * from './opentype.js';

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc