Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
ssfn.h File Reference

Go to the source code of this file.

Data Structures

struct  __attribute__
 
struct  ssfn_buf_t
 
struct  ssfn_glyph_t
 
struct  ssfn_chr_t
 
struct  ssfn_t
 

Macros

#define SSFN_VERSION   0x0200
 
#define __THROW
 
#define SSFN_MAGIC   "SFN2"
 
#define SSFN_COLLECTION   "SFNC"
 
#define SSFN_ENDMAGIC   "2NFS"
 
#define SSFN_LIG_FIRST   0xF000
 
#define SSFN_LIG_LAST   0xF8FF
 
#define SSFN_TYPE_FAMILY(x)
 
#define SSFN_FAMILY_SERIF   0
 
#define SSFN_FAMILY_SANS   1
 
#define SSFN_FAMILY_DECOR   2
 
#define SSFN_FAMILY_MONOSPACE   3
 
#define SSFN_FAMILY_HAND   4
 
#define SSFN_TYPE_STYLE(x)
 
#define SSFN_STYLE_REGULAR   0
 
#define SSFN_STYLE_BOLD   1
 
#define SSFN_STYLE_ITALIC   2
 
#define SSFN_STYLE_USRDEF1   4 /* user defined variant 1 */
 
#define SSFN_STYLE_USRDEF2   8 /* user defined variant 2 */
 
#define SSFN_CONTOUR_MOVE   0
 
#define SSFN_CONTOUR_LINE   1
 
#define SSFN_CONTOUR_QUAD   2
 
#define SSFN_CONTOUR_CUBIC   3
 
#define SSFN_FRAG_CONTOUR   0
 
#define SSFN_FRAG_BITMAP   1
 
#define SSFN_FRAG_PIXMAP   2
 
#define SSFN_FRAG_KERNING   3
 
#define SSFN_FRAG_HINTING   4
 
#define _pack   __attribute__((packed))
 
#define SSFN_FAMILY_ANY   0xff /* select the first loaded font */
 
#define SSFN_FAMILY_BYNAME   0xfe /* select font by its unique name */
 
#define SSFN_STYLE_UNDERLINE   16 /* under line glyph */
 
#define SSFN_STYLE_STHROUGH   32 /* strike through glyph */
 
#define SSFN_STYLE_NOAA   64 /* no anti-aliasing */
 
#define SSFN_STYLE_NOKERN   128 /* no kerning */
 
#define SSFN_STYLE_NODEFGLYPH   256 /* don't draw default glyph */
 
#define SSFN_STYLE_NOCACHE   512 /* don't cache rasterized glyph */
 
#define SSFN_STYLE_NOHINTING   1024 /* no auto hinting grid (not used as of now) */
 
#define SSFN_STYLE_RTL   2048 /* render right-to-left */
 
#define SSFN_STYLE_ABS_SIZE   4096 /* scale absoulte height */
 
#define SSFN_STYLE_NOSMOOTH   8192 /* no edge-smoothing for bitmaps */
 
#define SSFN_OK   0 /* success */
 
#define SSFN_ERR_ALLOC   -1 /* allocation error */
 
#define SSFN_ERR_BADFILE   -2 /* bad SSFN file format */
 
#define SSFN_ERR_NOFACE   -3 /* no font face selected */
 
#define SSFN_ERR_INVINP   -4 /* invalid input */
 
#define SSFN_ERR_BADSTYLE   -5 /* bad style */
 
#define SSFN_ERR_BADSIZE   -6 /* bad size */
 
#define SSFN_ERR_NOGLYPH   -7 /* glyph (or kerning info) not found */
 
#define SSFN_SIZE_MAX   192 /* biggest size we can render */
 
#define SSFN_ITALIC_DIV   4 /* italic angle divisor, glyph top side pushed width / this pixels */
 
#define SSFN_PREC   4 /* precision in bits */
 
#define SSFN_DATA_MAX   65536
 
#define ssfn_error(err)
 

