// //------------------ DOK FILE -------------------------------------------------- +Header fontLib =pkg bios =title Native fonts =short (Windows and X11/XQuarts only) =desc This library works only on Windows and X11 (aka XQuartz on MacOS). Its purpose is to convert a native system-dependent font into a generic Minimacy font. Because fonts may vary a lot between Operating systems, it is not recommended to use this library in a real application. This explains why [[fontDraw]] draws text only in white. // // //------------------ PROTO ----------------------------------------------------- NativeFont +Proto NativeFont =type NativeFont =mode type =pkg bios =impl native =link =desc The type for fonts. // // //------------------ PROTO ----------------------------------------------------- FONT_BOLD +Proto FONT_BOLD =type Int =mode constant =pkg bios =impl native =link =desc A constant for style font // // //------------------ PROTO ----------------------------------------------------- FONT_ITALIC +Proto FONT_ITALIC =type Int =mode constant =pkg bios =impl native =link =desc A constant for style font // // //------------------ PROTO ----------------------------------------------------- FONT_STRIKED +Proto FONT_STRIKED =type Int =mode constant =pkg bios =impl native =link =desc A constant for style font // // //------------------ PROTO ----------------------------------------------------- FONT_UNDERLINE +Proto FONT_UNDERLINE =type Int =mode constant =pkg bios =impl native =link =desc A constant for style font // // //------------------ PROTO ----------------------------------------------------- fontDraw +Proto nativeFontDraw =type fun Bitmap Int Int NativeFont Int -> Bool =mode function =pkg bios =impl native =link =desc This function draws one character with the specified font at position x,y (top-left). The color is always white. // +arg bmp =type Bitmap =desc A bitmap // +arg x =type Int =desc x coordinate // +arg y =type Int =desc y coordinate // +arg font =type NativeFont =desc A font // +arg code =type Int =desc A character code // +arg result =type Bool =desc A boolean // // //------------------ PROTO ----------------------------------------------------- fontFromHost +Proto nativeFontCreate =type fun Str Int Int -> NativeFont =mode function =pkg bios =impl native =link =desc This function creates a NativeFont structure based on a name, a size in pixels and a style. The style is a combination of the font style constants: [[FONT_BOLD]], [[FONT_ITALIC]], [[FONT_STRIKED]], [[FONT_UNDERLINE]]. Observe that size and style are ignored on X11/XQuartz: these characteristics are expected to be determined by the font name. Once a NativeFont is created, it will be used to draw characters in a [[Bitmap]], and to compute height or width of characters. // +arg name =type Str =desc The font name // +arg size =type Int =desc The font size // +arg style =type Int =desc A mask of font styles // +arg result =type NativeFont =desc A new NativeFont structure // // //------------------ PROTO ----------------------------------------------------- fontH +Proto nativeFontH =type fun NativeFont -> Int =mode function =pkg bios =impl native =link =desc This function returns the height of the font in pixels. // +arg font =type NativeFont =desc A font // +arg result =type Int =desc A positive integer // // //------------------ PROTO ----------------------------------------------------- nativeFontBaseline +Proto nativeFontBaseline =type fun NativeFont -> Int =mode Function =pkg bios =impl native =link =desc This function returns the number of pixels of the font below the baseline, in pixels. // +arg font =type NativeFont =desc A font // +arg result =type Int =desc A positive integer // // //------------------ PROTO ----------------------------------------------------- fontStringU16W +Proto nativeFontW =type fun NativeFont Int -> Int =mode function =pkg bios =impl native =link =desc This function returns the width in pixels of one character with font. // +arg font =type NativeFont =desc A font // +arg code =type Int =desc A character code // +arg result =type Int =desc A positive integer in pixels // // //------------------ PROTO ----------------------------------------------------- nativeFonts +Proto nativeFonts =type fun -> Bool =mode Function =pkg bios =impl mcy =link =desc // +arg result =type Bool =desc