Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fontkit

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fontkit - npm Package Compare versions

Comparing version 1.7.4 to 1.7.5

2

package.json
{
"name": "fontkit",
"version": "1.7.4",
"version": "1.7.5",
"description": "An advanced font engine for Node and the browser",

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

@@ -9,3 +9,3 @@ import BBox from '../glyph/BBox';

export default class GlyphRun {
constructor(glyphs, features, script, language) {
constructor(glyphs, features, script, language, direction) {
/**

@@ -37,6 +37,7 @@ * An array of Glyph objects in the run

/**
* The directionality of the requested script (either ltr or rtl).
* The direction requested for shaping, as passed in (either ltr or rtl).
* If `null`, the default direction of the script is used.
* @type {string}
*/
this.direction = Script.direction(script);
this.direction = direction || Script.direction(script);

@@ -43,0 +44,0 @@ /**

@@ -26,7 +26,8 @@ import KernProcessor from './KernProcessor';

layout(string, features, script, language) {
layout(string, features, script, language, direction) {
// Make the features parameter optional
if (typeof features === 'string') {
direction = language;
language = script;
script = features;
language = script;
features = [];

@@ -57,3 +58,3 @@ }

let glyphRun = new GlyphRun(glyphs, features, script, language);
let glyphRun = new GlyphRun(glyphs, features, script, language, direction);

@@ -60,0 +61,0 @@ // Return early if there are no glyphs

@@ -31,10 +31,15 @@ import ShapingPlan from './ShapingPlan';

// Select a script based on what is available in GSUB/GPOS.
let script = this.GSUBProcessor
? this.GSUBProcessor.selectScript(glyphRun.script, glyphRun.language)
: this.GPOSProcessor.selectScript(glyphRun.script, glyphRun.language);
let script = null;
if (this.GPOSProcessor) {
script = this.GPOSProcessor.selectScript(glyphRun.script, glyphRun.language, glyphRun.direction);
}
if (this.GSUBProcessor) {
script = this.GSUBProcessor.selectScript(glyphRun.script, glyphRun.language, glyphRun.direction);
}
// Choose a shaper based on the script, and setup a shaping plan.
// This determines which features to apply to which glyphs.
this.shaper = Shapers.choose(script);
this.plan = new ShapingPlan(this.font, script);
this.plan = new ShapingPlan(this.font, script, glyphRun.direction);
this.shaper.plan(this.plan, this.glyphInfos, glyphRun.features);

@@ -41,0 +46,0 @@

@@ -55,3 +55,3 @@ import GlyphIterator from './GlyphIterator';

selectScript(script, language) {
selectScript(script, language, direction) {
let changed = false;

@@ -71,3 +71,2 @@ let entry;

this.script = entry.script;
this.direction = Script.direction(script);
this.language = null;

@@ -78,2 +77,6 @@ this.languageTag = null;

if (!direction || direction !== this.direction) {
this.direction = direction || Script.direction(script);
}
if (!language || language !== this.languageTag) {

@@ -80,0 +83,0 @@ this.language = null;

@@ -13,6 +13,6 @@ import * as Script from '../layout/Script';

export default class ShapingPlan {
constructor(font, script) {
constructor(font, script, direction) {
this.font = font;
this.script = script;
this.direction = Script.direction(script);
this.direction = direction;
this.stages = [];

@@ -108,4 +108,2 @@ this.globalFeatures = {};

process(processor, glyphs, positions) {
processor.selectScript(this.script, this.language);
for (let stage of this.stages) {

@@ -112,0 +110,0 @@ if (typeof stage === 'function') {

@@ -342,6 +342,7 @@ import r from 'restructure';

* @param {string} [language]
* @param {string} [direction]
* @return {GlyphRun}
*/
layout(string, userFeatures, script, language) {
return this._layoutEngine.layout(string, userFeatures, script, language);
layout(string, userFeatures, script, language, direction) {
return this._layoutEngine.layout(string, userFeatures, script, language, direction);
}

@@ -348,0 +349,0 @@

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc