import type { GlyphId, int8, uint8, uint16, uint32 } from "../../types.ts"; import type { Reader } from "../binary/reader.ts"; /** * Color Bitmap Data Table (CBDT) * Google's color bitmap table for emoji fonts * Used together with CBLC (Color Bitmap Location Table) */ export interface CbdtTable { majorVersion: uint16; minorVersion: uint16; /** Raw data for bitmap lookup */ data: Uint8Array; } /** * Color Bitmap Location Table (CBLC) * Index for looking up bitmaps in CBDT */ export interface CblcTable { majorVersion: uint16; minorVersion: uint16; bitmapSizes: BitmapSize[]; } /** * Bitmap size record */ export interface BitmapSize { indexSubTableArrayOffset: uint32; indexTablesSize: uint32; numberOfIndexSubTables: uint32; colorRef: uint32; hori: SbitLineMetrics; vert: SbitLineMetrics; startGlyphIndex: GlyphId; endGlyphIndex: GlyphId; ppemX: uint8; ppemY: uint8; bitDepth: uint8; flags: int8; indexSubTables: IndexSubTable[]; } /** * Line metrics for bitmap glyphs */ export interface SbitLineMetrics { ascender: int8; descender: int8; widthMax: uint8; caretSlopeNumerator: int8; caretSlopeDenominator: int8; caretOffset: int8; minOriginSB: int8; minAdvanceSB: int8; maxBeforeBL: int8; minAfterBL: int8; pad1: int8; pad2: int8; } /** * Index sub-table for glyph lookup */ export interface IndexSubTable { firstGlyphIndex: GlyphId; lastGlyphIndex: GlyphId; indexFormat: uint16; imageFormat: uint16; imageDataOffset: uint32; /** Glyph offsets (format-dependent) */ glyphOffsets: Map; } /** * Bitmap glyph metrics */ export interface GlyphBitmapMetrics { height: uint8; width: uint8; bearingX: int8; bearingY: int8; advance: uint8; } /** * Bitmap glyph data */ export interface BitmapGlyph { metrics: GlyphBitmapMetrics; imageFormat: uint16; data: Uint8Array; } /** * Image formats in CBDT */ export declare const CbdtImageFormat: { readonly SmallMetrics: 1; readonly SmallMetricsPng: 17; readonly BigMetrics: 2; readonly BigMetricsPng: 18; readonly CompressedPng: 19; }; /** * Parse CBLC table */ export declare function parseCblc(reader: Reader): CblcTable; /** * Parse CBDT table */ export declare function parseCbdt(reader: Reader): CbdtTable; /** * Get bitmap glyph from CBDT using CBLC index */ export declare function getBitmapGlyph(cblc: CblcTable, cbdt: CbdtTable, glyphId: GlyphId, ppem: number): BitmapGlyph | null; /** * Check if glyph has color bitmap */ export declare function hasColorBitmap(cblc: CblcTable, glyphId: GlyphId, ppem?: number): boolean; /** * Get available ppem sizes for color bitmaps */ export declare function getColorBitmapSizes(cblc: CblcTable): number[];