Skip to content

Instantly share code, notes, and snippets.

@genotrance
Created July 13, 2020 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save genotrance/cf45b0ce3e7c57f32b7673cf64f977b9 to your computer and use it in GitHub Desktop.
Save genotrance/cf45b0ce3e7c57f32b7673cf64f977b9 to your computer and use it in GitHub Desktop.
Nim wrapper for freetype using nimterop
import nimterop/cimport
const
baseDir = "/usr/include/freetype2"
cDefine("FT_UInt32", "unsigned int32")
cIncludeDir(baseDir)
cImport(
filename = "ft.h",
recurse = true,
flags = "--prefix=_ --suffix=_ -s"
)
#include <ft2build.h>
#include FT_FREETYPE_H
# Generated @ 2020-07-13T16:16:06-05:00
# Command line:
# /home/gt/nimterop/nimterop/toast --preprocess -m:c --recurse --prefix=_ --suffix=_ -s --defines+=FT_UInt32='unsigned int32' --includeDirs+=/usr/include/freetype2 --pnim --nim:/home/gt/nimdevel/bin/nim /home/gt/wrappers/freetype/ft.h -o /home/gt/.cache/nim/nimterop/toastCache/nimterop_416539855.nim
# const 'FT_CONFIG_CONFIG_H' has unsupported value '<freetype/config/ftconfig.h>'
# const 'FT_CONFIG_STANDARD_LIBRARY_H' has unsupported value '<freetype/config/ftstdlib.h>'
# const 'FT_CONFIG_OPTIONS_H' has unsupported value '<freetype/config/ftoption.h>'
# const 'FT_CONFIG_MODULES_H' has unsupported value '<freetype/config/ftmodule.h>'
# const 'FT_FREETYPE_H' has unsupported value '<freetype/freetype.h>'
# const 'FT_ERRORS_H' has unsupported value '<freetype/fterrors.h>'
# const 'FT_MODULE_ERRORS_H' has unsupported value '<freetype/ftmoderr.h>'
# const 'FT_SYSTEM_H' has unsupported value '<freetype/ftsystem.h>'
# const 'FT_IMAGE_H' has unsupported value '<freetype/ftimage.h>'
# const 'FT_TYPES_H' has unsupported value '<freetype/fttypes.h>'
# const 'FT_LIST_H' has unsupported value '<freetype/ftlist.h>'
# const 'FT_OUTLINE_H' has unsupported value '<freetype/ftoutln.h>'
# const 'FT_SIZES_H' has unsupported value '<freetype/ftsizes.h>'
# const 'FT_MODULE_H' has unsupported value '<freetype/ftmodapi.h>'
# const 'FT_RENDER_H' has unsupported value '<freetype/ftrender.h>'
# const 'FT_AUTOHINTER_H' has unsupported value '<freetype/ftautoh.h>'
# const 'FT_CFF_DRIVER_H' has unsupported value '<freetype/ftcffdrv.h>'
# const 'FT_TRUETYPE_DRIVER_H' has unsupported value '<freetype/ftttdrv.h>'
# const 'FT_PCF_DRIVER_H' has unsupported value '<freetype/ftpcfdrv.h>'
# const 'FT_TYPE1_TABLES_H' has unsupported value '<freetype/t1tables.h>'
# const 'FT_TRUETYPE_IDS_H' has unsupported value '<freetype/ttnameid.h>'
# const 'FT_TRUETYPE_TABLES_H' has unsupported value '<freetype/tttables.h>'
# const 'FT_TRUETYPE_TAGS_H' has unsupported value '<freetype/tttags.h>'
# const 'FT_BDF_H' has unsupported value '<freetype/ftbdf.h>'
# const 'FT_CID_H' has unsupported value '<freetype/ftcid.h>'
# const 'FT_GZIP_H' has unsupported value '<freetype/ftgzip.h>'
# const 'FT_LZW_H' has unsupported value '<freetype/ftlzw.h>'
# const 'FT_BZIP2_H' has unsupported value '<freetype/ftbzip2.h>'
# const 'FT_WINFONTS_H' has unsupported value '<freetype/ftwinfnt.h>'
# const 'FT_GLYPH_H' has unsupported value '<freetype/ftglyph.h>'
# const 'FT_BITMAP_H' has unsupported value '<freetype/ftbitmap.h>'
# const 'FT_BBOX_H' has unsupported value '<freetype/ftbbox.h>'
# const 'FT_CACHE_H' has unsupported value '<freetype/ftcache.h>'
# const 'FT_CACHE_IMAGE_H' has unsupported value 'FT_CACHE_H'
# const 'FT_CACHE_SMALL_BITMAPS_H' has unsupported value 'FT_CACHE_H'
# const 'FT_CACHE_CHARMAP_H' has unsupported value 'FT_CACHE_H'
# const 'FT_MAC_H' has unsupported value '<freetype/ftmac.h>'
# const 'FT_MULTIPLE_MASTERS_H' has unsupported value '<freetype/ftmm.h>'
# const 'FT_SFNT_NAMES_H' has unsupported value '<freetype/ftsnames.h>'
# const 'FT_OPENTYPE_VALIDATE_H' has unsupported value '<freetype/ftotval.h>'
# const 'FT_GX_VALIDATE_H' has unsupported value '<freetype/ftgxval.h>'
# const 'FT_PFR_H' has unsupported value '<freetype/ftpfr.h>'
# const 'FT_STROKER_H' has unsupported value '<freetype/ftstroke.h>'
# const 'FT_SYNTHESIS_H' has unsupported value '<freetype/ftsynth.h>'
# const 'FT_FONT_FORMATS_H' has unsupported value '<freetype/ftfntfmt.h>'
# const 'FT_XFREE86_H' has unsupported value 'FT_FONT_FORMATS_H'
# const 'FT_TRIGONOMETRY_H' has unsupported value '<freetype/fttrigon.h>'
# const 'FT_LCD_FILTER_H' has unsupported value '<freetype/ftlcdfil.h>'
# const 'FT_UNPATENTED_HINTING_H' has unsupported value '<freetype/ttunpat.h>'
# const 'FT_INCREMENTAL_H' has unsupported value '<freetype/ftincrem.h>'
# const 'FT_GASP_H' has unsupported value '<freetype/ftgasp.h>'
# const 'FT_ADVANCES_H' has unsupported value '<freetype/ftadvanc.h>'
# const 'FT_ERROR_DEFINITIONS_H' has unsupported value '<freetype/fterrdef.h>'
# const 'FT_CACHE_MANAGER_H' has unsupported value '<freetype/ftcache.h>'
# const 'FT_CACHE_INTERNAL_MRU_H' has unsupported value '<freetype/ftcache.h>'
# const 'FT_CACHE_INTERNAL_MANAGER_H' has unsupported value '<freetype/ftcache.h>'
# const 'FT_CACHE_INTERNAL_CACHE_H' has unsupported value '<freetype/ftcache.h>'
# const 'FT_CACHE_INTERNAL_GLYPH_H' has unsupported value '<freetype/ftcache.h>'
# const 'FT_CACHE_INTERNAL_IMAGE_H' has unsupported value '<freetype/ftcache.h>'
# const 'FT_CACHE_INTERNAL_SBITS_H' has unsupported value '<freetype/ftcache.h>'
# const 'FT_INCREMENTAL_H' has unsupported value '<freetype/ftincrem.h>'
# const 'FT_TRUETYPE_UNPATENTED_H' has unsupported value '<freetype/ttunpat.h>'
# const 'ft_ptrdiff_t' has unsupported value 'ptrdiff_t'
# const 'FT_CHAR_BIT' has unsupported value 'CHAR_BIT'
# const 'FT_USHORT_MAX' has unsupported value 'USHRT_MAX'
# const 'FT_INT_MAX' has unsupported value 'INT_MAX'
# const 'FT_INT_MIN' has unsupported value 'INT_MIN'
# const 'FT_UINT_MAX' has unsupported value 'UINT_MAX'
# const 'FT_LONG_MIN' has unsupported value 'LONG_MIN'
# const 'FT_LONG_MAX' has unsupported value 'LONG_MAX'
# const 'FT_ULONG_MAX' has unsupported value 'ULONG_MAX'
# const 'ft_memchr' has unsupported value 'memchr'
# const 'ft_memcmp' has unsupported value 'memcmp'
# const 'ft_memcpy' has unsupported value 'memcpy'
# const 'ft_memmove' has unsupported value 'memmove'
# const 'ft_memset' has unsupported value 'memset'
# const 'ft_strcat' has unsupported value 'strcat'
# const 'ft_strcmp' has unsupported value 'strcmp'
# const 'ft_strcpy' has unsupported value 'strcpy'
# const 'ft_strlen' has unsupported value 'strlen'
# const 'ft_strncmp' has unsupported value 'strncmp'
# const 'ft_strncpy' has unsupported value 'strncpy'
# const 'ft_strrchr' has unsupported value 'strrchr'
# const 'ft_strstr' has unsupported value 'strstr'
# const 'FT_FILE' has unsupported value 'FILE'
# const 'ft_fclose' has unsupported value 'fclose'
# const 'ft_fopen' has unsupported value 'fopen'
# const 'ft_fread' has unsupported value 'fread'
# const 'ft_fseek' has unsupported value 'fseek'
# const 'ft_ftell' has unsupported value 'ftell'
# const 'ft_sprintf' has unsupported value 'sprintf'
# const 'ft_qsort' has unsupported value 'qsort'
# const 'ft_scalloc' has unsupported value 'calloc'
# const 'ft_sfree' has unsupported value 'free'
# const 'ft_smalloc' has unsupported value 'malloc'
# const 'ft_srealloc' has unsupported value 'realloc'
# const 'ft_strtol' has unsupported value 'strtol'
# const 'ft_getenv' has unsupported value 'getenv'
# const 'ft_jmp_buf' has unsupported value 'jmp_buf /* note: this cannot be a typedef since */'
# const 'ft_longjmp' has unsupported value 'longjmp'
# const 'FT_SIZEOF_INT' has unsupported value '(32 / FT_CHAR_BIT)'
# const 'FT_SIZEOF_LONG' has unsupported value '(64 / FT_CHAR_BIT)'
# const 'FT_INT64' has unsupported value 'long'
# const 'FT_UINT64' has unsupported value 'unsigned long'
# const 'FT_BEGIN_STMNT' has unsupported value 'do {'
# const 'FT_DUMMY_STMNT' has unsupported value 'FT_BEGIN_STMNT FT_END_STMNT'
# const 'FT_CALLBACK_TABLE' has unsupported value 'extern'
# const 'ft_pixel_mode_none' has unsupported value 'FT_PIXEL_MODE_NONE'
# const 'ft_pixel_mode_mono' has unsupported value 'FT_PIXEL_MODE_MONO'
# const 'ft_pixel_mode_grays' has unsupported value 'FT_PIXEL_MODE_GRAY'
# const 'ft_pixel_mode_pal2' has unsupported value 'FT_PIXEL_MODE_GRAY2'
# const 'ft_pixel_mode_pal4' has unsupported value 'FT_PIXEL_MODE_GRAY4'
# const 'FT_OUTLINE_CONTOURS_MAX' has unsupported value 'SHRT_MAX'
# const 'FT_OUTLINE_POINTS_MAX' has unsupported value 'SHRT_MAX'
# const 'ft_outline_none' has unsupported value 'FT_OUTLINE_NONE'
# const 'ft_outline_owner' has unsupported value 'FT_OUTLINE_OWNER'
# const 'ft_outline_even_odd_fill' has unsupported value 'FT_OUTLINE_EVEN_ODD_FILL'
# const 'ft_outline_reverse_fill' has unsupported value 'FT_OUTLINE_REVERSE_FILL'
# const 'ft_outline_ignore_dropouts' has unsupported value 'FT_OUTLINE_IGNORE_DROPOUTS'
# const 'ft_outline_high_precision' has unsupported value 'FT_OUTLINE_HIGH_PRECISION'
# const 'ft_outline_single_pass' has unsupported value 'FT_OUTLINE_SINGLE_PASS'
# const 'FT_Curve_Tag_On' has unsupported value 'FT_CURVE_TAG_ON'
# const 'FT_Curve_Tag_Conic' has unsupported value 'FT_CURVE_TAG_CONIC'
# const 'FT_Curve_Tag_Cubic' has unsupported value 'FT_CURVE_TAG_CUBIC'
# const 'FT_Curve_Tag_Touch_X' has unsupported value 'FT_CURVE_TAG_TOUCH_X'
# const 'FT_Curve_Tag_Touch_Y' has unsupported value 'FT_CURVE_TAG_TOUCH_Y'
# const 'FT_Outline_MoveTo_Func' has unsupported value 'FT_Outline_MoveToFunc'
# const 'FT_Outline_LineTo_Func' has unsupported value 'FT_Outline_LineToFunc'
# const 'FT_Outline_ConicTo_Func' has unsupported value 'FT_Outline_ConicToFunc'
# const 'FT_Outline_CubicTo_Func' has unsupported value 'FT_Outline_CubicToFunc'
# const 'ft_glyph_format_none' has unsupported value 'FT_GLYPH_FORMAT_NONE'
# const 'ft_glyph_format_composite' has unsupported value 'FT_GLYPH_FORMAT_COMPOSITE'
# const 'ft_glyph_format_bitmap' has unsupported value 'FT_GLYPH_FORMAT_BITMAP'
# const 'ft_glyph_format_outline' has unsupported value 'FT_GLYPH_FORMAT_OUTLINE'
# const 'ft_glyph_format_plotter' has unsupported value 'FT_GLYPH_FORMAT_PLOTTER'
# const 'FT_Raster_Span_Func' has unsupported value 'FT_SpanFunc'
# const 'ft_raster_flag_default' has unsupported value 'FT_RASTER_FLAG_DEFAULT'
# const 'ft_raster_flag_aa' has unsupported value 'FT_RASTER_FLAG_AA'
# const 'ft_raster_flag_direct' has unsupported value 'FT_RASTER_FLAG_DIRECT'
# const 'ft_raster_flag_clip' has unsupported value 'FT_RASTER_FLAG_CLIP'
# const 'FT_Raster_New_Func' has unsupported value 'FT_Raster_NewFunc'
# const 'FT_Raster_Done_Func' has unsupported value 'FT_Raster_DoneFunc'
# const 'FT_Raster_Reset_Func' has unsupported value 'FT_Raster_ResetFunc'
# const 'FT_Raster_Set_Mode_Func' has unsupported value 'FT_Raster_SetModeFunc'
# const 'FT_Raster_Render_Func' has unsupported value 'FT_Raster_RenderFunc'
# tree-sitter parse error: 'typedef 'unsigned int32' FT_Tag;', skipped
# const 'FT_MODERR_START_LIST' has unsupported value 'enum {'
# const 'FT_MODERR_END_LIST' has unsupported value 'FT_Mod_Err_Max };'
# const 'FT_ERR_PREFIX' has unsupported value 'FT_Err_'
# const 'FT_ERROR_START_LIST' has unsupported value 'enum {'
# const 'FT_ERROR_END_LIST' has unsupported value 'FT_ERR_CAT( FT_ERR_PREFIX, Max ) };'
# tree-sitter parse error: 'typedef enum FT_Encoding_', skipped
{.push hint[ConvFromXtoItselfNotNeeded]: off.}
import macros
macro defineEnum(typ: untyped): untyped =
result = newNimNode(nnkStmtList)
# Enum mapped to distinct cint
result.add quote do:
type `typ`* = distinct cint
for i in ["+", "-", "*", "div", "mod", "shl", "shr", "or", "and", "xor", "<", "<=", "==", ">", ">="]:
let
ni = newIdentNode(i)
typout = if i[0] in "<=>": newIdentNode("bool") else: typ # comparisons return bool
if i[0] == '>': # cannot borrow `>` and `>=` from templates
let
nopp = if i.len == 2: newIdentNode("<=") else: newIdentNode("<")
result.add quote do:
proc `ni`*(x: `typ`, y: cint): `typout` = `nopp`(y, x)
proc `ni`*(x: cint, y: `typ`): `typout` = `nopp`(y, x)
proc `ni`*(x, y: `typ`): `typout` = `nopp`(y, x)
else:
result.add quote do:
proc `ni`*(x: `typ`, y: cint): `typout` {.borrow.}
proc `ni`*(x: cint, y: `typ`): `typout` {.borrow.}
proc `ni`*(x, y: `typ`): `typout` {.borrow.}
result.add quote do:
proc `ni`*(x: `typ`, y: int): `typout` = `ni`(x, y.cint)
proc `ni`*(x: int, y: `typ`): `typout` = `ni`(x.cint, y)
let
divop = newIdentNode("/") # `/`()
dlrop = newIdentNode("$") # `$`()
notop = newIdentNode("not") # `not`()
result.add quote do:
proc `divop`*(x, y: `typ`): `typ` = `typ`((x.float / y.float).cint)
proc `divop`*(x: `typ`, y: cint): `typ` = `divop`(x, `typ`(y))
proc `divop`*(x: cint, y: `typ`): `typ` = `divop`(`typ`(x), y)
proc `divop`*(x: `typ`, y: int): `typ` = `divop`(x, y.cint)
proc `divop`*(x: int, y: `typ`): `typ` = `divop`(x.cint, y)
proc `dlrop`*(x: `typ`): string {.borrow.}
proc `notop`*(x: `typ`): `typ` {.borrow.}
{.pragma: impftHdr, header: "/home/gt/wrappers/freetype/ft.h".}
{.experimental: "codeReordering".}
defineEnum(FT_Pixel_Mode) ## ```
## ********************************************************************
##
## <Enum>
## FT_Pixel_Mode
##
## <Description>
## An enumeration type used to describe the format of pixels in a
## given bitmap. Note that additional formats may be added in the
## future.
##
## <Values>
## FT_PIXEL_MODE_NONE ::
## Value~0 is reserved.
##
## FT_PIXEL_MODE_MONO ::
## A monochrome bitmap, using 1~bit per pixel. Note that pixels
## are stored in most-significant order (MSB), which means that
## the left-most pixel in a byte has value 128.
##
## FT_PIXEL_MODE_GRAY ::
## An 8-bit bitmap, generally used to represent anti-aliased glyph
## images. Each pixel is stored in one byte. Note that the number
## of gray' levels is stored in the num_grays' field of the
## @FT_Bitmap structure (it generally is 256).
##
## FT_PIXEL_MODE_GRAY2 ::
## A 2-bit per pixel bitmap, used to represent embedded
## anti-aliased bitmaps in font files according to the OpenType
## specification. We haven't found a single font using this
## format, however.
##
## FT_PIXEL_MODE_GRAY4 ::
## A 4-bit per pixel bitmap, representing embedded anti-aliased
## bitmaps in font files according to the OpenType specification.
## We haven't found a single font using this format, however.
##
## FT_PIXEL_MODE_LCD ::
## An 8-bit bitmap, representing RGB or BGR decimated glyph images
## used for display on LCD displays; the bitmap is three times
## wider than the original glyph image. See also
## @FT_RENDER_MODE_LCD.
##
## FT_PIXEL_MODE_LCD_V ::
## An 8-bit bitmap, representing RGB or BGR decimated glyph images
## used for display on rotated LCD displays; the bitmap is three
## times taller than the original glyph image. See also
## @FT_RENDER_MODE_LCD_V.
##
## FT_PIXEL_MODE_BGRA ::
## An image with four 8-bit channels per pixel, representing a
## color image (such as emoticons) with alpha channel. For each
## pixel, the format is BGRA, which means, the blue channel comes
## first in memory. The color channels are pre-multiplied and in
## the sRGB colorspace. For example, full red at half-translucent
## opacity will be represented as 00,00,80,80', not 00,00,FF,80'.
## See also @FT_LOAD_COLOR.
## ```
defineEnum(FT_Glyph_Format) ## ```
## ********************************************************************
##
## <Enum>
## FT_Glyph_Format
##
## <Description>
## An enumeration type used to describe the format of a given glyph
## image. Note that this version of FreeType only supports two image
## formats, even though future font drivers will be able to register
## their own format.
##
## <Values>
## FT_GLYPH_FORMAT_NONE ::
## The value~0 is reserved.
##
## FT_GLYPH_FORMAT_COMPOSITE ::
## The glyph image is a composite of several other images. This
## format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to
## report compound glyphs (like accented characters).
##
## FT_GLYPH_FORMAT_BITMAP ::
## The glyph image is a bitmap, and can be described as an
## @FT_Bitmap. You generally need to access the bitmap' field of
## the @FT_GlyphSlotRec structure to read it.
##
## FT_GLYPH_FORMAT_OUTLINE ::
## The glyph image is a vectorial outline made of line segments
## and Bézier arcs; it can be described as an @FT_Outline; you
## generally want to access the outline' field of the
## @FT_GlyphSlotRec structure to read it.
##
## FT_GLYPH_FORMAT_PLOTTER ::
## The glyph image is a vectorial path with no inside and outside
## contours. Some Type~1 fonts, like those in the Hershey family,
## contain glyphs in this format. These are described as
## @FT_Outline, but FreeType isn't currently capable of rendering
## them correctly.
## ```
defineEnum(Enum_fth1)
defineEnum(Enum_fth2)
const
FT_RENDER_POOL_SIZE* = 16384'i32
FT_MAX_MODULES* = 32
TT_CONFIG_OPTION_SUBPIXEL_HINTING* = 2
TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES* = 1000000'i32
T1_MAX_DICT_DEPTH* = 5
T1_MAX_SUBRS_CALLS* = 16
T1_MAX_CHARSTRINGS_OPERANDS* = 256
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1* = 500
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1* = 400
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2* = 1000
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2* = 275
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3* = 1667
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3* = 275
CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4* = 2333
CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4* = 0
HAVE_UNISTD_H* = 1
HAVE_FCNTL_H* = 1
HAVE_STDINT_H* = 1
FT_END_STMNT* = (0)
FT_PIXEL_MODE_NONE* = (0).FT_Pixel_Mode
FT_PIXEL_MODE_MONO* = (FT_PIXEL_MODE_NONE + 1).FT_Pixel_Mode
FT_PIXEL_MODE_GRAY* = (FT_PIXEL_MODE_MONO + 1).FT_Pixel_Mode
FT_PIXEL_MODE_GRAY2* = (FT_PIXEL_MODE_GRAY + 1).FT_Pixel_Mode
FT_PIXEL_MODE_GRAY4* = (FT_PIXEL_MODE_GRAY2 + 1).FT_Pixel_Mode
FT_PIXEL_MODE_LCD* = (FT_PIXEL_MODE_GRAY4 + 1).FT_Pixel_Mode
FT_PIXEL_MODE_LCD_V* = (FT_PIXEL_MODE_LCD + 1).FT_Pixel_Mode
FT_PIXEL_MODE_BGRA* = (FT_PIXEL_MODE_LCD_V + 1).FT_Pixel_Mode
FT_PIXEL_MODE_MAX* = (FT_PIXEL_MODE_BGRA + 1).FT_Pixel_Mode ## ```
## do not remove
## ```
FT_OUTLINE_NONE* = 0x00000000
FT_OUTLINE_OWNER* = 0x00000001
FT_OUTLINE_EVEN_ODD_FILL* = 0x00000002
FT_OUTLINE_REVERSE_FILL* = 0x00000004
FT_OUTLINE_IGNORE_DROPOUTS* = 0x00000008
FT_OUTLINE_SMART_DROPOUTS* = 0x00000010
FT_OUTLINE_INCLUDE_STUBS* = 0x00000020
FT_OUTLINE_HIGH_PRECISION* = 0x00000100
FT_OUTLINE_SINGLE_PASS* = 0x00000200
FT_CURVE_TAG_ON* = 1
FT_CURVE_TAG_CONIC* = 0
FT_CURVE_TAG_CUBIC* = 2
FT_CURVE_TAG_HAS_SCANMODE* = 4
FT_CURVE_TAG_TOUCH_X* = 8
FT_CURVE_TAG_TOUCH_Y* = 16
FT_CURVE_TAG_TOUCH_BOTH* = (
FT_CURVE_TAG_TOUCH_X or typeof(FT_CURVE_TAG_TOUCH_X)(FT_CURVE_TAG_TOUCH_Y))
FT_GLYPH_FORMAT_NONE* = (((cast[culong](0) shl typeof(cast[culong](0))(24)) or
typeof(cast[culong](0))((cast[culong](0) shl typeof(cast[culong](0))(16))) or
typeof(cast[culong](0))((cast[culong](0) shl typeof(cast[culong](0))(8))) or
typeof(cast[culong](0))(cast[culong](0)))).FT_Glyph_Format
FT_GLYPH_FORMAT_COMPOSITE* = (((cast[culong]('c') shl
typeof(cast[culong]('c'))(24)) or
typeof(cast[culong]('c'))((cast[culong]('o') shl
typeof(cast[culong]('c'))(16))) or
typeof(cast[culong]('c'))((cast[culong]('m') shl
typeof(cast[culong]('c'))(8))) or
typeof(cast[culong]('c'))(cast[culong]('p')))).FT_Glyph_Format
FT_GLYPH_FORMAT_BITMAP* = (((cast[culong]('b') shl typeof(cast[culong]('b'))(24)) or
typeof(cast[culong]('b'))((cast[culong]('i') shl
typeof(cast[culong]('b'))(16))) or
typeof(cast[culong]('b'))((cast[culong]('t') shl
typeof(cast[culong]('b'))(8))) or
typeof(cast[culong]('b'))(cast[culong]('s')))).FT_Glyph_Format
FT_GLYPH_FORMAT_OUTLINE* = (((cast[culong]('o') shl
typeof(cast[culong]('o'))(24)) or
typeof(cast[culong]('o'))((cast[culong]('u') shl
typeof(cast[culong]('o'))(16))) or
typeof(cast[culong]('o'))((cast[culong]('t') shl
typeof(cast[culong]('o'))(8))) or
typeof(cast[culong]('o'))(cast[culong]('l')))).FT_Glyph_Format
FT_GLYPH_FORMAT_PLOTTER* = (((cast[culong]('p') shl
typeof(cast[culong]('p'))(24)) or
typeof(cast[culong]('p'))((cast[culong]('l') shl
typeof(cast[culong]('p'))(16))) or
typeof(cast[culong]('p'))((cast[culong]('o') shl
typeof(cast[culong]('p'))(8))) or
typeof(cast[culong]('p'))(cast[culong]('t')))).FT_Glyph_Format
FT_RASTER_FLAG_DEFAULT* = 0x00000000
FT_RASTER_FLAG_AA* = 0x00000001
FT_RASTER_FLAG_DIRECT* = 0x00000002
FT_RASTER_FLAG_CLIP* = 0x00000004
FT_Mod_Err_Base* = (0).cint
FT_Mod_Err_Autofit* = (0).cint
FT_Mod_Err_BDF* = (0).cint
FT_Mod_Err_Bzip2* = (0).cint
FT_Mod_Err_Cache* = (0).cint
FT_Mod_Err_CFF* = (0).cint
FT_Mod_Err_CID* = (0).cint
FT_Mod_Err_Gzip* = (0).cint
FT_Mod_Err_LZW* = (0).cint
FT_Mod_Err_OTvalid* = (0).cint
FT_Mod_Err_PCF* = (0).cint
FT_Mod_Err_PFR* = (0).cint
FT_Mod_Err_PSaux* = (0).cint
FT_Mod_Err_PShinter* = (0).cint
FT_Mod_Err_PSnames* = (0).cint
FT_Mod_Err_Raster* = (0).cint
FT_Mod_Err_SFNT* = (0).cint
FT_Mod_Err_Smooth* = (0).cint
FT_Mod_Err_TrueType* = (0).cint
FT_Mod_Err_Type1* = (0).cint
FT_Mod_Err_Type42* = (0).cint
FT_Mod_Err_Winfonts* = (0).cint
FT_Mod_Err_GXvalid* = (0).cint
FT_Mod_Err_Max* = (FT_Mod_Err_GXvalid + 1).cint
FT_ERR_BASE* = 0
FT_Err_Ok* = (0x00000000).cint
FT_Err_Cannot_Open_Resource* = (0x00000001 + typeof(0x00000001)(0)).cint
FT_Err_Unknown_File_Format* = (0x00000002 + typeof(0x00000002)(0)).cint
FT_Err_Invalid_File_Format* = (0x00000003 + typeof(0x00000003)(0)).cint
FT_Err_Invalid_Version* = (0x00000004 + typeof(0x00000004)(0)).cint
FT_Err_Lower_Module_Version* = (0x00000005 + typeof(0x00000005)(0)).cint
FT_Err_Invalid_Argument* = (0x00000006 + typeof(0x00000006)(0)).cint
FT_Err_Unimplemented_Feature* = (0x00000007 + typeof(0x00000007)(0)).cint
FT_Err_Invalid_Table* = (0x00000008 + typeof(0x00000008)(0)).cint
FT_Err_Invalid_Offset* = (0x00000009 + typeof(0x00000009)(0)).cint
FT_Err_Array_Too_Large* = (0x0000000A + typeof(0x0000000A)(0)).cint
FT_Err_Missing_Module* = (0x0000000B + typeof(0x0000000B)(0)).cint
FT_Err_Missing_Property* = (0x0000000C + typeof(0x0000000C)(0)).cint
FT_Err_Invalid_Glyph_Index* = (0x00000010 + typeof(0x00000010)(0)).cint
FT_Err_Invalid_Character_Code* = (0x00000011 + typeof(0x00000011)(0)).cint
FT_Err_Invalid_Glyph_Format* = (0x00000012 + typeof(0x00000012)(0)).cint
FT_Err_Cannot_Render_Glyph* = (0x00000013 + typeof(0x00000013)(0)).cint
FT_Err_Invalid_Outline* = (0x00000014 + typeof(0x00000014)(0)).cint
FT_Err_Invalid_Composite* = (0x00000015 + typeof(0x00000015)(0)).cint
FT_Err_Too_Many_Hints* = (0x00000016 + typeof(0x00000016)(0)).cint
FT_Err_Invalid_Pixel_Size* = (0x00000017 + typeof(0x00000017)(0)).cint
FT_Err_Invalid_Handle* = (0x00000020 + typeof(0x00000020)(0)).cint
FT_Err_Invalid_Library_Handle* = (0x00000021 + typeof(0x00000021)(0)).cint
FT_Err_Invalid_Driver_Handle* = (0x00000022 + typeof(0x00000022)(0)).cint
FT_Err_Invalid_Face_Handle* = (0x00000023 + typeof(0x00000023)(0)).cint
FT_Err_Invalid_Size_Handle* = (0x00000024 + typeof(0x00000024)(0)).cint
FT_Err_Invalid_Slot_Handle* = (0x00000025 + typeof(0x00000025)(0)).cint
FT_Err_Invalid_CharMap_Handle* = (0x00000026 + typeof(0x00000026)(0)).cint
FT_Err_Invalid_Cache_Handle* = (0x00000027 + typeof(0x00000027)(0)).cint
FT_Err_Invalid_Stream_Handle* = (0x00000028 + typeof(0x00000028)(0)).cint
FT_Err_Too_Many_Drivers* = (0x00000030 + typeof(0x00000030)(0)).cint
FT_Err_Too_Many_Extensions* = (0x00000031 + typeof(0x00000031)(0)).cint
FT_Err_Out_Of_Memory* = (0x00000040 + typeof(0x00000040)(0)).cint
FT_Err_Unlisted_Object* = (0x00000041 + typeof(0x00000041)(0)).cint
FT_Err_Cannot_Open_Stream* = (0x00000051 + typeof(0x00000051)(0)).cint
FT_Err_Invalid_Stream_Seek* = (0x00000052 + typeof(0x00000052)(0)).cint
FT_Err_Invalid_Stream_Skip* = (0x00000053 + typeof(0x00000053)(0)).cint
FT_Err_Invalid_Stream_Read* = (0x00000054 + typeof(0x00000054)(0)).cint
FT_Err_Invalid_Stream_Operation* = (0x00000055 + typeof(0x00000055)(0)).cint
FT_Err_Invalid_Frame_Operation* = (0x00000056 + typeof(0x00000056)(0)).cint
FT_Err_Nested_Frame_Access* = (0x00000057 + typeof(0x00000057)(0)).cint
FT_Err_Invalid_Frame_Read* = (0x00000058 + typeof(0x00000058)(0)).cint
FT_Err_Raster_Uninitialized* = (0x00000060 + typeof(0x00000060)(0)).cint
FT_Err_Raster_Corrupted* = (0x00000061 + typeof(0x00000061)(0)).cint
FT_Err_Raster_Overflow* = (0x00000062 + typeof(0x00000062)(0)).cint
FT_Err_Raster_Negative_Height* = (0x00000063 + typeof(0x00000063)(0)).cint
FT_Err_Too_Many_Caches* = (0x00000070 + typeof(0x00000070)(0)).cint
FT_Err_Invalid_Opcode* = (0x00000080 + typeof(0x00000080)(0)).cint
FT_Err_Too_Few_Arguments* = (0x00000081 + typeof(0x00000081)(0)).cint
FT_Err_Stack_Overflow* = (0x00000082 + typeof(0x00000082)(0)).cint
FT_Err_Code_Overflow* = (0x00000083 + typeof(0x00000083)(0)).cint
FT_Err_Bad_Argument* = (0x00000084 + typeof(0x00000084)(0)).cint
FT_Err_Divide_By_Zero* = (0x00000085 + typeof(0x00000085)(0)).cint
FT_Err_Invalid_Reference* = (0x00000086 + typeof(0x00000086)(0)).cint
FT_Err_Debug_OpCode* = (0x00000087 + typeof(0x00000087)(0)).cint
FT_Err_ENDF_In_Exec_Stream* = (0x00000088 + typeof(0x00000088)(0)).cint
FT_Err_Nested_DEFS* = (0x00000089 + typeof(0x00000089)(0)).cint
FT_Err_Invalid_CodeRange* = (0x0000008A + typeof(0x0000008A)(0)).cint
FT_Err_Execution_Too_Long* = (0x0000008B + typeof(0x0000008B)(0)).cint
FT_Err_Too_Many_Function_Defs* = (0x0000008C + typeof(0x0000008C)(0)).cint
FT_Err_Too_Many_Instruction_Defs* = (0x0000008D + typeof(0x0000008D)(0)).cint
FT_Err_Table_Missing* = (0x0000008E + typeof(0x0000008E)(0)).cint
FT_Err_Horiz_Header_Missing* = (0x0000008F + typeof(0x0000008F)(0)).cint
FT_Err_Locations_Missing* = (0x00000090 + typeof(0x00000090)(0)).cint
FT_Err_Name_Table_Missing* = (0x00000091 + typeof(0x00000091)(0)).cint
FT_Err_CMap_Table_Missing* = (0x00000092 + typeof(0x00000092)(0)).cint
FT_Err_Hmtx_Table_Missing* = (0x00000093 + typeof(0x00000093)(0)).cint
FT_Err_Post_Table_Missing* = (0x00000094 + typeof(0x00000094)(0)).cint
FT_Err_Invalid_Horiz_Metrics* = (0x00000095 + typeof(0x00000095)(0)).cint
FT_Err_Invalid_CharMap_Format* = (0x00000096 + typeof(0x00000096)(0)).cint
FT_Err_Invalid_PPem* = (0x00000097 + typeof(0x00000097)(0)).cint
FT_Err_Invalid_Vert_Metrics* = (0x00000098 + typeof(0x00000098)(0)).cint
FT_Err_Could_Not_Find_Context* = (0x00000099 + typeof(0x00000099)(0)).cint
FT_Err_Invalid_Post_Table_Format* = (0x0000009A + typeof(0x0000009A)(0)).cint
FT_Err_Invalid_Post_Table* = (0x0000009B + typeof(0x0000009B)(0)).cint
FT_Err_DEF_In_Glyf_Bytecode* = (0x0000009C + typeof(0x0000009C)(0)).cint
FT_Err_Missing_Bitmap* = (0x0000009D + typeof(0x0000009D)(0)).cint
FT_Err_Syntax_Error* = (0x000000A0 + typeof(0x000000A0)(0)).cint
FT_Err_Stack_Underflow* = (0x000000A1 + typeof(0x000000A1)(0)).cint
FT_Err_Ignore* = (0x000000A2 + typeof(0x000000A2)(0)).cint
FT_Err_No_Unicode_Glyph_Name* = (0x000000A3 + typeof(0x000000A3)(0)).cint
FT_Err_Glyph_Too_Big* = (0x000000A4 + typeof(0x000000A4)(0)).cint
FT_Err_Missing_Startfont_Field* = (0x000000B0 + typeof(0x000000B0)(0)).cint
FT_Err_Missing_Font_Field* = (0x000000B1 + typeof(0x000000B1)(0)).cint
FT_Err_Missing_Size_Field* = (0x000000B2 + typeof(0x000000B2)(0)).cint
FT_Err_Missing_Fontboundingbox_Field* = (0x000000B3 + typeof(0x000000B3)(0)).cint
FT_Err_Missing_Chars_Field* = (0x000000B4 + typeof(0x000000B4)(0)).cint
FT_Err_Missing_Startchar_Field* = (0x000000B5 + typeof(0x000000B5)(0)).cint
FT_Err_Missing_Encoding_Field* = (0x000000B6 + typeof(0x000000B6)(0)).cint
FT_Err_Missing_Bbx_Field* = (0x000000B7 + typeof(0x000000B7)(0)).cint
FT_Err_Bbx_Too_Big* = (0x000000B8 + typeof(0x000000B8)(0)).cint
FT_Err_Corrupted_Font_Header* = (0x000000B9 + typeof(0x000000B9)(0)).cint
FT_Err_Corrupted_Font_Glyphs* = (0x000000BA + typeof(0x000000BA)(0)).cint
FT_Err_Max* = (FT_Err_Corrupted_Font_Glyphs + 1).cint
FREETYPE_MAJOR* = 2
FREETYPE_MINOR* = 8
FREETYPE_PATCH* = 1
type
FT_RasterRec = object
FT_LibraryRec = object
FT_ModuleRec = object
FT_DriverRec = object
FT_RendererRec = object
FT_FaceRec = object
FT_SizeRec = object
FT_GlyphSlotRec = object
FT_CharMapRec = object
FT_Int16* {.importc, impftHdr.} = cshort ## ```
## ********************************************************************
##
## AUTOMATIC CONFIGURATION MACROS
##
## These macros are computed from the ones defined above. Don't touch
## their definition, unless you know precisely what you are doing. No
## porter should need to mess with them.
##
## ********************************************************************
## ********************************************************************
##
## Mac support
##
## This is the only necessary change, so it is defined here instead
## providing a new configuration file.
##
## Fix compiler warning with sgi compiler
## ********************************************************************
##
## <Section>
## basic_types
##
## ********************************************************************
## ********************************************************************
##
## <Type>
## FT_Int16
##
## <Description>
## A typedef for a 16bit signed integer type.
## ```
FT_UInt16* {.importc, impftHdr.} = cushort ## ```
## ********************************************************************
##
## <Type>
## FT_UInt16
##
## <Description>
## A typedef for a 16bit unsigned integer type.
## ```
FT_Int32* {.importc, impftHdr.} = cint ## ```
## this #if 0 ... #endif clause is for documentation purposes
## ```
FT_Fast* {.importc, impftHdr.} = cint
FT_UFast* {.importc, impftHdr.} = cuint ## ```
## determine whether we have a 64-bit int type
## (mostly for environments without autoconf')
## FT_LONG64 must be defined if a 64-bit type is available
## ```
FT_Int64* {.importc, impftHdr.} = clong ## ```
## we handle the LLP64 scheme separately for GCC and clang,
## suppressing the long long' warning
## ```
FT_UInt64* {.importc, impftHdr.} = culong
FT_Memory* {.importc, impftHdr.} = ptr FT_MemoryRec ## ```
## **********************************************************************
##
## ft2build.h
##
## FreeType 2 build and setup macros.
##
## Copyright 1996-2017 by
## David Turner, Robert Wilhelm, and Werner Lemberg.
##
## This file is part of the FreeType project, and may only be used,
## modified, and distributed under the terms of the FreeType project
## license, LICENSE.TXT. By continuing to use, modify, or distribute
## this file you indicate that you have read the license and
## understand and accept it fully.
##
## **********************************************************************
## ********************************************************************
##
## This is the entry point' for FreeType header file inclusions. It is
## the only header file which should be included directly; all other
## FreeType header files should be accessed with macro names (after
## including ft2build.h').
##
## A typical example is
##
## #include <ft2build.h>
## #include FT_FREETYPE_H
##
## ********************************************************************
## END
## nothing
## ********************************************************************
##
## <Section>
## system_interface
##
## <Title>
## System Interface
##
## <Abstract>
## How FreeType manages memory and i/o.
##
## <Description>
## This section contains various definitions related to memory
## management and i/o access. You need to understand this
## information if you want to use a custom memory manager or you own
## i/o streams.
##
## ********************************************************************
## ********************************************************************
##
## M E M O R Y M A N A G E M E N T
##
## ********************************************************************
## **********************************************************************
##
## @type:
## FT_Memory
##
## @description:
## A handle to a given memory manager object, defined with an
## @FT_MemoryRec structure.
## ```
FT_Alloc_Func* {.importc, impftHdr.} = proc (memory: FT_Memory; size: clong): pointer {.
cdecl.}
FT_Free_Func* {.importc, impftHdr.} = proc (memory: FT_Memory; `block`: pointer) {.
cdecl.}
FT_Realloc_Func* {.importc, impftHdr.} = proc (memory: FT_Memory; cur_size: clong;
new_size: clong; `block`: pointer): pointer {.cdecl.}
FT_MemoryRec* {.bycopy, impftHdr, importc: "struct FT_MemoryRec_".} = object
user*: pointer
alloc*: FT_Alloc_Func
free*: FT_Free_Func
realloc*: FT_Realloc_Func
FT_Stream* {.importc, impftHdr.} = ptr FT_StreamRec ## ```
## ********************************************************************
##
## I / O M A N A G E M E N T
##
## ********************************************************************
## **********************************************************************
##
## @type:
## FT_Stream
##
## @description:
## A handle to an input stream.
##
## @also:
## See @FT_StreamRec for the publicly accessible fields of a given
## stream object.
## ```
FT_StreamDesc* {.union, bycopy, impftHdr, importc: "union FT_StreamDesc_".} = object ## ```
## **********************************************************************
##
## @struct:
## FT_StreamDesc
##
## @description:
## A union type used to store either a long or a pointer. This is used
## to store a file descriptor or a FILE*' in an input stream.
## ```
value*: clong
pointer*: pointer
FT_Stream_IoFunc* {.importc, impftHdr.} = proc (stream: FT_Stream; offset: culong;
buffer: ptr cuchar; count: culong): culong {.cdecl.}
FT_Stream_CloseFunc* {.importc, impftHdr.} = proc (stream: FT_Stream) {.cdecl.}
FT_StreamRec* {.bycopy, impftHdr, importc: "struct FT_StreamRec_".} = object ## ```
## **********************************************************************
##
## @struct:
## FT_StreamRec
##
## @description:
## A structure used to describe an input stream.
##
## @input:
## base ::
## For memory-based streams, this is the address of the first stream
## byte in memory. This field should always be set to NULL for
## disk-based streams.
##
## size ::
## The stream size in bytes.
##
## In case of compressed streams where the size is unknown before
## actually doing the decompression, the value is set to 0x7FFFFFFF.
## (Note that this size value can occur for normal streams also; it is
## thus just a hint.)
##
## pos ::
## The current position within the stream.
##
## descriptor ::
## This field is a union that can hold an integer or a pointer. It is
## used by stream implementations to store file descriptors or FILE*'
## pointers.
##
## pathname ::
## This field is completely ignored by FreeType. However, it is often
## useful during debugging to use it to store the stream's filename
## (where available).
##
## read ::
## The stream's input function.
##
## close ::
## The stream's close function.
##
## memory ::
## The memory manager to use to preload frames. This is set
## internally by FreeType and shouldn't be touched by stream
## implementations.
##
## cursor ::
## This field is set and used internally by FreeType when parsing
## frames.
##
## limit ::
## This field is set and used internally by FreeType when parsing
## frames.
## ```
base*: ptr cuchar
size*: culong
pos*: culong
descriptor*: FT_StreamDesc
pathname*: FT_StreamDesc
read*: FT_Stream_IoFunc
close*: FT_Stream_CloseFunc
memory*: FT_Memory
cursor*: ptr cuchar
limit*: ptr cuchar
FT_Pos* {.importc, impftHdr.} = clong ## ```
## **********************************************************************
##
## ft2build.h
##
## FreeType 2 build and setup macros.
##
## Copyright 1996-2017 by
## David Turner, Robert Wilhelm, and Werner Lemberg.
##
## This file is part of the FreeType project, and may only be used,
## modified, and distributed under the terms of the FreeType project
## license, LICENSE.TXT. By continuing to use, modify, or distribute
## this file you indicate that you have read the license and
## understand and accept it fully.
##
## **********************************************************************
## ********************************************************************
##
## This is the entry point' for FreeType header file inclusions. It is
## the only header file which should be included directly; all other
## FreeType header files should be accessed with macro names (after
## including ft2build.h').
##
## A typical example is
##
## #include <ft2build.h>
## #include FT_FREETYPE_H
##
## ********************************************************************
## END
## nothing
## ********************************************************************
##
## <Section>
## basic_types
##
## ********************************************************************
## ********************************************************************
##
## <Type>
## FT_Pos
##
## <Description>
## The type FT_Pos is used to store vectorial coordinates. Depending
## on the context, these can represent distances in integer font
## units, or 16.16, or 26.6 fixed-point pixel coordinates.
## ```
FT_Vector* {.bycopy, impftHdr, importc: "struct FT_Vector_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_Vector
##
## <Description>
## A simple structure used to store a 2D vector; coordinates are of
## the FT_Pos type.
##
## <Fields>
## x :: The horizontal coordinate.
## y :: The vertical coordinate.
## ```
x*: FT_Pos
y*: FT_Pos
FT_BBox* {.bycopy, impftHdr, importc: "struct FT_BBox_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_BBox
##
## <Description>
## A structure used to hold an outline's bounding box, i.e., the
## coordinates of its extrema in the horizontal and vertical
## directions.
##
## <Fields>
## xMin :: The horizontal minimum (left-most).
##
## yMin :: The vertical minimum (bottom-most).
##
## xMax :: The horizontal maximum (right-most).
##
## yMax :: The vertical maximum (top-most).
##
## <Note>
## The bounding box is specified with the coordinates of the lower
## left and the upper right corner. In PostScript, those values are
## often called (llx,lly) and (urx,ury), respectively.
##
## If yMin' is negative, this value gives the glyph's descender.
## Otherwise, the glyph doesn't descend below the baseline.
## Similarly, if ymax' is positive, this value gives the glyph's
## ascender.
##
## xMin' gives the horizontal distance from the glyph's origin to
## the left edge of the glyph's bounding box. If xMin' is negative,
## the glyph extends to the left of the origin.
## ```
xMin*: FT_Pos
yMin*: FT_Pos
xMax*: FT_Pos
yMax*: FT_Pos
FT_Bitmap* {.bycopy, impftHdr, importc: "struct FT_Bitmap_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_Bitmap
##
## <Description>
## A structure used to describe a bitmap or pixmap to the raster.
## Note that we now manage pixmaps of various depths through the
## pixel_mode' field.
##
## <Fields>
## rows :: The number of bitmap rows.
##
## width :: The number of pixels in bitmap row.
##
## pitch :: The pitch's absolute value is the number of bytes
## taken by one bitmap row, including padding.
## However, the pitch is positive when the bitmap has
## a down' flow, and negative when it has an up'
## flow. In all cases, the pitch is an offset to add
## to a bitmap pointer in order to go down one row.
##
## Note that padding' means the alignment of a
## bitmap to a byte border, and FreeType functions
## normally align to the smallest possible integer
## value.
##
## For the B/W rasterizer, pitch' is always an even
## number.
##
## To change the pitch of a bitmap (say, to make it a
## multiple of 4), use @FT_Bitmap_Convert.
## Alternatively, you might use callback functions to
## directly render to the application's surface; see
## the file example2.cpp' in the tutorial for a
## demonstration.
##
## buffer :: A typeless pointer to the bitmap buffer. This
## value should be aligned on 32-bit boundaries in
## most cases.
##
## num_grays :: This field is only used with
## @FT_PIXEL_MODE_GRAY; it gives the number of gray
## levels used in the bitmap.
##
## pixel_mode :: The pixel mode, i.e., how pixel bits are stored.
## See @FT_Pixel_Mode for possible values.
##
## palette_mode :: This field is intended for paletted pixel modes;
## it indicates how the palette is stored. Not
## used currently.
##
## palette :: A typeless pointer to the bitmap palette; this
## field is intended for paletted pixel modes. Not
## used currently.
## ```
rows*: cuint
width*: cuint
pitch*: cint
buffer*: ptr cuchar
num_grays*: cushort
pixel_mode*: cuchar
palette_mode*: cuchar
palette*: pointer
FT_Outline* {.bycopy, impftHdr, importc: "struct FT_Outline_".} = object ## ```
## ********************************************************************
##
## <Section>
## outline_processing
##
## ********************************************************************
## ********************************************************************
##
## <Struct>
## FT_Outline
##
## <Description>
## This structure is used to describe an outline to the scan-line
## converter.
##
## <Fields>
## n_contours :: The number of contours in the outline.
##
## n_points :: The number of points in the outline.
##
## points :: A pointer to an array of n_points' @FT_Vector
## elements, giving the outline's point coordinates.
##
## tags :: A pointer to an array of n_points' chars, giving
## each outline point's type.
##
## If bit~0 is unset, the point is off' the curve,
## i.e., a Bézier control point, while it is on' if
## set.
##
## Bit~1 is meaningful for off' points only. If set,
## it indicates a third-order Bézier arc control point;
## and a second-order control point if unset.
##
## If bit~2 is set, bits 5-7 contain the drop-out mode
## (as defined in the OpenType specification; the value
## is the same as the argument to the SCANMODE
## instruction).
##
## Bits 3 and~4 are reserved for internal purposes.
##
## contours :: An array of n_contours' shorts, giving the end
## point of each contour within the outline. For
## example, the first contour is defined by the points
## 0' to contours[0]', the second one is defined by
## the points contours[0]+1' to contours[1]', etc.
##
## flags :: A set of bit flags used to characterize the outline
## and give hints to the scan-converter and hinter on
## how to convert/grid-fit it. See @FT_OUTLINE_XXX.
##
## <Note>
## The B/W rasterizer only checks bit~2 in the tags' array for the
## first point of each contour. The drop-out mode as given with
## @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and
## @FT_OUTLINE_INCLUDE_STUBS in flags' is then overridden.
## ```
n_contours*: cshort ## ```
## number of contours in glyph
## ```
n_points*: cshort ## ```
## number of points in the glyph
## ```
points*: ptr FT_Vector ## ```
## the outline's points
## ```
tags*: cstring ## ```
## the points flags
## ```
contours*: ptr cshort ## ```
## the contour end points
## ```
flags*: cint ## ```
## outline masks
## ```
FT_Outline_MoveToFunc* {.importc, impftHdr.} = proc (to: ptr FT_Vector; user: pointer): cint {.
cdecl.}
FT_Outline_LineToFunc* {.importc, impftHdr.} = proc (to: ptr FT_Vector; user: pointer): cint {.
cdecl.}
FT_Outline_ConicToFunc* {.importc, impftHdr.} = proc (control: ptr FT_Vector;
to: ptr FT_Vector; user: pointer): cint {.cdecl.}
FT_Outline_CubicToFunc* {.importc, impftHdr.} = proc (control1: ptr FT_Vector;
control2: ptr FT_Vector; to: ptr FT_Vector; user: pointer): cint {.cdecl.}
FT_Outline_Funcs* {.bycopy, impftHdr, importc: "struct FT_Outline_Funcs_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_Outline_Funcs
##
## <Description>
## A structure to hold various function pointers used during outline
## decomposition in order to emit segments, conic, and cubic Béziers.
##
## <Fields>
## move_to :: The move to' emitter.
##
## line_to :: The segment emitter.
##
## conic_to :: The second-order Bézier arc emitter.
##
## cubic_to :: The third-order Bézier arc emitter.
##
## shift :: The shift that is applied to coordinates before they
## are sent to the emitter.
##
## delta :: The delta that is applied to coordinates before they
## are sent to the emitter, but after the shift.
##
## <Note>
## The point coordinates sent to the emitters are the transformed
## version of the original coordinates (this is important for high
## accuracy during scan-conversion). The transformation is simple:
##
## {
## x' = (x << shift) - delta
## y' = (y << shift) - delta
## }
##
## Set the values of shift' and delta' to~0 to get the original
## point coordinates.
## ```
move_to*: FT_Outline_MoveToFunc
line_to*: FT_Outline_LineToFunc
conic_to*: FT_Outline_ConicToFunc
cubic_to*: FT_Outline_CubicToFunc
shift*: cint
delta*: FT_Pos
FT_Raster* {.importc, impftHdr.} = ptr FT_RasterRec ## ```
## ********************************************************************
## ********************************************************************
## ********************************************************************
## ** **
## ** R A S T E R D E F I N I T I O N S **
## ** **
## ********************************************************************
## ********************************************************************
## ********************************************************************
## ********************************************************************
##
## A raster is a scan converter, in charge of rendering an outline into
## a bitmap. This section contains the public API for rasters.
##
## Note that in FreeType 2, all rasters are now encapsulated within
## specific modules called renderers'. See ftrender.h' for more
## details on renderers.
##
## ********************************************************************
## ********************************************************************
##
## <Section>
## raster
##
## <Title>
## Scanline Converter
##
## <Abstract>
## How vectorial outlines are converted into bitmaps and pixmaps.
##
## <Description>
## This section contains technical definitions.
##
## <Order>
## FT_Raster
## FT_Span
## FT_SpanFunc
##
## FT_Raster_Params
## FT_RASTER_FLAG_XXX
##
## FT_Raster_NewFunc
## FT_Raster_DoneFunc
## FT_Raster_ResetFunc
## FT_Raster_SetModeFunc
## FT_Raster_RenderFunc
## FT_Raster_Funcs
##
## ********************************************************************
## ********************************************************************
##
## <Type>
## FT_Raster
##
## <Description>
## An opaque handle (pointer) to a raster object. Each object can be
## used independently to convert an outline into a bitmap or pixmap.
## ```
FT_Span* {.bycopy, impftHdr, importc: "struct FT_Span_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_Span
##
## <Description>
## A structure used to model a single span of gray pixels when
## rendering an anti-aliased bitmap.
##
## <Fields>
## x :: The span's horizontal start position.
##
## len :: The span's length in pixels.
##
## coverage :: The span color/coverage, ranging from 0 (background)
## to 255 (foreground).
##
## <Note>
## This structure is used by the span drawing callback type named
## @FT_SpanFunc that takes the y~coordinate of the span as a
## parameter.
##
## The coverage value is always between 0 and 255. If you want less
## gray values, the callback function has to reduce them.
## ```
x*: cshort
len*: cushort
coverage*: cuchar
FT_SpanFunc* {.importc, impftHdr.} = proc (y: cint; count: cint; spans: ptr FT_Span;
user: pointer) {.cdecl.}
FT_Raster_BitTest_Func* {.importc, impftHdr.} = proc (y: cint; x: cint; user: pointer): cint {.
cdecl.}
FT_Raster_BitSet_Func* {.importc, impftHdr.} = proc (y: cint; x: cint; user: pointer) {.
cdecl.}
FT_Raster_Params* {.bycopy, impftHdr, importc: "struct FT_Raster_Params_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_Raster_Params
##
## <Description>
## A structure to hold the arguments used by a raster's render
## function.
##
## <Fields>
## target :: The target bitmap.
##
## source :: A pointer to the source glyph image (e.g., an
## @FT_Outline).
##
## flags :: The rendering flags.
##
## gray_spans :: The gray span drawing callback.
##
## black_spans :: Unused.
##
## bit_test :: Unused.
##
## bit_set :: Unused.
##
## user :: User-supplied data that is passed to each drawing
## callback.
##
## clip_box :: An optional clipping box. It is only used in
## direct rendering mode. Note that coordinates here
## should be expressed in _integer_ pixels (and not in
## 26.6 fixed-point units).
##
## <Note>
## An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA
## bit flag is set in the flags' field, otherwise a monochrome
## bitmap is generated.
##
## If the @FT_RASTER_FLAG_DIRECT bit flag is set in flags', the
## raster will call the gray_spans' callback to draw gray pixel
## spans. This allows direct composition over a pre-existing bitmap
## through user-provided callbacks to perform the span drawing and
## composition. Not supported by the monochrome rasterizer.
## ```
target*: ptr FT_Bitmap
source*: pointer
flags*: cint
gray_spans*: FT_SpanFunc
black_spans*: FT_SpanFunc ## ```
## unused
## ```
bit_test*: FT_Raster_BitTest_Func ## ```
## unused
## ```
bit_set*: FT_Raster_BitSet_Func ## ```
## unused
## ```
user*: pointer ## ```
## unused
## ```
clip_box*: FT_BBox
FT_Raster_NewFunc* {.importc, impftHdr.} = proc (memory: pointer;
raster: ptr FT_Raster): cint {.cdecl.}
FT_Raster_DoneFunc* {.importc, impftHdr.} = proc (raster: FT_Raster) {.cdecl.}
FT_Raster_ResetFunc* {.importc, impftHdr.} = proc (raster: FT_Raster;
pool_base: ptr cuchar; pool_size: culong) {.cdecl.}
FT_Raster_SetModeFunc* {.importc, impftHdr.} = proc (raster: FT_Raster; mode: culong;
args: pointer): cint {.cdecl.}
FT_Raster_RenderFunc* {.importc, impftHdr.} = proc (raster: FT_Raster;
params: ptr FT_Raster_Params): cint {.cdecl.}
FT_Raster_Funcs* {.bycopy, impftHdr, importc: "struct FT_Raster_Funcs_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_Raster_Funcs
##
## <Description>
## A structure used to describe a given raster class to the library.
##
## <Fields>
## glyph_format :: The supported glyph format for this raster.
##
## raster_new :: The raster constructor.
##
## raster_reset :: Used to reset the render pool within the raster.
##
## raster_render :: A function to render a glyph into a given bitmap.
##
## raster_done :: The raster destructor.
## ```
glyph_format*: FT_Glyph_Format
raster_new*: FT_Raster_NewFunc
raster_reset*: FT_Raster_ResetFunc
raster_set_mode*: FT_Raster_SetModeFunc
raster_render*: FT_Raster_RenderFunc
raster_done*: FT_Raster_DoneFunc
FT_Bool* {.importc, impftHdr.} = cuchar ## ```
## nothing
## END
## Local Variables:
## coding: utf-8
## End:
## nothing
## ********************************************************************
##
## <Section>
## basic_types
##
## <Title>
## Basic Data Types
##
## <Abstract>
## The basic data types defined by the library.
##
## <Description>
## This section contains the basic data types defined by FreeType~2,
## ranging from simple scalar types to bitmap descriptors. More
## font-specific structures are defined in a different section.
##
## <Order>
## FT_Byte
## FT_Bytes
## FT_Char
## FT_Int
## FT_UInt
## FT_Int16
## FT_UInt16
## FT_Int32
## FT_UInt32
## FT_Int64
## FT_UInt64
## FT_Short
## FT_UShort
## FT_Long
## FT_ULong
## FT_Bool
## FT_Offset
## FT_PtrDist
## FT_String
## FT_Tag
## FT_Error
## FT_Fixed
## FT_Pointer
## FT_Pos
## FT_Vector
## FT_BBox
## FT_Matrix
## FT_FWord
## FT_UFWord
## FT_F2Dot14
## FT_UnitVector
## FT_F26Dot6
## FT_Data
##
## FT_MAKE_TAG
##
## FT_Generic
## FT_Generic_Finalizer
##
## FT_Bitmap
## FT_Pixel_Mode
## FT_Palette_Mode
## FT_Glyph_Format
## FT_IMAGE_TAG
##
## ********************************************************************
## ********************************************************************
##
## <Type>
## FT_Bool
##
## <Description>
## A typedef of unsigned char, used for simple booleans. As usual,
## values 1 and~0 represent true and false, respectively.
## ```
FT_FWord* {.importc, impftHdr.} = cshort ## ```
## distance in FUnits
## ********************************************************************
##
## <Type>
## FT_UFWord
##
## <Description>
## An unsigned 16-bit integer used to store a distance in original
## font units.
## ```
FT_UFWord* {.importc, impftHdr.} = cushort ## ```
## unsigned distance
## ********************************************************************
##
## <Type>
## FT_Char
##
## <Description>
## A simple typedef for the _signed_ char type.
## ```
FT_Char* {.importc, impftHdr.} = cschar ## ```
## unsigned distance
## ********************************************************************
##
## <Type>
## FT_Char
##
## <Description>
## A simple typedef for the _signed_ char type.
## ```
FT_Byte* {.importc, impftHdr.} = cuchar ## ```
## ********************************************************************
##
## <Type>
## FT_Byte
##
## <Description>
## A simple typedef for the _unsigned_ char type.
## ```
FT_Bytes* {.importc, impftHdr.} = ptr FT_Byte ## ```
## ********************************************************************
##
## <Type>
## FT_Bytes
##
## <Description>
## A typedef for constant memory areas.
## ```
FT_String* {.importc, impftHdr.} = cchar ## ```
## ********************************************************************
##
## <Type>
## FT_String
##
## <Description>
## A simple typedef for the char type, usually used for strings.
## ```
FT_Short* {.importc, impftHdr.} = cshort ## ```
## ********************************************************************
##
## <Type>
## FT_Short
##
## <Description>
## A typedef for signed short.
## ```
FT_UShort* {.importc, impftHdr.} = cushort ## ```
## ********************************************************************
##
## <Type>
## FT_UShort
##
## <Description>
## A typedef for unsigned short.
## ```
FT_Int* {.importc, impftHdr.} = cint ## ```
## ********************************************************************
##
## <Type>
## FT_Int
##
## <Description>
## A typedef for the int type.
## ```
FT_UInt* {.importc, impftHdr.} = cuint ## ```
## ********************************************************************
##
## <Type>
## FT_UInt
##
## <Description>
## A typedef for the unsigned int type.
## ```
FT_Long* {.importc, impftHdr.} = clong ## ```
## ********************************************************************
##
## <Type>
## FT_Long
##
## <Description>
## A typedef for signed long.
## ```
FT_ULong* {.importc, impftHdr.} = culong ## ```
## ********************************************************************
##
## <Type>
## FT_ULong
##
## <Description>
## A typedef for unsigned long.
## ```
FT_F2Dot14* {.importc, impftHdr.} = cshort ## ```
## ********************************************************************
##
## <Type>
## FT_F2Dot14
##
## <Description>
## A signed 2.14 fixed-point type used for unit vectors.
## ```
FT_F26Dot6* {.importc, impftHdr.} = clong ## ```
## ********************************************************************
##
## <Type>
## FT_F26Dot6
##
## <Description>
## A signed 26.6 fixed-point type used for vectorial pixel
## coordinates.
## ```
FT_Fixed* {.importc, impftHdr.} = clong ## ```
## ********************************************************************
##
## <Type>
## FT_Fixed
##
## <Description>
## This type is used to store 16.16 fixed-point values, like scaling
## values or matrix coefficients.
## ```
FT_Error* {.importc, impftHdr.} = cint ## ```
## ********************************************************************
##
## <Type>
## FT_Error
##
## <Description>
## The FreeType error code type. A value of~0 is always interpreted
## as a successful operation.
## ```
FT_Pointer* {.importc, impftHdr.} = pointer ## ```
## ********************************************************************
##
## <Type>
## FT_Pointer
##
## <Description>
## A simple typedef for a typeless pointer.
## ```
FT_Offset* {.importc, impftHdr.} = uint ## ```
## ********************************************************************
##
## <Type>
## FT_Offset
##
## <Description>
## This is equivalent to the ANSI~C size_t' type, i.e., the largest
## _unsigned_ integer type used to express a file size or position,
## or a memory block size.
## ```
FT_PtrDist* {.importc, impftHdr.} = ByteAddress ## ```
## ********************************************************************
##
## <Type>
## FT_PtrDist
##
## <Description>
## This is equivalent to the ANSI~C ptrdiff_t' type, i.e., the
## largest _signed_ integer type used to express the distance
## between two pointers.
## ```
FT_UnitVector* {.bycopy, impftHdr, importc: "struct FT_UnitVector_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_UnitVector
##
## <Description>
## A simple structure used to store a 2D vector unit vector. Uses
## FT_F2Dot14 types.
##
## <Fields>
## x :: Horizontal coordinate.
##
## y :: Vertical coordinate.
## ```
x*: FT_F2Dot14
y*: FT_F2Dot14
FT_Matrix* {.bycopy, impftHdr, importc: "struct FT_Matrix_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_Matrix
##
## <Description>
## A simple structure used to store a 2x2 matrix. Coefficients are
## in 16.16 fixed-point format. The computation performed is:
##
## {
## x' = x*xx + y*xy
## y' = x*yx + y*yy
## }
##
## <Fields>
## xx :: Matrix coefficient.
##
## xy :: Matrix coefficient.
##
## yx :: Matrix coefficient.
##
## yy :: Matrix coefficient.
## ```
xx*: FT_Fixed
xy*: FT_Fixed
yx*: FT_Fixed
yy*: FT_Fixed
FT_Data* {.bycopy, impftHdr, importc: "struct FT_Data_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_Data
##
## <Description>
## Read-only binary data represented as a pointer and a length.
##
## <Fields>
## pointer :: The data.
##
## length :: The length of the data in bytes.
## ```
pointer*: ptr FT_Byte
length*: FT_Int
FT_Generic_Finalizer* {.importc, impftHdr.} = proc (`object`: pointer) {.cdecl.}
FT_Generic* {.bycopy, impftHdr, importc: "struct FT_Generic_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_Generic
##
## <Description>
## Client applications often need to associate their own data to a
## variety of FreeType core objects. For example, a text layout API
## might want to associate a glyph cache to a given size object.
##
## Some FreeType object contains a generic' field, of type
## FT_Generic, which usage is left to client applications and font
## servers.
##
## It can be used to store a pointer to client-specific data, as well
## as the address of a finalizer' function, which will be called by
## FreeType when the object is destroyed (for example, the previous
## client example would put the address of the glyph cache destructor
## in the finalizer' field).
##
## <Fields>
## data :: A typeless pointer to any client-specified data. This
## field is completely ignored by the FreeType library.
##
## finalizer :: A pointer to a generic finalizer' function, which
## will be called when the object is destroyed. If this
## field is set to NULL, no code will be called.
## ```
data*: pointer
finalizer*: FT_Generic_Finalizer
FT_ListNode* {.importc, impftHdr.} = ptr FT_ListNodeRec ## ```
## ********************************************************************
## ********************************************************************
##
## L I S T M A N A G E M E N T
##
## ********************************************************************
## ********************************************************************
## ********************************************************************
##
## <Section>
## list_processing
##
## ********************************************************************
## ********************************************************************
##
## <Type>
## FT_ListNode
##
## <Description>
## Many elements and objects in FreeType are listed through an
## @FT_List record (see @FT_ListRec). As its name suggests, an
## FT_ListNode is a handle to a single list element.
## ```
FT_List* {.importc, impftHdr.} = ptr FT_ListRec ## ```
## ********************************************************************
##
## <Type>
## FT_List
##
## <Description>
## A handle to a list record (see @FT_ListRec).
## ```
FT_ListNodeRec* {.bycopy, impftHdr, importc: "struct FT_ListNodeRec_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_ListNodeRec
##
## <Description>
## A structure used to hold a single list element.
##
## <Fields>
## prev :: The previous element in the list. NULL if first.
##
## next :: The next element in the list. NULL if last.
##
## data :: A typeless pointer to the listed object.
## ```
prev*: FT_ListNode
next*: FT_ListNode
data*: pointer
FT_ListRec* {.bycopy, impftHdr, importc: "struct FT_ListRec_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_ListRec
##
## <Description>
## A structure used to hold a simple doubly-linked list. These are
## used in many parts of FreeType.
##
## <Fields>
## head :: The head (first element) of doubly-linked list.
##
## tail :: The tail (last element) of doubly-linked list.
## ```
head*: FT_ListNode
tail*: FT_ListNode
FT_Glyph_Metrics* {.bycopy, impftHdr, importc: "struct FT_Glyph_Metrics_".} = object ## ```
## **************************************************************
## **************************************************************
## ** **
## ** SIMPLE CLEANUP **
## ** **
## **************************************************************
## **************************************************************
## FT_ERR_PREFIX is needed internally
## END
## nothing
## ********************************************************************
##
## <Section>
## header_inclusion
##
## <Title>
## FreeType's header inclusion scheme
##
## <Abstract>
## How client applications should include FreeType header files.
##
## <Description>
## To be as flexible as possible (and for historical reasons),
## FreeType uses a very special inclusion scheme to load header
## files, for example
##
## {
## #include <ft2build.h>
##
## #include FT_FREETYPE_H
## #include FT_OUTLINE_H
## }
##
## A compiler and its preprocessor only needs an include path to find
## the file ft2build.h'; the exact locations and names of the other
## FreeType header files are hidden by preprocessor macro names,
## loaded by ft2build.h'. The API documentation always gives the
## header macro name needed for a particular function.
##
## ********************************************************************
## ********************************************************************
##
## <Section>
## user_allocation
##
## <Title>
## User allocation
##
## <Abstract>
## How client applications should allocate FreeType data structures.
##
## <Description>
## FreeType assumes that structures allocated by the user and passed
## as arguments are zeroed out except for the actual data. In other
## words, it is recommended to use calloc' (or variants of it)
## instead of malloc' for allocation.
##
## ********************************************************************
## ********************************************************************
## ********************************************************************
##
## B A S I C T Y P E S
##
## ********************************************************************
## ********************************************************************
## ********************************************************************
##
## <Section>
## base_interface
##
## <Title>
## Base Interface
##
## <Abstract>
## The FreeType~2 base font interface.
##
## <Description>
## This section describes the most important public high-level API
## functions of FreeType~2.
##
## <Order>
## FT_Library
## FT_Face
## FT_Size
## FT_GlyphSlot
## FT_CharMap
## FT_Encoding
## FT_ENC_TAG
##
## FT_FaceRec
##
## FT_FACE_FLAG_SCALABLE
## FT_FACE_FLAG_FIXED_SIZES
## FT_FACE_FLAG_FIXED_WIDTH
## FT_FACE_FLAG_HORIZONTAL
## FT_FACE_FLAG_VERTICAL
## FT_FACE_FLAG_COLOR
## FT_FACE_FLAG_SFNT
## FT_FACE_FLAG_CID_KEYED
## FT_FACE_FLAG_TRICKY
## FT_FACE_FLAG_KERNING
## FT_FACE_FLAG_MULTIPLE_MASTERS
## FT_FACE_FLAG_GLYPH_NAMES
## FT_FACE_FLAG_EXTERNAL_STREAM
## FT_FACE_FLAG_HINTER
##
## FT_HAS_HORIZONTAL
## FT_HAS_VERTICAL
## FT_HAS_KERNING
## FT_HAS_FIXED_SIZES
## FT_HAS_GLYPH_NAMES
## FT_HAS_MULTIPLE_MASTERS
## FT_HAS_COLOR
##
## FT_IS_SFNT
## FT_IS_SCALABLE
## FT_IS_FIXED_WIDTH
## FT_IS_CID_KEYED
## FT_IS_TRICKY
##
## FT_STYLE_FLAG_BOLD
## FT_STYLE_FLAG_ITALIC
##
## FT_SizeRec
## FT_Size_Metrics
##
## FT_GlyphSlotRec
## FT_Glyph_Metrics
## FT_SubGlyph
##
## FT_Bitmap_Size
##
## FT_Init_FreeType
## FT_Done_FreeType
##
## FT_New_Face
## FT_Done_Face
## FT_Reference_Face
## FT_New_Memory_Face
## FT_Face_Properties
## FT_Open_Face
## FT_Open_Args
## FT_Parameter
## FT_Attach_File
## FT_Attach_Stream
##
## FT_Set_Char_Size
## FT_Set_Pixel_Sizes
## FT_Request_Size
## FT_Select_Size
## FT_Size_Request_Type
## FT_Size_RequestRec
## FT_Size_Request
## FT_Set_Transform
## FT_Load_Glyph
## FT_Get_Char_Index
## FT_Get_First_Char
## FT_Get_Next_Char
## FT_Get_Name_Index
## FT_Load_Char
##
## FT_OPEN_MEMORY
## FT_OPEN_STREAM
## FT_OPEN_PATHNAME
## FT_OPEN_DRIVER
## FT_OPEN_PARAMS
##
## FT_LOAD_DEFAULT
## FT_LOAD_RENDER
## FT_LOAD_MONOCHROME
## FT_LOAD_LINEAR_DESIGN
## FT_LOAD_NO_SCALE
## FT_LOAD_NO_HINTING
## FT_LOAD_NO_BITMAP
## FT_LOAD_NO_AUTOHINT
## FT_LOAD_COLOR
##
## FT_LOAD_VERTICAL_LAYOUT
## FT_LOAD_IGNORE_TRANSFORM
## FT_LOAD_FORCE_AUTOHINT
## FT_LOAD_NO_RECURSE
## FT_LOAD_PEDANTIC
##
## FT_LOAD_TARGET_NORMAL
## FT_LOAD_TARGET_LIGHT
## FT_LOAD_TARGET_MONO
## FT_LOAD_TARGET_LCD
## FT_LOAD_TARGET_LCD_V
##
## FT_LOAD_TARGET_MODE
##
## FT_Render_Glyph
## FT_Render_Mode
## FT_Get_Kerning
## FT_Kerning_Mode
## FT_Get_Track_Kerning
## FT_Get_Glyph_Name
## FT_Get_Postscript_Name
##
## FT_CharMapRec
## FT_Select_Charmap
## FT_Set_Charmap
## FT_Get_Charmap_Index
##
## FT_Get_FSType_Flags
## FT_Get_SubGlyph_Info
##
## FT_Face_Internal
## FT_Size_Internal
## FT_Slot_Internal
##
## FT_FACE_FLAG_XXX
## FT_STYLE_FLAG_XXX
## FT_OPEN_XXX
## FT_LOAD_XXX
## FT_LOAD_TARGET_XXX
## FT_SUBGLYPH_FLAG_XXX
## FT_FSTYPE_XXX
##
## FT_HAS_FAST_GLYPHS
##
## ********************************************************************
## ********************************************************************
##
## <Struct>
## FT_Glyph_Metrics
##
## <Description>
## A structure to model the metrics of a single glyph. The values
## are expressed in 26.6 fractional pixel format; if the flag
## @FT_LOAD_NO_SCALE has been used while loading the glyph, values
## are expressed in font units instead.
##
## <Fields>
## width ::
## The glyph's width.
##
## height ::
## The glyph's height.
##
## horiBearingX ::
## Left side bearing for horizontal layout.
##
## horiBearingY ::
## Top side bearing for horizontal layout.
##
## horiAdvance ::
## Advance width for horizontal layout.
##
## vertBearingX ::
## Left side bearing for vertical layout.
##
## vertBearingY ::
## Top side bearing for vertical layout. Larger positive values
## mean further below the vertical glyph origin.
##
## vertAdvance ::
## Advance height for vertical layout. Positive values mean the
## glyph has a positive advance downward.
##
## <Note>
## If not disabled with @FT_LOAD_NO_HINTING, the values represent
## dimensions of the hinted glyph (in case hinting is applicable).
##
## Stroking a glyph with an outside border does not increase
## horiAdvance' or vertAdvance'; you have to manually adjust these
## values to account for the added width and height.
##
## FreeType doesn't use the VORG' table data for CFF fonts because
## it doesn't have an interface to quickly retrieve the glyph height.
## The y~coordinate of the vertical origin can be simply computed as
## vertBearingY + height' after loading a glyph.
## ```
width*: FT_Pos
height*: FT_Pos
horiBearingX*: FT_Pos
horiBearingY*: FT_Pos
horiAdvance*: FT_Pos
vertBearingX*: FT_Pos
vertBearingY*: FT_Pos
vertAdvance*: FT_Pos
FT_Bitmap_Size* {.bycopy, impftHdr, importc: "struct FT_Bitmap_Size_".} = object ## ```
## ********************************************************************
##
## <Struct>
## FT_Bitmap_Size
##
## <Description>
## This structure models the metrics of a bitmap strike (i.e., a set
## of glyphs for a given point size and resolution) in a bitmap font.
## It is used for the available_sizes' field of @FT_Face.
##
## <Fields>
## height :: The vertical distance, in pixels, between two
## consecutive baselines. It is always positive.
##
## width :: The average width, in pixels, of all glyphs in the
## strike.
##
## size :: The nominal size of the strike in 26.6 fractional
## points. This field is not very useful.
##
## x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional
## pixels.
##
## y_ppem :: The vertical ppem (nominal height) in 26.6 fractional
## pixels.
##
## <Note>
## Windows FNT:
## The nominal size given in a FNT font is not reliable. If the
## driver finds it incorrect, it sets size' to some calculated
## values, and x_ppem' and y_ppem' to the pixel width and height
## given in the font, respectively.
##
## TrueType embedded bitmaps:
## size', width', and height' values are not contained in the
## bitmap strike itself. They are computed from the global font
## parameters.
## ```
height*: FT_Short
width*: FT_Short
size*: FT_Pos
x_ppem*: FT_Pos
y_ppem*: FT_Pos
FT_Library* {.importc, impftHdr.} = ptr FT_LibraryRec ## ```
## ********************************************************************
## ********************************************************************
##
## O B J E C T C L A S S E S
##
## ********************************************************************
## ********************************************************************
## ********************************************************************
##
## <Type>
## FT_Library
##
## <Description>
## A handle to a FreeType library instance. Each library' is
## completely independent from the others; it is the root' of a set
## of objects like fonts, faces, sizes, etc.
##
## It also embeds a memory manager (see @FT_Memory), as well as a
## scan-line converter object (see @FT_Raster).
##
## In multi-threaded applications it is easiest to use one
## FT_Library' object per thread. In case this is too cumbersome,
## a single FT_Library' object across threads is possible also
## (since FreeType version 2.5.6), as long as a mutex lock is used
## around @FT_New_Face and @FT_Done_Face.
##
## <Note>
## Library objects are normally created by @FT_Init_FreeType, and
## destroyed with @FT_Done_FreeType. If you need reference-counting
## (cf. @FT_Reference_Library), use @FT_New_Library and
## @FT_Done_Library.
## ```
FT_Module* {.importc, impftHdr.} = ptr FT_ModuleRec ## ```
## ********************************************************************
##
## <Section>
## module_management
##
## ********************************************************************
## ********************************************************************
##
## <Type>
## FT_Module
##
## <Description>
## A handle to a given FreeType module object. A module can be a
## font driver, a renderer, or anything else that provides services
## to the former.
## ```
FT_Driver* {.importc, impftHdr.} = ptr FT_DriverRec ## ```
## ********************************************************************
##
## <Type>
## FT_Driver
##
## <Description>
## A handle to a given FreeType font driver object. A font driver
## is a module capable of creating faces from font files.
## ```
FT_Renderer* {.importc, impftHdr.} = ptr FT_RendererRec ## ```
## ********************************************************************
##
## <Type>
## FT_Renderer
##
## <Description>
## A handle to a given FreeType renderer. A renderer is a module in
## charge of converting a glyph's outline image to a bitmap. It
## supports a single glyph image format, and one or more target
## surface depths.
## ```
FT_Face* {.importc, impftHdr.} = ptr FT_FaceRec ## ```
## ********************************************************************
##
## <Section>
## base_interface
##
## ********************************************************************
## ********************************************************************
##
## <Type>
## FT_Face
##
## <Description>
## A handle to a typographic face object. A face object models a
## given typeface, in a given style.
##
## <Note>
## A face object also owns a single @FT_GlyphSlot object, as well
## as one or more @FT_Size objects.
##
## Use @FT_New_Face or @FT_Open_Face to create a new face object from
## a given filepath or a custom input stream.
##
## Use @FT_Done_Face to destroy it (along with its slot and sizes).
##
## An FT_Face' object can only be safely used from one thread at a
## time. Similarly, creation and destruction of FT_Face' with the
## same @FT_Library object can only be done from one thread at a
## time. On the other hand, functions like @FT_Load_Glyph and its
## siblings are thread-safe and do not need the lock to be held as
## long as the same FT_Face' object is not used from multiple
## threads at the same time.
##
## <Also>
## See @FT_FaceRec for the publicly accessible fields of a given face
## object.
## ```
FT_Size* {.importc, impftHdr.} = ptr FT_SizeRec ## ```
## ********************************************************************
##
## <Type>
## FT_Size
##
## <Description>
## A handle to an object that models a face scaled to a given
## character size.
##
## <Note>
## An @FT_Face has one _active_ @FT_Size object that is used by
## functions like @FT_Load_Glyph to determine the scaling
## transformation that in turn is used to load and hint glyphs and
## metrics.
##
## You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes,
## @FT_Request_Size or even @FT_Select_Size to change the content
## (i.e., the scaling values) of the active @FT_Size.
##
## You can use @FT_New_Size to create additional size objects for a
## given @FT_Face, but they won't be used by other functions until
## you activate it through @FT_Activate_Size. Only one size can be
## activated at any given time per face.
##
## <Also>
## See @FT_SizeRec for the publicly accessible fields of a given size
## object.
## ```
FT_GlyphSlot* {.importc, impftHdr.} = ptr FT_GlyphSlotRec ## ```
## ********************************************************************
##
## <Type>
## FT_GlyphSlot
##
## <Description>
## A handle to a given glyph slot'. A slot is a container that can
## hold any of the glyphs contained in its parent face.
##
## In other words, each time you call @FT_Load_Glyph or
## @FT_Load_Char, the slot's content is erased by the new glyph data,
## i.e., the glyph's metrics, its image (bitmap or outline), and
## other control information.
##
## <Also>
## See @FT_GlyphSlotRec for the publicly accessible glyph fields.
## ```
FT_CharMap* {.importc, impftHdr.} = ptr FT_CharMapRec ## ```
## ********************************************************************
##
## <Type>
## FT_CharMap
##
## <Description>
## A handle to a character map (usually abbreviated to charmap'). A
## charmap is used to translate character codes in a given encoding
## into glyph indexes for its parent's face. Some font formats may
## provide several charmaps per font.
##
## Each face object owns zero or more charmaps, but only one of them
## can be active', providing the data used by @FT_Get_Char_Index or
## @FT_Load_Char.
##
## The list of available charmaps in a face is available through the
## face->num_charmaps' and face->charmaps' fields of @FT_FaceRec.
##
## The currently active charmap is available as face->charmap'.
## You should call @FT_Set_Charmap to change it.
##
## <Note>
## When a new face is created (either through @FT_New_Face or
## @FT_Open_Face), the library looks for a Unicode charmap within
## the list and automatically activates it. If there is no Unicode
## charmap, FreeType doesn't set an active' charmap.
##
## <Also>
## See @FT_CharMapRec for the publicly accessible fields of a given
## character map.
## ```
proc FT_Library_Version*(library: FT_Library; amajor: ptr FT_Int; aminor: ptr FT_Int;
apatch: ptr FT_Int) {.importc, cdecl, impftHdr.}
## ```
## ********************************************************************
##
## <Function>
## FT_Library_Version
##
## <Description>
## Return the version of the FreeType library being used. This is
## useful when dynamically linking to the library, since one cannot
## use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and
## @FREETYPE_PATCH.
##
## <Input>
## library :: A source library handle.
##
## <Output>
## amajor :: The major version number.
##
## aminor :: The minor version number.
##
## apatch :: The patch version number.
##
## <Note>
## The reason why this function takes a library' argument is because
## certain programs implement library initialization in a custom way
## that doesn't use @FT_Init_FreeType.
##
## In such cases, the library version might not be available before
## the library object has been created.
## ```
proc FT_Face_CheckTrueTypePatents*(face: FT_Face): FT_Bool {.importc, cdecl, impftHdr.}
## ```
## ********************************************************************
##
## <Function>
## FT_Face_CheckTrueTypePatents
##
## <Description>
## Deprecated, does nothing.
##
## <Input>
## face :: A face handle.
##
## <Return>
## Always returns false.
##
## <Note>
## Since May 2010, TrueType hinting is no longer patented.
##
## <Since>
## 2.3.5
## ```
proc FT_Face_SetUnpatentedHinting*(face: FT_Face; value: FT_Bool): FT_Bool {.importc,
cdecl, impftHdr.}
## ```
## ********************************************************************
##
## <Function>
## FT_Face_SetUnpatentedHinting
##
## <Description>
## Deprecated, does nothing.
##
## <Input>
## face :: A face handle.
##
## value :: New boolean setting.
##
## <Return>
## Always returns false.
##
## <Note>
## Since May 2010, TrueType hinting is no longer patented.
##
## <Since>
## 2.3.5
## ```
{.pop.}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment