Skip to content

Commit

Permalink
fix(woff-format-options): add correct option with documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
casaper committed Dec 22, 2020
1 parent b2665f9 commit f495d5d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/generators/asset-types/woff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ const generator: FontGenerator<Buffer> = {
dependsOn: FontAssetType.TTF,

async generate({ formatOptions }, ttf) {
const font = ttf2woff(
new Uint8Array(ttf),
formatOptions[FontAssetType.WOFF]
);
const font = ttf2woff(new Uint8Array(ttf), formatOptions?.woff);
return Buffer.from(font.buffer);
}
};
Expand Down
12 changes: 11 additions & 1 deletion src/types/modules/ttf2woff.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
declare module 'ttf2woff' {
function ttf2woff(ttf: Uint8Array, options: any): Buffer;
function ttf2woff(
ttf: Uint8Array,
options?: {
/**
* Woff Extended Metadata Block
*
* See https://www.w3.org/TR/WOFF/#Metadata
*/
metadata?: string;
}
): Buffer;
export default ttf2woff;
}
9 changes: 8 additions & 1 deletion src/types/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ export interface RunnerMandatoryOptions {
export interface FormatOptions {
eot?: any;
woff2?: any;
woff?: any;
woff?: {
/**
* Woff Extended Metadata Block
*
* See https://www.w3.org/TR/WOFF/#Metadata
*/
metadata?: string;
};
ttf?: any;
svg?: Pick<
SvgIcons2FontOptions,
Expand Down

0 comments on commit f495d5d

Please sign in to comment.