Typedefs

typedef unsigned short int uint16_t
 
typedef short int int16_t
 
typedef unsigned long int uint64_t
 

Functions

uint32_t ssfn_utf8 (char **str)
 
int ssfn_load (ssfn_t *ctx, const void *data)
 
int ssfn_select (ssfn_t *ctx, int family, const char *name, int style, int size)
 
int ssfn_render (ssfn_t *ctx, ssfn_buf_t *dst, const char *str)
 
int ssfn_bbox (ssfn_t *ctx, const char *str, int *w, int *h, int *left, int *top)
 
int ssfn_bbox2 (ssfn_t *ctx, const char *str, const char *end, int *w, int *h, int *left, int *top)
 
ssfn_buf_tssfn_text (ssfn_t *ctx, const char *str, unsigned int fg)
 
int ssfn_mem (ssfn_t *ctx)
 
void ssfn_free (ssfn_t *ctx)
 
int ssfn_putc (uint32_t unicode)
 

Variables

const char * ssfn_errstr []
 
ssfn_font_t * ssfn_src
 
ssfn_buf_t ssfn_dst
 

Macro Definition Documentation

◆ __THROW

#define __THROW

Definition at line 43 of file ssfn.h.

◆ _pack

#define _pack   __attribute__((packed))

Definition at line 99 of file ssfn.h.

◆ SSFN_COLLECTION

#define SSFN_COLLECTION   "SFNC"

Definition at line 61 of file ssfn.h.

◆ SSFN_CONTOUR_CUBIC

#define SSFN_CONTOUR_CUBIC   3

Definition at line 88 of file ssfn.h.

◆ SSFN_CONTOUR_LINE

#define SSFN_CONTOUR_LINE   1

Definition at line 86 of file ssfn.h.

◆ SSFN_CONTOUR_MOVE

#define SSFN_CONTOUR_MOVE   0

Definition at line 85 of file ssfn.h.

◆ SSFN_CONTOUR_QUAD

#define SSFN_CONTOUR_QUAD   2

Definition at line 87 of file ssfn.h.

◆ SSFN_DATA_MAX

#define SSFN_DATA_MAX   65536

Definition at line 167 of file ssfn.h.

◆ SSFN_ENDMAGIC

#define SSFN_ENDMAGIC   "2NFS"

Definition at line 62 of file ssfn.h.

◆ SSFN_ERR_ALLOC

#define SSFN_ERR_ALLOC   -1 /* allocation error */

Definition at line 142 of file ssfn.h.

◆ SSFN_ERR_BADFILE

#define SSFN_ERR_BADFILE   -2 /* bad SSFN file format */

Definition at line 143 of file ssfn.h.

◆ SSFN_ERR_BADSIZE

#define SSFN_ERR_BADSIZE   -6 /* bad size */

Definition at line 147 of file ssfn.h.

◆ SSFN_ERR_BADSTYLE

#define SSFN_ERR_BADSTYLE   -5 /* bad style */

Definition at line 146 of file ssfn.h.

◆ SSFN_ERR_INVINP

#define SSFN_ERR_INVINP   -4 /* invalid input */

Definition at line 145 of file ssfn.h.

◆ SSFN_ERR_NOFACE

#define SSFN_ERR_NOFACE   -3 /* no font face selected */

Definition at line 144 of file ssfn.h.

◆ SSFN_ERR_NOGLYPH

#define SSFN_ERR_NOGLYPH   -7 /* glyph (or kerning info) not found */

Definition at line 148 of file ssfn.h.

◆ ssfn_error

#define ssfn_error ( err)
Value:
(err<0&&err>=-7?ssfn_errstr[-err]:"Unknown error") /* return string for error code */
const char * ssfn_errstr[]

Definition at line 238 of file ssfn.h.

◆ SSFN_FAMILY_ANY

#define SSFN_FAMILY_ANY   0xff /* select the first loaded font */

Definition at line 125 of file ssfn.h.

