AMFP Enhanced
C++ reference: the code this unofficial fork added
Loading...
Searching...
No Matches
hpl_cjk_text.h File Reference
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>

Go to the source code of this file.

Classes

struct  HplCjkDecodeResult
 Result of [hpl_cjk_decode_utf8]. More...

Macros

#define HPL_CJK_ABI_VERSION   1
 Bumped whenever an exported signature or struct changes.
#define HPL_CJK_OK   0
 Success.
#define HPL_CJK_BUFFER_TOO_SMALL   1
 dst_cap was too small; out.len holds the length needed.
#define HPL_CJK_NULL_POINTER   -1
 A required pointer was null.
#define HPL_CJK_PANIC   -2
 Internal error (a caught panic).

Typedefs

typedef struct HplCjkDecodeResult HplCjkDecodeResult
 Result of [hpl_cjk_decode_utf8].

Functions

uint32_t hpl_cjk_abi_version (void)
int32_t hpl_cjk_decode_utf8 (const uint8_t *src, uint32_t src_len, uint16_t *dst, uint32_t dst_cap, struct HplCjkDecodeResult *out)
 Decodes UTF-8 into BMP-only UTF-16.
uint32_t hpl_cjk_break_allowed (uint32_t prev, uint32_t next)
 1 if a line may break between UTF-16 code units prev and next, else 0.
uint32_t hpl_cjk_is_cjk (uint32_t c)
 1 if c counts as CJK for line breaking, else 0.

Macro Definition Documentation

◆ HPL_CJK_ABI_VERSION

#define HPL_CJK_ABI_VERSION   1

Bumped whenever an exported signature or struct changes.

Definition at line 15 of file hpl_cjk_text.h.

◆ HPL_CJK_OK

#define HPL_CJK_OK   0

Success.

Definition at line 20 of file hpl_cjk_text.h.

◆ HPL_CJK_BUFFER_TOO_SMALL

#define HPL_CJK_BUFFER_TOO_SMALL   1

dst_cap was too small; out.len holds the length needed.

Definition at line 25 of file hpl_cjk_text.h.

◆ HPL_CJK_NULL_POINTER

#define HPL_CJK_NULL_POINTER   -1

A required pointer was null.

Definition at line 30 of file hpl_cjk_text.h.

◆ HPL_CJK_PANIC

#define HPL_CJK_PANIC   -2

Internal error (a caught panic).

Definition at line 35 of file hpl_cjk_text.h.

Typedef Documentation

◆ HplCjkDecodeResult

typedef struct HplCjkDecodeResult HplCjkDecodeResult

Result of [hpl_cjk_decode_utf8].

Function Documentation

◆ hpl_cjk_abi_version()

uint32_t hpl_cjk_abi_version ( void )

◆ hpl_cjk_decode_utf8()

int32_t hpl_cjk_decode_utf8 ( const uint8_t * src,
uint32_t src_len,
uint16_t * dst,
uint32_t dst_cap,
struct HplCjkDecodeResult * out )

Decodes UTF-8 into BMP-only UTF-16.

dst_cap >= src_len always suffices.

Safety

src must point to src_len readable bytes (may be null when src_len is 0), dst to dst_cap writable u16s (may be null when dst_cap is 0), and out to a writable result.

◆ hpl_cjk_break_allowed()

uint32_t hpl_cjk_break_allowed ( uint32_t prev,
uint32_t next )

1 if a line may break between UTF-16 code units prev and next, else 0.

◆ hpl_cjk_is_cjk()

uint32_t hpl_cjk_is_cjk ( uint32_t c)

1 if c counts as CJK for line breaking, else 0.