import { MayBePromise } from "./types.cjs";
import { FontStyle, FontWeight } from "./satori.cjs";
//#region src/core/font.d.ts
type FontDisplay = 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
type FontSubset = 'arabic' | 'bengali' | 'chinese-simplified' | 'cyrillic' | 'cyrillic-ext' | 'devanagari' | 'ethiopic' | 'greek' | 'greek-ext' | 'gujarati' | 'gurmukhi' | 'hebrew' | 'japanese' | 'kannada' | 'khmer' | 'korean' | 'lao' | 'latin' | 'latin-ext' | 'malayalam' | 'menu' | 'myanmar' | 'oriya' | 'sinhala' | 'tamil' | 'telugu' | 'thai' | 'tibetan' | 'vietnamese';
/** Google fonts utils */
declare class GoogleFontsUtils {
  /** Default Google font css loader */
  private _defaultCssLoader;
  /** Google font css loader */
  private _cssLoader;
  /**
   * Loads Google font css
   *
   * @param cssUrl The Google font css url
   * @param userAgent The user agent header to be used
   *
   * @returns On success, the css as string
   */
  loadCss(cssUrl: string, userAgent?: string): Promise<string>;
  /**
   * Sets Google font css loader
   *
   * @param loader The {@link GoogleFontCssLoader}
   */
  setCssLoader(loader: (cssUrl: string, userAgent: string) => MayBePromise<string | undefined>): void;
}
declare const googleFonts: GoogleFontsUtils;
/** An interface representing options for {@link loadGoogleFont} function */
interface LoadGoogleFontOptions {
  /** The font style to load */
  style?: FontStyle;
  /** The font weight to load */
  weight?: string | number;
  /** The font subset to load */
  subset?: FontSubset;
  /** The `font-display` */
  display?: FontDisplay;
  text?: string;
}
/**
 * A helper function for loading google fonts as {@link ArrayBuffer}
 *
 * @param family The name of the font family
 * @param param1 Options
 *
 * @returns A promise which resolved to {@link ArrayBuffer}
 */
declare function loadGoogleFont(family: string, options?: LoadGoogleFontOptions): Promise<ArrayBuffer>;
interface BaseFontOptions {
  weight?: FontWeight;
  style?: FontStyle;
}
interface BaseFont {
  name: string;
  style: FontStyle;
  weight: FontWeight;
  get data(): Promise<Buffer | ArrayBuffer>;
}
/** An interface representing options for {@link CustomFont} */
interface CustomFontOptions extends BaseFontOptions {
  lang?: string;
}
/** A helper class to load Custom font */
declare class CustomFont implements BaseFont {
  protected input: MayBePromise<Buffer | ArrayBuffer> | (() => MayBePromise<Buffer | ArrayBuffer>);
  private promise?;
  type: 'custom';
  name: string;
  style: FontStyle;
  weight: FontWeight;
  lang: string | undefined;
  /**
   * Creates an instance of {@link CustomFont}
   *
   * @param name The name of the font (can be used for font-family css property)
   * @param input Font data as `ArrayBuffer` or a promise which resolves to `ArrayBuffer`
   * @param options
   */
  constructor(name: string, input: MayBePromise<Buffer | ArrayBuffer> | (() => MayBePromise<Buffer | ArrayBuffer>), { style, weight, lang }?: CustomFontOptions);
  /**
   * A promise which resolves to font data as `ArrayBuffer`
   */
  get data(): Promise<Buffer | ArrayBuffer>;
}
/** An interface representing options for {@link GoogleFont} */
interface GoogleFontOptions extends BaseFontOptions {
  /** The name of the font (can be used for font-family css property) */
  name?: string;
  /** Loads font only for particular text (for better performance) */
  text?: string;
  subset?: FontSubset;
}
/** A helper class to load Google font */
declare class GoogleFont implements BaseFont {
  private promise?;
  type: 'google';
  name: string;
  style: FontStyle;
  weight: FontWeight;
  subset: FontSubset;
  /** The font family name */
  family: string;
  /** Text for which the font is loaded */
  text: string | undefined;
  /**
   * Creates an instance of {@link GoogleFont}
   *
   * @param family The name of font family to load
   * @param options The {@link GoogleFontOptions}
   */
  constructor(family: string, { name, style, weight, subset, text }?: GoogleFontOptions);
  /** A promise which resolves to font data as `ArrayBuffer` */
  get data(): Promise<ArrayBuffer>;
  /**
   * Checks whether font can load buffer
   *
   * @returns On success, true otherwise the error object thrown
   */
  canLoad(): Promise<unknown>;
}
interface FontBuffer {
  data: MayBePromise<Buffer | ArrayBuffer>;
}
type FontInput = MayBePromise<Response | Buffer | ArrayBuffer | FontBuffer>;
/** Default font utils */
declare class DefaultFont {
  private _input?;
  private _data?;
  private _shouldResolve;
  /**
   * Sets default font for image rendering
   *
   * @param input {@link FontInput}
   */
  set(input: FontInput | (() => FontInput)): void;
  /**
   * Gets default font buffer for image rendering if it is set
   *
   * @returns A Promise which resolves to ArrayBuffer if default font is set,
   * otherwise undefined
   */
  get(): Promise<Buffer | ArrayBuffer | undefined>;
  /**
   * Check whether default font is set or not
   *
   * @returns true if default font is set, otherwise false
   */
  has(): boolean;
}
declare const defaultFont: DefaultFont;
//#endregion
export { BaseFont, BaseFontOptions, CustomFont, CustomFontOptions, FontBuffer, FontDisplay, FontInput, FontSubset, GoogleFont, GoogleFontOptions, LoadGoogleFontOptions, defaultFont, googleFonts, loadGoogleFont };
//# sourceMappingURL=font.d.cts.map