Referenced by INIT().

◆ SSFN_FAMILY_BYNAME

#define SSFN_FAMILY_BYNAME   0xfe /* select font by its unique name */

Definition at line 126 of file ssfn.h.

◆ SSFN_FAMILY_DECOR

#define SSFN_FAMILY_DECOR   2

Definition at line 72 of file ssfn.h.

◆ SSFN_FAMILY_HAND

#define SSFN_FAMILY_HAND   4

Definition at line 74 of file ssfn.h.

◆ SSFN_FAMILY_MONOSPACE

#define SSFN_FAMILY_MONOSPACE   3

Definition at line 73 of file ssfn.h.

◆ SSFN_FAMILY_SANS

#define SSFN_FAMILY_SANS   1

Definition at line 71 of file ssfn.h.

◆ SSFN_FAMILY_SERIF

#define SSFN_FAMILY_SERIF   0

Definition at line 70 of file ssfn.h.

◆ SSFN_FRAG_BITMAP

#define SSFN_FRAG_BITMAP   1

Definition at line 92 of file ssfn.h.

◆ SSFN_FRAG_CONTOUR

#define SSFN_FRAG_CONTOUR   0

Definition at line 91 of file ssfn.h.

◆ SSFN_FRAG_HINTING

#define SSFN_FRAG_HINTING   4

Definition at line 95 of file ssfn.h.

◆ SSFN_FRAG_KERNING

#define SSFN_FRAG_KERNING   3

Definition at line 94 of file ssfn.h.

◆ SSFN_FRAG_PIXMAP

#define SSFN_FRAG_PIXMAP   2

Definition at line 93 of file ssfn.h.

◆ SSFN_ITALIC_DIV

#define SSFN_ITALIC_DIV   4 /* italic angle divisor, glyph top side pushed width / this pixels */

Definition at line 151 of file ssfn.h.

◆ SSFN_LIG_FIRST

#define SSFN_LIG_FIRST   0xF000

Definition at line 65 of file ssfn.h.

◆ SSFN_LIG_LAST

#define SSFN_LIG_LAST   0xF8FF

Definition at line 66 of file ssfn.h.

◆ SSFN_MAGIC

#define SSFN_MAGIC   "SFN2"

Definition at line 60 of file ssfn.h.

◆ SSFN_OK

#define SSFN_OK   0 /* success */

Definition at line 141 of file ssfn.h.

Referenced by INIT().

◆ SSFN_PREC

#define SSFN_PREC   4 /* precision in bits */

Definition at line 152 of file ssfn.h.

◆ SSFN_SIZE_MAX

#define SSFN_SIZE_MAX   192 /* biggest size we can render */

Definition at line 150 of file ssfn.h.

◆ SSFN_STYLE_ABS_SIZE

#define SSFN_STYLE_ABS_SIZE   4096 /* scale absoulte height */

Definition at line 137 of file ssfn.h.

◆ SSFN_STYLE_BOLD

#define SSFN_STYLE_BOLD   1

Definition at line 79 of file ssfn.h.

◆ SSFN_STYLE_ITALIC

#define SSFN_STYLE_ITALIC   2

Definition at line 80 of file ssfn.h.

◆ SSFN_STYLE_NOAA

#define SSFN_STYLE_NOAA   64 /* no anti-aliasing */

Definition at line 131 of file ssfn.h.

◆ SSFN_STYLE_NOCACHE

#define SSFN_STYLE_NOCACHE   512 /* don't cache rasterized glyph */

Definition at line 134 of file ssfn.h.

◆ SSFN_STYLE_NODEFGLYPH

#define SSFN_STYLE_NODEFGLYPH   256 /* don't draw default glyph */

Definition at line 133 of file ssfn.h.

◆ SSFN_STYLE_NOHINTING

#define SSFN_STYLE_NOHINTING   1024 /* no auto hinting grid (not used as of now) */

Definition at line 135 of file ssfn.h.

◆ SSFN_STYLE_NOKERN

#define SSFN_STYLE_NOKERN   128 /* no kerning */

Definition at line 132 of file ssfn.h.

◆ SSFN_STYLE_NOSMOOTH

#define SSFN_STYLE_NOSMOOTH   8192 /* no edge-smoothing for bitmaps */

Definition at line 138 of file ssfn.h.

◆ SSFN_STYLE_REGULAR

#define SSFN_STYLE_REGULAR   0

Definition at line 78 of file ssfn.h.

Referenced by INIT().

◆ SSFN_STYLE_RTL

#define SSFN_STYLE_RTL   2048 /* render right-to-left */

Definition at line 136 of file ssfn.h.

◆ SSFN_STYLE_STHROUGH

#define SSFN_STYLE_STHROUGH   32 /* strike through glyph */

Definition at line 130 of file ssfn.h.

◆ SSFN_STYLE_UNDERLINE

#define SSFN_STYLE_UNDERLINE   16 /* under line glyph */

Definition at line 129 of file ssfn.h.

◆ SSFN_STYLE_USRDEF1

#define SSFN_STYLE_USRDEF1   4 /* user defined variant 1 */

Definition at line 81 of file ssfn.h.

◆ SSFN_STYLE_USRDEF2

#define SSFN_STYLE_USRDEF2   8 /* user defined variant 2 */

Definition at line 82 of file ssfn.h.

◆ SSFN_TYPE_FAMILY

#define SSFN_TYPE_FAMILY ( x)
Value:
((x)&15)
uint32_t x
Definition virtio-gpu.hpp:0

Definition at line 69 of file ssfn.h.

◆ SSFN_TYPE_STYLE

#define SSFN_TYPE_STYLE ( x)
Value:
(((x)>>4)&15)

Definition at line 77 of file ssfn.h.

◆ SSFN_VERSION

#define SSFN_VERSION   0x0200

Definition at line 34 of file ssfn.h.

Typedef Documentation

◆ int16_t

typedef short int int16_t

Definition at line 50 of file ssfn.h.

◆ uint16_t

typedef unsigned short int uint16_t

Definition at line 49 of file ssfn.h.

◆ uint64_t

typedef unsigned long int uint64_t

Definition at line 53 of file ssfn.h.

Function Documentation

◆ ssfn_bbox()

int ssfn_bbox ( ssfn_t * ctx,
const char * str,
int * w,
int * h,
int * left,
int * top )

References h, and str().

◆ ssfn_bbox2()

int ssfn_bbox2 ( ssfn_t * ctx,
const char * str,
const char * end,
int * w,
int * h,
int * left,
int * top )

References h, and str().

◆ ssfn_free()

void ssfn_free ( ssfn_t * ctx)

◆ ssfn_load()

int ssfn_load ( ssfn_t * ctx,
const void * data )

References data.

Referenced by INIT().

◆ ssfn_mem()

int ssfn_mem ( ssfn_t * ctx)

◆ ssfn_putc()

int ssfn_putc ( uint32_t unicode)

References ssfn_errstr.

◆ ssfn_render()

int ssfn_render ( ssfn_t * ctx,
ssfn_buf_t * dst,
const char * str )

References dst, and str().

Referenced by putc(), and putc_utf8().

◆ ssfn_select()

int ssfn_select ( ssfn_t * ctx,
int family,
const char * name,
int style,
int size )

References name, and size.

Referenced by INIT().

◆ ssfn_text()

ssfn_buf_t * ssfn_text ( ssfn_t * ctx,
const char * str,
unsigned int fg )

References str().

◆ ssfn_utf8()

uint32_t ssfn_utf8 ( char ** str)

References str().

Variable Documentation

◆ ssfn_dst

ssfn_buf_t ssfn_dst
extern

◆ ssfn_errstr

const char* ssfn_errstr[]
extern

Referenced by ssfn_putc().

◆ ssfn_src

ssfn_font_t* ssfn_src
extern