lc_font_register function

  1. @Native<Int32 Function(Pointer<Char>, Int32, Pointer<Uint8>, Size)>(ffi.Pointer<ffi.Char>, ffi.Int32, ffi.Pointer<ffi.Uint8>, ffi.Size)>()
int lc_font_register(
  1. Pointer<Char> name,
  2. int weight,
  3. Pointer<Uint8> data,
  4. int data_size,
)

Registers data_size bytes of font data (TTF/OTF) under name and weight (100..900, CSS/OpenType scale), so any TextLayer whose fontFamily equals name renders with whichever registered weight is closest to its own fontWeight. A family may have several weights registered under the same name; registering the same name+weight again replaces only that variant. Registration is global and persists for the lifetime of the process (or until lc_font_unregister is called) — it is not tied to any single Scene or render call. data is copied; the caller may free it as soon as this function returns. Returns 0 on success.

Implementation

@ffi.Native<
  ffi.Int32 Function(
    ffi.Pointer<ffi.Char>,
    ffi.Int32,
    ffi.Pointer<ffi.Uint8>,
    ffi.Size,
  )
>()
external int lc_font_register(
  ffi.Pointer<ffi.Char> name,
  int weight,
  ffi.Pointer<ffi.Uint8> data,
  int data_size,
);