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

@react-pdf/font

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-pdf/font - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

LICENSE

32

lib/index.browser.js

@@ -22,2 +22,19 @@ 'use strict';

var FONT_WEIGHTS = {
thin: 100,
hairline: 100,
ultralight: 200,
extralight: 200,
light: 300,
normal: 400,
medium: 500,
semibold: 600,
demibold: 600,
bold: 700,
ultrabold: 800,
extrabold: 800,
heavy: 900,
black: 900
};
var fetchFont = /*#__PURE__*/function () {

@@ -62,2 +79,10 @@ var _ref = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(src, options) {

var resolveFontWeight = function resolveFontWeight(value) {
return typeof value === 'string' ? FONT_WEIGHTS[value] : value;
};
var sortByFontWeight = function sortByFontWeight(a, b) {
return a.fontWeight - b.fontWeight;
};
var FontSource = /*#__PURE__*/function () {

@@ -164,3 +189,4 @@ function FontSource(src, fontFamily, fontStyle, fontWeight, options) {

this.sources.push(new FontSource(src, this.family, fontStyle, fontWeight, options));
var numericFontWeight = resolveFontWeight(fontWeight);
this.sources.push(new FontSource(src, this.family, fontStyle, numericFontWeight, options));
};

@@ -198,6 +224,6 @@

return s.fontWeight < fontWeight;
});
}).sort(sortByFontWeight);
var gt = styleSources.filter(function (s) {
return s.fontWeight > fontWeight;
});
}).sort(sortByFontWeight);

@@ -204,0 +230,0 @@ if (fontWeight < 400) {

@@ -16,2 +16,18 @@ 'use strict';

/* eslint-disable max-classes-per-file */
const FONT_WEIGHTS = {
thin: 100,
hairline: 100,
ultralight: 200,
extralight: 200,
light: 300,
normal: 400,
medium: 500,
semibold: 600,
demibold: 600,
bold: 700,
ultrabold: 800,
extrabold: 800,
heavy: 900,
black: 900
};

@@ -31,2 +47,8 @@ const fetchFont = async (src, options) => {

const resolveFontWeight = value => {
return typeof value === 'string' ? FONT_WEIGHTS[value] : value;
};
const sortByFontWeight = (a, b) => a.fontWeight - b.fontWeight;
class FontSource {

@@ -88,3 +110,4 @@ constructor(src, fontFamily, fontStyle, fontWeight, options) {

}) {
this.sources.push(new FontSource(src, this.family, fontStyle, fontWeight, options));
const numericFontWeight = resolveFontWeight(fontWeight);
this.sources.push(new FontSource(src, this.family, fontStyle, numericFontWeight, options));
}

@@ -110,4 +133,4 @@

const lt = styleSources.filter(s => s.fontWeight < fontWeight);
const gt = styleSources.filter(s => s.fontWeight > fontWeight);
const lt = styleSources.filter(s => s.fontWeight < fontWeight).sort(sortByFontWeight);
const gt = styleSources.filter(s => s.fontWeight > fontWeight).sort(sortByFontWeight);

@@ -114,0 +137,0 @@ if (fontWeight < 400) {

7

package.json
{
"name": "@react-pdf/font",
"version": "2.0.4",
"version": "2.0.5",
"license": "MIT",

@@ -18,3 +18,3 @@ "author": "Diego Muracciole <diegomuracciole@gmail.com>",

"dependencies": {
"@react-pdf/fontkit": "^2.0.2",
"@react-pdf/fontkit": "^2.0.3",
"@react-pdf/types": "^2.0.1",

@@ -26,3 +26,4 @@ "cross-fetch": "^3.0.4",

"lib"
]
],
"gitHead": "09b1b0b45bcd7cecd2bbd340aee1b026db18815c"
}

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc