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

@react-pdf/fontkit

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-pdf/fontkit - npm Package Compare versions

Comparing version 1.11.0 to 1.12.0

7

package.json
{
"name": "@react-pdf/fontkit",
"version": "1.11.0",
"version": "1.12.0",
"description": "An advanced font engine for Node and the browser",

@@ -17,2 +17,3 @@ "keywords": [

"prepublish": "make",
"watch": "rimraf ./dist && rollup -c -w",
"coverage": "BABEL_ENV=cover nyc mocha"

@@ -33,5 +34,3 @@ },

"@react-pdf/unicode-properties": "^2.2.0",
"brfs": "^1.4.0",
"brotli": "^1.2.0",
"browserify-optional": "^1.0.0",
"clone": "^1.0.1",

@@ -62,4 +61,6 @@ "deep-equal": "^1.0.0",

"nyc": "^10.3.2",
"rimraf": "^2.6.1",
"rollup": "^0.52.2",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-bundle-size": "https://github.com/vimeo/rollup-plugin-bundle-size",
"rollup-plugin-ignore": "^1.0.3",

@@ -66,0 +67,0 @@ "rollup-plugin-json": "^2.1.0",

@@ -6,2 +6,3 @@ # fontkit

## Fork changes
- Ship parsed tries for browser compatibility

@@ -15,12 +16,12 @@ - Ship node and browser separate builds (ignoring node dependencies)

* Suports TrueType (.ttf), OpenType (.otf), WOFF, WOFF2, TrueType Collection (.ttc), and Datafork TrueType (.dfont) font files
* Supports mapping characters to glyphs, including support for ligatures and other advanced substitutions (see below)
* Supports reading glyph metrics and laying out glyphs, including support for kerning and other advanced layout features (see below)
* Advanced OpenType features including glyph substitution (GSUB) and positioning (GPOS)
* Apple Advanced Typography (AAT) glyph substitution features (morx table)
* Support for getting glyph vector paths and converting them to SVG paths, or rendering them to a graphics context
* Supports TrueType (glyf) and PostScript (CFF) outlines
* Support for color glyphs (e.g. emoji), including Apple’s SBIX table, and Microsoft’s COLR table
* Support for AAT variation glyphs, allowing for nearly infinite design control over weight, width, and other axes.
* Font subsetting support - create a new font including only the specified glyphs
- Suports TrueType (.ttf), OpenType (.otf), WOFF, WOFF2, TrueType Collection (.ttc), and Datafork TrueType (.dfont) font files
- Supports mapping characters to glyphs, including support for ligatures and other advanced substitutions (see below)
- Supports reading glyph metrics and laying out glyphs, including support for kerning and other advanced layout features (see below)
- Advanced OpenType features including glyph substitution (GSUB) and positioning (GPOS)
- Apple Advanced Typography (AAT) glyph substitution features (morx table)
- Support for getting glyph vector paths and converting them to SVG paths, or rendering them to a graphics context
- Supports TrueType (glyf) and PostScript (CFF) outlines
- Support for color glyphs (e.g. emoji), including Apple’s SBIX table, and Microsoft’s COLR table
- Support for AAT variation glyphs, allowing for nearly infinite design control over weight, width, and other axes.
- Font subsetting support - create a new font including only the specified glyphs

@@ -34,22 +35,21 @@ ## Installation

```javascript
var fontkit = require('fontkit');
var fontkit = require('fontkit')
// open a font synchronously
var font = fontkit.openSync('font.ttf');
var font = fontkit.openSync('font.ttf')
// layout a string, using default shaping features.
// returns a GlyphRun, describing glyphs and positions.
var run = font.layout('hello world!');
var run = font.layout('hello world!')
// get an SVG path for a glyph
var svg = run.glyphs[0].path.toSVG();
var svg = run.glyphs[0].path.toSVG()
// create a font subset
var subset = font.createSubset();
var subset = font.createSubset()
run.glyphs.forEach(function(glyph) {
subset.includeGlyph(glyph);
});
subset.includeGlyph(glyph)
})
subset.encodeStream()
.pipe(fs.createWriteStream('subset.ttf'));
subset.encodeStream().pipe(fs.createWriteStream('subset.ttf'))
```

@@ -79,8 +79,8 @@

* `postscriptName`
* `fullName`
* `familyName`
* `subfamilyName`
* `copyright`
* `version`
- `postscriptName`
- `fullName`
- `familyName`
- `subfamilyName`
- `copyright`
- `version`

@@ -91,18 +91,18 @@ ### Metrics

* `unitsPerEm` - the size of the font’s internal coordinate grid
* `ascent` - the font’s [ascender](http://en.wikipedia.org/wiki/Ascender_(typography))
* `descent` - the font’s [descender](http://en.wikipedia.org/wiki/Descender)
* `lineGap` - the amount of space that should be included between lines
* `underlinePosition` - the offset from the normal underline position that should be used
* `underlineThickness` - the weight of the underline that should be used
* `italicAngle` - if this is an italic font, the angle the cursor should be drawn at to match the font design
* `capHeight` - the height of capital letters above the baseline. See [here](http://en.wikipedia.org/wiki/Cap_height) for more details.
* `xHeight`- the height of lower case letters. See [here](http://en.wikipedia.org/wiki/X-height) for more details.
* `bbox` - the font’s bounding box, i.e. the box that encloses all glyphs in the font
- `unitsPerEm` - the size of the font’s internal coordinate grid
- `ascent` - the font’s [ascender](<http://en.wikipedia.org/wiki/Ascender_(typography)>)
- `descent` - the font’s [descender](http://en.wikipedia.org/wiki/Descender)
- `lineGap` - the amount of space that should be included between lines
- `underlinePosition` - the offset from the normal underline position that should be used
- `underlineThickness` - the weight of the underline that should be used
- `italicAngle` - if this is an italic font, the angle the cursor should be drawn at to match the font design
- `capHeight` - the height of capital letters above the baseline. See [here](http://en.wikipedia.org/wiki/Cap_height) for more details.
- `xHeight`- the height of lower case letters. See [here](http://en.wikipedia.org/wiki/X-height) for more details.
- `bbox` - the font’s bounding box, i.e. the box that encloses all glyphs in the font
### Other properties
* `numGlyphs` - the number of glyphs in the font
* `characterSet` - an array of all of the unicode code points supported by the font
* `availableFeatures` - an array of all [OpenType feature tags](https://www.microsoft.com/typography/otspec/featuretags.htm) (or mapped AAT tags) supported by the font (see below for a description of this)
- `numGlyphs` - the number of glyphs in the font
- `characterSet` - an array of all of the unicode code points supported by the font
- `availableFeatures` - an array of all [OpenType feature tags](https://www.microsoft.com/typography/otspec/featuretags.htm) (or mapped AAT tags) supported by the font (see below for a description of this)

@@ -121,2 +121,8 @@ ### Character to glyph mapping

#### `font.glyphsForString(string)`
This method returns an array of Glyph objects for the given string. This is only a one-to-one mapping from characters
to glyphs. For most uses, you should use `font.layout` (described below), which provides a much more advanced mapping
supporting AAT and OpenType shaping.
### Glyph metrics and layout

@@ -126,2 +132,6 @@

#### `font.widthOfGlyph(glyph_id)`
Returns the advance width (described above) for a single glyph id.
#### `font.layout(string, features = [])`

@@ -161,5 +171,5 @@

#### `font.getGlyph(glyph_id)`
#### `font.getGlyph(glyph_id, codePoints = [])`
Returns a glyph object for the given glyph id.
Returns a glyph object for the given glyph id. You can pass the array of code points this glyph represents for your use later, and it will be stored in the glyph object.

@@ -190,8 +200,8 @@ #### `font.createSubset()`

* `id` - the glyph id in the font
* `codePoints` - an array of unicode code points that are represented by this glyph. There can be multiple code points in the case of ligatures and other glyphs that represent multiple visual characters.
* `path` - a vector Path object representing the glyph
* `bbox` - the glyph’s bounding box, i.e. the rectangle that encloses the glyph outline as tightly as possible.
* `cbox` - the glyph’s control box. This is often the same as the bounding box, but is faster to compute. Because of the way bezier curves are defined, some of the control points can be outside of the bounding box. Where `bbox` takes this into account, `cbox` does not. Thus, `cbox` is less accurate, but faster to compute. See [here](http://www.freetype.org/freetype2/docs/glyphs/glyphs-6.html#section-2) for a more detailed description.
* `advanceWidth` - the glyph’s advance width.
- `id` - the glyph id in the font
- `codePoints` - an array of unicode code points that are represented by this glyph. There can be multiple code points in the case of ligatures and other glyphs that represent multiple visual characters.
- `path` - a vector Path object representing the glyph
- `bbox` - the glyph’s bounding box, i.e. the rectangle that encloses the glyph outline as tightly as possible.
- `cbox` - the glyph’s control box. This is often the same as the bounding box, but is faster to compute. Because of the way bezier curves are defined, some of the control points can be outside of the bounding box. Where `bbox` takes this into account, `cbox` does not. Thus, `cbox` is less accurate, but faster to compute. See [here](http://www.freetype.org/freetype2/docs/glyphs/glyphs-6.html#section-2) for a more detailed description.
- `advanceWidth` - the glyph’s advance width.

@@ -198,0 +208,0 @@ ### `glyph.render(ctx, size)`

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

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

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

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

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

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

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

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

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