XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
font.h File Reference
#include <stdint.h>
#include <sys/_keftmngr.h>
#include <freetype/ftglyph.h>
#include <_xeneva.h>
#include "chitralekha.h"
#include "draw.h"
#include <ft2build.h>
#include "stb_truetype.h"
Include dependency graph for font.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _ch_font_glyph_cache_entry_
 
struct  _ch_font_
 

Macros

#define ROBOTO_LIGHT   "Roboto-Light"
 
#define ROBOTO_LIGHT_ITALIC   "Roboto-Light-Italic"
 
#define ROBOTO_THIN   "Roboto-Thin"
 
#define CORBEL   "Corbel"
 
#define CALIBRI   "Calibri"
 
#define FORTE   "Forte"
 
#define CONSOLAS   "Consolas"
 
#define CH_FONT_GLYPH_CACHE_SIZE   256
 
#define CH_FONT_ATLAS_FIRST   32
 
#define CH_FONT_ATLAS_COUNT   95
 
#define CH_FONT_ATLAS_W   512
 
#define CH_FONT_ATLAS_H   512
 
#define XENEVA_DEFAULT_FONT   CALIBRI
 

Typedefs

typedef struct _ch_font_glyph_cache_entry_ ChFontGlyphCacheEntry
 
typedef struct _ch_font_ ChFont
 

Functions

XE_LIB ChFont * ChInitialiseFont (char *fontname)
 
XE_LIB void ChFontSetSize (ChFont *font, int size)
 
XE_LIB void ChFontDrawText (ChCanvas *canv, ChFont *font, char *string, int penx, int peny, uint32_t sz, uint32_t color)
 
void ChFontDrawCharClipped (ChCanvas *canv, ChFont *font, char c, int penx, int peny, uint32_t color, ChRect *limit)
 
XE_LIB void ChFontDrawChar (ChCanvas *canv, ChFont *font, char c, int penx, int peny, uint32_t sz, uint32_t color)
 
XE_LIB int ChFontDrawTextClipped (ChCanvas *canv, ChFont *font, char *string, int penx, int peny, uint32_t color, ChRect *limit)
 
XE_LIB int64_t ChFontGetWidth (ChFont *font, char *string)
 
XE_LIB int64_t ChFontGetWidthChar (ChFont *font, char c)
 
XE_LIB int64_t ChFontGetHeight (ChFont *font, char *string)
 
XE_LIB int64_t ChFontGetHeightChar (ChFont *font, char c)
 
XE_LIB int ChFontClose (ChFont *font)
 

Macro Definition Documentation

◆ CALIBRI

#define CALIBRI   "Calibri"

◆ CH_FONT_ATLAS_COUNT

#define CH_FONT_ATLAS_COUNT   95

◆ CH_FONT_ATLAS_FIRST

#define CH_FONT_ATLAS_FIRST   32

◆ CH_FONT_ATLAS_H

#define CH_FONT_ATLAS_H   512

◆ CH_FONT_ATLAS_W

#define CH_FONT_ATLAS_W   512

◆ CH_FONT_GLYPH_CACHE_SIZE

#define CH_FONT_GLYPH_CACHE_SIZE   256

◆ CONSOLAS

#define CONSOLAS   "Consolas"

◆ CORBEL

#define CORBEL   "Corbel"

◆ FORTE

#define FORTE   "Forte"

◆ ROBOTO_LIGHT

#define ROBOTO_LIGHT   "Roboto-Light"

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ ROBOTO_LIGHT_ITALIC

#define ROBOTO_LIGHT_ITALIC   "Roboto-Light-Italic"

◆ ROBOTO_THIN

#define ROBOTO_THIN   "Roboto-Thin"

◆ XENEVA_DEFAULT_FONT

#define XENEVA_DEFAULT_FONT   CALIBRI

Typedef Documentation

◆ ChFont

typedef struct _ch_font_ ChFont

◆ ChFontGlyphCacheEntry

Function Documentation

◆ ChFontClose()

XE_LIB int ChFontClose ( ChFont *  font)

◆ ChFontDrawChar()

XE_LIB void ChFontDrawChar ( ChCanvas *  canv,
ChFont *  font,
char  c,
int  penx,
int  peny,
uint32_t  sz,
uint32_t  color 
)

◆ ChFontDrawCharClipped()

void ChFontDrawCharClipped ( ChCanvas *  canv,
ChFont *  font,
char  c,
int  penx,
int  peny,
uint32_t  color,
ChRect *  limit 
)

◆ ChFontDrawText()

XE_LIB void ChFontDrawText ( ChCanvas *  canv,
ChFont *  font,
char *  string,
int  penx,
int  peny,
uint32_t  sz,
uint32_t  color 
)

◆ ChFontDrawTextClipped()

XE_LIB int ChFontDrawTextClipped ( ChCanvas *  canv,
ChFont *  font,
char *  string,
int  penx,
int  peny,
uint32_t  color,
ChRect *  limit 
)

◆ ChFontGetHeight()

XE_LIB int64_t ChFontGetHeight ( ChFont *  font,
char *  string 
)

◆ ChFontGetHeightChar()

XE_LIB int64_t ChFontGetHeightChar ( ChFont *  font,
char  c 
)

◆ ChFontGetWidth()

XE_LIB int64_t ChFontGetWidth ( ChFont *  font,
char *  string 
)

◆ ChFontGetWidthChar()

XE_LIB int64_t ChFontGetWidthChar ( ChFont *  font,
char  c 
)

◆ ChFontSetSize()

XE_LIB void ChFontSetSize ( ChFont *  font,
int  size 
)

◆ ChInitialiseFont()

XE_LIB ChFont * ChInitialiseFont ( char *  fontname)