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 0.10.0 to 0.11.0

src/bidi.js

2

bower.json
{
"name": "opentype.js",
"version": "0.10.0",
"version": "0.11.0",
"main": "dist/opentype.js",

@@ -5,0 +5,0 @@ "keywords": [

@@ -13,3 +13,3 @@ # Contributing

1. On our [GitHub page](https://github.com/nodebox/opentype.js), click the "Fork" button to create your personal fork
1. On our [GitHub page](https://github.com/opentypejs/opentype.js), click the "Fork" button to create your personal fork
of the opentype.js repository.

@@ -19,3 +19,3 @@

`git clone git://github.com/nodebox/opentype.js.git`
`git clone git://github.com/opentypejs/opentype.js.git`

@@ -22,0 +22,0 @@ 3. Create a new branch for your feature. For example: `git checkout -b my-awesome-feature`.

{
"name": "opentype.js",
"description": "OpenType font parser",
"version": "0.10.0",
"version": "0.11.0",
"author": {

@@ -21,3 +21,3 @@ "name": "Frederik De Bleser",

"type": "git",
"url": "git://github.com/nodebox/opentype.js.git"
"url": "git://github.com/opentypejs/opentype.js.git"
},

@@ -38,15 +38,15 @@ "main": "dist/opentype.js",

"devDependencies": {
"@babel/preset-env": "^7.0.0-beta.51",
"buble": "^0.19.3",
"@babel/preset-env": "^7.1.0",
"buble": "^0.19.4",
"cross-env": "^5.2.0",
"jscs": "^3.0.7",
"jshint": "^2.9.5",
"jshint": "^2.9.6",
"mocha": "^5.2.0",
"reify": "^0.16.2",
"rollup": "^0.61.1",
"rollup-plugin-buble": "^0.19.2",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-license": "^0.6.0",
"rollup-plugin-node-resolve": "^3.3.0",
"uglify-js": "^3.4.1"
"reify": "^0.18.1",
"rollup": "^0.66.6",
"rollup-plugin-buble": "^0.19.4",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-license": "^0.7.0",
"rollup-plugin-node-resolve": "^3.4.0",
"uglify-js": "^3.4.9"
},

@@ -53,0 +53,0 @@ "browser": {

opentype.js
===========
[![npm](https://img.shields.io/npm/v/opentype.js.svg)](https://www.npmjs.com/package/opentype.js)
[![Build Status](https://travis-ci.org/nodebox/opentype.js.svg?branch=master)](https://travis-ci.org/nodebox/opentype.js)
[![david-dm](https://david-dm.org/nodebox/opentype.js.svg)](https://david-dm.org/nodebox/opentype.js)
[![Gitter](https://badges.gitter.im/nodebox/opentype.js.svg)](https://gitter.im/nodebox/opentype.js)
[![npm](https://img.shields.io/npm/v/opentype.js.svg)](https://www.npmjs.com/package/opentype.js)
[![Build Status](https://travis-ci.org/opentypejs/opentype.js.svg?branch=master)](https://travis-ci.org/opentypejs/opentype.js)
[![david-dm](https://david-dm.org/opentypejs/opentype.js.svg)](https://david-dm.org/opentypejs/opentype.js)
[![Gitter](https://badges.gitter.im/opentypejs/opentype.js.svg)](https://gitter.im/opentypejs/opentype.js)
opentype.js is a JavaScript parser and writer for TrueType and OpenType fonts.
It gives you access to the <strong>letterforms</strong> of text from the browser or node.js.
It gives you access to the <strong>letterforms</strong> of text from the browser or Node.js.
![Example of opentype.js](https://raw.github.com/nodebox/opentype.js/master/g/hello-world.png)
![Example of opentype.js](https://raw.github.com/opentypejs/opentype.js/master/g/hello-world.png)

@@ -40,4 +40,5 @@ Here's an example. We load a font, then display it on a canvas with id "canvas":

* Support for TrueType font hinting.
* Support rendering of arabic (See #359)
* Very efficient.
* Runs in the browser and node.js.
* Runs in the browser and Node.js.

@@ -49,3 +50,3 @@ Installation

[Download the latest ZIP](https://github.com/nodebox/opentype.js/archive/master.zip) and grab the files in the `dist`
[Download the latest ZIP](https://github.com/opentypejs/opentype.js/archive/master.zip) and grab the files in the `dist`
folder. These are compiled.

@@ -68,3 +69,3 @@

<script src="/bower_components/opentype.js/dist/opentype.js"></script>
### Using via a CDN

@@ -298,2 +299,2 @@

* [Adobe Compact Font Format spec](http://download.microsoft.com/download/8/0/1/801a191c-029d-4af3-9642-555f6fe514ee/cff.pdf) and the [Adobe Type 2 Charstring spec](http://download.microsoft.com/download/8/0/1/801a191c-029d-4af3-9642-555f6fe514ee/type2.pdf): explains the data structures and commands for the CFF glyph format.
* All contributing authors mentioned in the [AUTHORS](https://github.com/nodebox/opentype.js/blob/master/AUTHORS) file.
* All contributing authors mentioned in the [AUTHORS](https://github.com/opentypejs/opentype.js/blob/master/AUTHORS) file.

@@ -11,6 +11,5 @@ // The Font object

import HintingTrueType from './hintingtt';
import Bidi from './bidi';
import FeatureQuery from './features/featureQuery';
// This code is based on Array.from implementation for strings in https://github.com/mathiasbynens/Array.from
const arrayFromString = Array.from || (s => s.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g) || []);
/**

@@ -159,9 +158,20 @@ * @typedef FontOptions

options = options || this.defaultRenderOptions;
// Get glyph indexes
const chars = arrayFromString(s);
const indexes = [];
for (let i = 0; i < chars.length; i += 1) {
const c = chars[i];
indexes.push(this.charToGlyphIndex(c));
}
const bidi = new Bidi();
// Create and register 'glyphIndex' state modifier
const charToGlyphIndexMod = token => this.charToGlyphIndex(token.char);
bidi.registerModifier('glyphIndex', null, charToGlyphIndexMod);
const arabFeatureQuery = new FeatureQuery(this);
const arabFeatures = ['init', 'medi', 'fina', 'rlig'];
bidi.applyFeatures(
arabFeatures.map(tag => {
let query = { tag, script: 'arab' };
let feature = arabFeatureQuery.getFeature(query);
if (!!feature) return feature;
})
);
const indexes = bidi.getTextGlyphs(s);
let length = indexes.length;

@@ -168,0 +178,0 @@

// opentype.js
// https://github.com/nodebox/opentype.js
// https://github.com/opentypejs/opentype.js
// (c) 2015 Frederik De Bleser

@@ -4,0 +4,0 @@ // opentype.js may be freely distributed under the MIT license.

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc