@capsizecss/core
Advanced tools
Comparing version 0.0.0-createfontstack-20221108001254 to 0.0.0-createfontstack-20221110224822
@@ -210,8 +210,10 @@ 'use strict'; | ||
if (sizeAdjustStrategy) { | ||
const preferredFontXAvgRatio = | ||
// @ts-expect-error TODO Don't ignore when final metric naming is released | ||
const preferredFontAvgWidth = metrics[sizeAdjustStrategy]; | ||
metrics[sizeAdjustStrategy] / metrics.unitsPerEm; | ||
const fallbackFontXAvgRatio = | ||
// @ts-expect-error TODO Don't ignore when final metric naming is released | ||
const fallbackFontAvgWidth = fallbackMetrics[sizeAdjustStrategy]; | ||
if (preferredFontAvgWidth && fallbackFontAvgWidth) { | ||
sizeAdjust = preferredFontAvgWidth / fallbackFontAvgWidth; | ||
fallbackMetrics[sizeAdjustStrategy] / fallbackMetrics.unitsPerEm; | ||
if (preferredFontXAvgRatio && fallbackFontXAvgRatio) { | ||
sizeAdjust = preferredFontXAvgRatio / fallbackFontXAvgRatio; | ||
} | ||
@@ -272,16 +274,2 @@ } | ||
const quoteIfNeeded = name => !/^[a-zA-Z][^"'][a-zA-Z\d-]+[a-zA-Z\d]$/.test(name) ? "'".concat(name, "'") : name; | ||
// TODO: test cases for later | ||
// ✅ Goudy Bookletter 1911 | ||
// ✅ Red/Black | ||
// ✅ "Lucida" Grande | ||
// ✅ Ahem! | ||
// ✅ test@foo | ||
// ✅ #POUND | ||
// ✅ Hawaii 5-0 | ||
// ❌ sans-serif | ||
// ❌ asdasdasd | ||
// ✅ "Lucide Grande" | ||
// ✅ "Lucide | ||
// ✅ 'Sasd asdasd' | ||
function createFontStack(_ref3) { | ||
@@ -288,0 +276,0 @@ let [metrics, ...fallbacks] = _ref3; |
@@ -206,8 +206,10 @@ function normaliseOptions(options) { | ||
if (sizeAdjustStrategy) { | ||
const preferredFontXAvgRatio = | ||
// @ts-expect-error TODO Don't ignore when final metric naming is released | ||
const preferredFontAvgWidth = metrics[sizeAdjustStrategy]; | ||
metrics[sizeAdjustStrategy] / metrics.unitsPerEm; | ||
const fallbackFontXAvgRatio = | ||
// @ts-expect-error TODO Don't ignore when final metric naming is released | ||
const fallbackFontAvgWidth = fallbackMetrics[sizeAdjustStrategy]; | ||
if (preferredFontAvgWidth && fallbackFontAvgWidth) { | ||
sizeAdjust = preferredFontAvgWidth / fallbackFontAvgWidth; | ||
fallbackMetrics[sizeAdjustStrategy] / fallbackMetrics.unitsPerEm; | ||
if (preferredFontXAvgRatio && fallbackFontXAvgRatio) { | ||
sizeAdjust = preferredFontXAvgRatio / fallbackFontXAvgRatio; | ||
} | ||
@@ -268,16 +270,2 @@ } | ||
const quoteIfNeeded = name => !/^[a-zA-Z][^"'][a-zA-Z\d-]+[a-zA-Z\d]$/.test(name) ? "'".concat(name, "'") : name; | ||
// TODO: test cases for later | ||
// ✅ Goudy Bookletter 1911 | ||
// ✅ Red/Black | ||
// ✅ "Lucida" Grande | ||
// ✅ Ahem! | ||
// ✅ test@foo | ||
// ✅ #POUND | ||
// ✅ Hawaii 5-0 | ||
// ❌ sans-serif | ||
// ❌ asdasdasd | ||
// ✅ "Lucide Grande" | ||
// ✅ "Lucide | ||
// ✅ 'Sasd asdasd' | ||
function createFontStack(_ref3) { | ||
@@ -284,0 +272,0 @@ let [metrics, ...fallbacks] = _ref3; |
@@ -210,8 +210,10 @@ 'use strict'; | ||
if (sizeAdjustStrategy) { | ||
const preferredFontXAvgRatio = | ||
// @ts-expect-error TODO Don't ignore when final metric naming is released | ||
const preferredFontAvgWidth = metrics[sizeAdjustStrategy]; | ||
metrics[sizeAdjustStrategy] / metrics.unitsPerEm; | ||
const fallbackFontXAvgRatio = | ||
// @ts-expect-error TODO Don't ignore when final metric naming is released | ||
const fallbackFontAvgWidth = fallbackMetrics[sizeAdjustStrategy]; | ||
if (preferredFontAvgWidth && fallbackFontAvgWidth) { | ||
sizeAdjust = preferredFontAvgWidth / fallbackFontAvgWidth; | ||
fallbackMetrics[sizeAdjustStrategy] / fallbackMetrics.unitsPerEm; | ||
if (preferredFontXAvgRatio && fallbackFontXAvgRatio) { | ||
sizeAdjust = preferredFontXAvgRatio / fallbackFontXAvgRatio; | ||
} | ||
@@ -272,16 +274,2 @@ } | ||
const quoteIfNeeded = name => !/^[a-zA-Z][^"'][a-zA-Z\d-]+[a-zA-Z\d]$/.test(name) ? "'".concat(name, "'") : name; | ||
// TODO: test cases for later | ||
// ✅ Goudy Bookletter 1911 | ||
// ✅ Red/Black | ||
// ✅ "Lucida" Grande | ||
// ✅ Ahem! | ||
// ✅ test@foo | ||
// ✅ #POUND | ||
// ✅ Hawaii 5-0 | ||
// ❌ sans-serif | ||
// ❌ asdasdasd | ||
// ✅ "Lucide Grande" | ||
// ✅ "Lucide | ||
// ✅ 'Sasd asdasd' | ||
function createFontStack(_ref3) { | ||
@@ -288,0 +276,0 @@ let [metrics, ...fallbacks] = _ref3; |
@@ -210,8 +210,10 @@ 'use strict'; | ||
if (sizeAdjustStrategy) { | ||
const preferredFontXAvgRatio = | ||
// @ts-expect-error TODO Don't ignore when final metric naming is released | ||
const preferredFontAvgWidth = metrics[sizeAdjustStrategy]; | ||
metrics[sizeAdjustStrategy] / metrics.unitsPerEm; | ||
const fallbackFontXAvgRatio = | ||
// @ts-expect-error TODO Don't ignore when final metric naming is released | ||
const fallbackFontAvgWidth = fallbackMetrics[sizeAdjustStrategy]; | ||
if (preferredFontAvgWidth && fallbackFontAvgWidth) { | ||
sizeAdjust = preferredFontAvgWidth / fallbackFontAvgWidth; | ||
fallbackMetrics[sizeAdjustStrategy] / fallbackMetrics.unitsPerEm; | ||
if (preferredFontXAvgRatio && fallbackFontXAvgRatio) { | ||
sizeAdjust = preferredFontXAvgRatio / fallbackFontXAvgRatio; | ||
} | ||
@@ -272,16 +274,2 @@ } | ||
const quoteIfNeeded = name => !/^[a-zA-Z][^"'][a-zA-Z\d-]+[a-zA-Z\d]$/.test(name) ? "'".concat(name, "'") : name; | ||
// TODO: test cases for later | ||
// ✅ Goudy Bookletter 1911 | ||
// ✅ Red/Black | ||
// ✅ "Lucida" Grande | ||
// ✅ Ahem! | ||
// ✅ test@foo | ||
// ✅ #POUND | ||
// ✅ Hawaii 5-0 | ||
// ❌ sans-serif | ||
// ❌ asdasdasd | ||
// ✅ "Lucide Grande" | ||
// ✅ "Lucide | ||
// ✅ 'Sasd asdasd' | ||
function createFontStack(_ref3) { | ||
@@ -288,0 +276,0 @@ let [metrics, ...fallbacks] = _ref3; |
@@ -206,8 +206,10 @@ function normaliseOptions(options) { | ||
if (sizeAdjustStrategy) { | ||
const preferredFontXAvgRatio = | ||
// @ts-expect-error TODO Don't ignore when final metric naming is released | ||
const preferredFontAvgWidth = metrics[sizeAdjustStrategy]; | ||
metrics[sizeAdjustStrategy] / metrics.unitsPerEm; | ||
const fallbackFontXAvgRatio = | ||
// @ts-expect-error TODO Don't ignore when final metric naming is released | ||
const fallbackFontAvgWidth = fallbackMetrics[sizeAdjustStrategy]; | ||
if (preferredFontAvgWidth && fallbackFontAvgWidth) { | ||
sizeAdjust = preferredFontAvgWidth / fallbackFontAvgWidth; | ||
fallbackMetrics[sizeAdjustStrategy] / fallbackMetrics.unitsPerEm; | ||
if (preferredFontXAvgRatio && fallbackFontXAvgRatio) { | ||
sizeAdjust = preferredFontXAvgRatio / fallbackFontXAvgRatio; | ||
} | ||
@@ -268,16 +270,2 @@ } | ||
const quoteIfNeeded = name => !/^[a-zA-Z][^"'][a-zA-Z\d-]+[a-zA-Z\d]$/.test(name) ? "'".concat(name, "'") : name; | ||
// TODO: test cases for later | ||
// ✅ Goudy Bookletter 1911 | ||
// ✅ Red/Black | ||
// ✅ "Lucida" Grande | ||
// ✅ Ahem! | ||
// ✅ test@foo | ||
// ✅ #POUND | ||
// ✅ Hawaii 5-0 | ||
// ❌ sans-serif | ||
// ❌ asdasdasd | ||
// ✅ "Lucide Grande" | ||
// ✅ "Lucide | ||
// ✅ 'Sasd asdasd' | ||
function createFontStack(_ref3) { | ||
@@ -284,0 +272,0 @@ let [metrics, ...fallbacks] = _ref3; |
@@ -1,14 +0,12 @@ | ||
import { FontMetrics } from './types'; | ||
import { Font } from '@capsizecss/unpack'; | ||
import { AtRule } from 'csstype'; | ||
declare type SizeAdjustStrategy = 'xAvgCharWidth' | 'xAvgLowercase' | 'xAvgWeightedOs2' | 'xAvgWeightedWiki' | 'xAvgLetterFrequency'; | ||
interface UnpackedMetrics extends FontMetrics { | ||
familyName: string; | ||
} | ||
declare type FontFace = { | ||
'@font-face': AtRule.FontFace; | ||
}; | ||
export declare const quoteIfNeeded: (name: string) => string; | ||
interface CreateFontStackOptions { | ||
sizeAdjust?: SizeAdjustStrategy; | ||
} | ||
export declare function createFontStack([metrics, ...fallbacks]: UnpackedMetrics[], options?: CreateFontStackOptions): { | ||
export declare function createFontStack([metrics, ...fallbacks]: Font[], options?: CreateFontStackOptions): { | ||
fontFamily: string; | ||
@@ -15,0 +13,0 @@ fontFaces: FontFace[]; |
{ | ||
"name": "@capsizecss/core", | ||
"version": "0.0.0-createfontstack-20221108001254", | ||
"version": "0.0.0-createfontstack-20221110224822", | ||
"description": "Flipping how we define typography", | ||
@@ -42,2 +42,3 @@ "main": "dist/capsizecss-core.cjs.js", | ||
"devDependencies": { | ||
"@capsizecss/unpack": "0.0.0-createfontstack-20221110224822", | ||
"@emotion/css": "^11.1.3", | ||
@@ -44,0 +45,0 @@ "csstype": "^3.1.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66074
3
1631