12 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
13 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
14 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
15 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
16 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
17 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
18 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
19 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
20 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
21 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
23 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
24 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
25 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
26 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
65#ifndef DP_FREETYPE_STATIC
92(*qFT_Done_Face)(
FT_Face face );
94(*qFT_Select_Size)(
FT_Face face,
97(*qFT_Request_Size)(
FT_Face face,
100(*qFT_Set_Char_Size)(
FT_Face face,
106(*qFT_Set_Pixel_Sizes)(
FT_Face face,
110(*qFT_Load_Glyph)(
FT_Face face,
118(*qFT_Get_Char_Index)(
FT_Face face,
124(*qFT_Get_Kerning)(
FT_Face face,
130(*qFT_Attach_Stream)(
FT_Face face,
186(FT_Request_Size)(
FT_Face face,
189(FT_Set_Char_Size)(
FT_Face face,
195(FT_Set_Pixel_Sizes)(
FT_Face face,
207(FT_Get_Char_Index)(
FT_Face face,
219(FT_Attach_Stream)(
FT_Face face,
222#define qFT_Init_FreeType FT_Init_FreeType
223#define qFT_Done_FreeType FT_Done_FreeType
225#define qFT_New_Memory_Face FT_New_Memory_Face
226#define qFT_Done_Face FT_Done_Face
227#define qFT_Select_Size FT_Select_Size
228#define qFT_Request_Size FT_Request_Size
229#define qFT_Set_Char_Size FT_Set_Char_Size
230#define qFT_Set_Pixel_Sizes FT_Set_Pixel_Sizes
231#define qFT_Load_Glyph FT_Load_Glyph
232#define qFT_Load_Char FT_Load_Char
233#define qFT_Get_Char_Index FT_Get_Char_Index
234#define qFT_Render_Glyph FT_Render_Glyph
235#define qFT_Get_Kerning FT_Get_Kerning
236#define qFT_Attach_Stream FT_Attach_Stream
246#define POSTPROCESS_MAXRADIUS 8
249 unsigned char *
buf, *buf2;
251 float blur, outline, shadowx, shadowy, shadowz;
252 int padding_t, padding_b, padding_l, padding_r,
blurpadding_lt, blurpadding_rb, outlinepadding_t, outlinepadding_b, outlinepadding_l, outlinepadding_r;
259typedef struct fontfilecache_s
267#define MAX_FONTFILES 8
349#ifndef DP_FREETYPE_STATIC
364#ifndef DP_FREETYPE_STATIC
365 const char* dllnames [] =
371 "libfreetype.6.dylib",
384#ifndef DP_FREETYPE_STATIC
469#ifndef DP_FREETYPE_STATIC
480 ft2_attachment_t *na;
509 if ( sn - (
float)si >= 0.5 )
516 return floor(val / snapwidth + 0.5f) * snapwidth;
634 const unsigned char *
data;
637 memset(font, 0,
sizeof(*font));
644 "You need the FreeType2 DLL to load font files\n",
653 if (namelen + 5 >
sizeof(filename))
660 memcpy(filename,
name, namelen+1);
665 memcpy(filename + namelen,
".ttf", 5);
671 memcpy(filename + namelen,
".otf", 5);
677 ft2_attachment_t afm;
679 memcpy(filename + namelen,
".pfb", 5);
684 memcpy(filename + namelen,
".afm", 5);
696 Con_DPrintf(
"Loading font %s face %i...\n", filename, _face);
699 if (status && _face != 0)
719 memset(&args, 0,
sizeof(args));
787static void Font_Postprocess(
ft2_font_t *fnt,
unsigned char *imagedata,
int pitch,
int bpp,
int w,
int h,
int *pad_l,
int *pad_r,
int *pad_t,
int *pad_b)
814 for(
y = -*pad_t;
y < h + *pad_b; ++
y)
815 for(
x = -*pad_l;
x <
w + *pad_r; ++
x)
824 for(my = y1; my <=
y2; ++my)
825 for(mx =
x1; mx <=
x2; ++mx)
845 for(mx =
x1; mx <=
x2; ++mx)
858 for(my = y1; my <=
y2; ++my)
865 for(
y = -*pad_t;
y < h + *pad_b; ++
y)
866 for(
x = -*pad_l;
x <
w + *pad_r; ++
x)
871 unsigned char oldalpha = imagedata[
x * bpp + pitch *
y + (bpp - 1)];
873 unsigned char newalpha = 255 - ((255 - (
int)outlinealpha) * (255 - (
int)oldalpha)) / 255;
875 unsigned char oldfactor = (255 * (
int)oldalpha) / newalpha;
878 for(
i = 0;
i < bpp-1; ++
i)
880 unsigned char c = imagedata[
x * bpp + pitch *
y +
i];
881 c = (c * (
int)oldfactor) / 255 ;
882 imagedata[
x * bpp + pitch *
y +
i] = c;
884 imagedata[
x * bpp + pitch *
y + (bpp - 1)] = newalpha;
914 ft2_font_map_t *fmap, temp;
915 int gpad_l, gpad_r, gpad_t, gpad_b;
917 if (!(
size > 0.001f &&
size < 1000.0f))
949 memset(&temp, 0,
sizeof(temp));
951 temp.glyphSize =
size*2 +
max(gpad_l + gpad_r, gpad_t + gpad_b);
954 temp.sfx = (1.0/64.0)/(
double)
size;
955 temp.sfy = (1.0/64.0)/(
double)
size;
967 fmap->sfx = temp.sfx;
968 fmap->sfy = temp.sfy;
976 for (l = 0; l < 256; ++l)
978 for (
r = 0;
r < 256; ++
r)
985 fmap->kerning->kerning[l][
r][0] = 0;
986 fmap->kerning->kerning[l][
r][1] = 0;
990 fmap->kerning->kerning[l][
r][0] =
Font_SnapTo((kernvec.
x / 64.0) / fmap->size, 1 / fmap->size);
991 fmap->kerning->kerning[l][
r][1] =
Font_SnapTo((kernvec.
y / 64.0) / fmap->size, 1 / fmap->size);
1002 float value = 1000000;
1004 int matchsize = -10000;
1006 float fsize_x, fsize_y;
1007 ft2_font_map_t **maps = font->
font_maps;
1018 fsize_x = fsize_y = 16;
1033 nval = 0.5 * (
fabs(maps[m]->
size - fsize_x) +
fabs(maps[m]->
size - fsize_y));
1034 if (match == -1 || nval <
value || (nval ==
value && matchsize < maps[m]->
size))
1038 matchsize = maps[m]->size;
1087 ft2_font_map_t *fmap;
1095 if (left < 256 &&
right < 256)
1099 if (outx) *outx = fmap->kerning->kerning[left][
right][0];
1100 if (outy) *outy = fmap->kerning->kerning[left][
right][1];
1120 if (outx) *outx =
Font_SnapTo(kernvec.
x * fmap->sfx, 1 / fmap->size);
1121 if (outy) *outy =
Font_SnapTo(kernvec.
y * fmap->sfy, 1 / fmap->size);
1135 if (outx) *outx =
Font_SnapTo(kernvec.
x * fmap->sfx, 1 / fmap->size);
1136 if (outy) *outy =
Font_SnapTo(kernvec.
y * fmap->sfy, 1 / fmap->size);
1145 return Font_GetKerningForMap(font,
Font_IndexForSize(font, h,
NULL,
NULL),
w, h, left,
right, outx, outy);
1153 ft2_font_map_t *nextmap;
1155 if (map->kerning !=
NULL)
1157 if (map->incmap !=
NULL)
1160 if (map->incmap->data_tier1[
i] !=
NULL)
1165 if (map->incmap->data_tier2[
i] !=
NULL)
1178 nextmap = map->next;
1210#ifndef DP_FREETYPE_STATIC
1230 float intSize =
size;
1238 if ((fontface->size->metrics.height>>6) <=
size)
1261 glyph->
txmin = glyph->
txmin * scalex + shiftx;
1262 glyph->
txmax = glyph->
txmax * scalex + shiftx;
1263 glyph->
tymin = glyph->
tymin * scaley + shifty;
1264 glyph->
tymax = glyph->
tymax * scaley + shifty;
1266#define fix_glyph_coords_tier1(glyph, order) transform_glyph_coords(glyph, order / (float)FONT_CHARS_PER_LINE, 0.0f, 1.0f / (float)FONT_CHARS_PER_LINE, 1.0f)
1267#define fix_glyph_coords_tier2(glyph, order) transform_glyph_coords(glyph, 0.0f, order / (float)FONT_CHARS_PER_LINE, 1.0f, 1.0f / (float)FONT_CHARS_PER_LINE)
1270static inline void merge_single_map(ft2_font_map_t *targetmap,
int targetindex, ft2_font_map_t *sourcemap,
int sourceindex)
1272 targetmap->glyphs[targetindex] = sourcemap->glyphs[sourceindex];
1273 targetmap->glyphchars[targetindex] = sourcemap->glyphchars[sourceindex];
1276#define calc_data_arguments(w, h) \
1277 width = startmap->glyphSize * w; \
1278 height = startmap->glyphSize * h; \
1279 pitch = width * bytes_per_pixel; \
1280 datasize = height * pitch;
1284 unsigned char *
data, ft2_font_map_t **outmap,
int *outmapch)
1286 #define bytes_per_pixel 4
1288 int index, targetmap_at;
1290 int tier1_data_index, tier2_data_index;
1294 unsigned char *newdata, *chunk;
1295 ft2_font_map_t *startmap, *targetmap, *currentmap;
1296 #define M FONT_CHARS_PER_LINE
1297 #define N FONT_CHAR_LINES
1299 startmap = incmap->fontmap;
1300 index = incmap->charcount;
1301 tier1_data_index =
index %
M;
1302 tier2_data_index = incmap->tier1_merged;
1304 incmap->data_tier1[tier1_data_index] =
data;
1310 targetmap_at = incmap->tier2_merged + incmap->tier1_merged;
1311 targetmap = startmap;
1312 for (
i = 0;
i < targetmap_at; ++
i)
1313 targetmap = targetmap->next;
1314 currentmap = targetmap;
1316 for (
i = 0;
i <
M; ++
i)
1318 chunk = incmap->data_tier1[
i];
1321 for (
y = 0;
y < datasize;
y += pitch)
1322 for (
x = 0;
x < pitch; ++
x)
1323 newdata[
y *
M +
i * pitch +
x] = chunk[
y +
x];
1325 incmap->data_tier1[
i] =
NULL;
1328 currentmap = currentmap->next;
1332 targetmap->next =
NULL;
1333 incmap->data_tier2[tier2_data_index] = newdata;
1334 ++incmap->tier1_merged;
1335 incmap->tier1_merged %=
M;
1336 incmap->newmap_start =
INCMAP_START + targetmap_at + 1;
1338 *outmap = targetmap;
1345 targetmap_at = incmap->tier2_merged;
1346 targetmap = startmap;
1347 for (
i = 0;
i < targetmap_at; ++
i)
1348 targetmap = targetmap->next;
1349 currentmap = targetmap;
1351 for (
i = 0;
i <
N; ++
i)
1353 chunk = incmap->data_tier2[
i];
1356 for (
x = 0;
x < datasize; ++
x)
1357 newdata[
i * datasize +
x] = chunk[
x];
1359 incmap->data_tier2[
i] =
NULL;
1360 for (j = 0; j <
M; ++j)
1365 currentmap = currentmap->next;
1369 targetmap->next =
NULL;
1371 ++incmap->tier2_merged;
1372 incmap->newmap_start =
INCMAP_START + targetmap_at + 1;
1374 *outmap = targetmap;
1378 ++incmap->charcount;
1379 ++incmap->newmap_start;
1386 ft2_font_map_t **outmap,
int *outmapch,
qbool use_incmap)
1388 #define bytes_per_pixel 4
1397 int gpad_l, gpad_r, gpad_t, gpad_b;
1401 int glyph_row, glyph_column;
1408 ft2_font_map_t *map, *next;
1409 font_incmap_t *incmap;
1413 incmap = mapstart->incmap;
1418 chars_per_line = char_lines = chars_per_map = 1;
1420 map_startglyph = incmap ? incmap->newmap_start :
INCMAP_START;
1469 if (font->
image_font && mapstart->intSize < 0)
1470 mapstart->intSize = mapstart->size;
1471 if (mapstart->intSize < 0)
1492 if ((mapstart->intSize =
Font_SearchSize(font, fontface, mapstart->size)) <= 0)
1494 Con_DPrintf(
"Using size: %f for requested size %f\n", mapstart->intSize, mapstart->size);
1510 map->start = map_startglyph;
1536 dpsnprintf(map_identifier,
sizeof(map_identifier),
"%s_%g_%p_%u",
1537 font->
name, mapstart->intSize, mapstart, (
unsigned) map_startglyph);
1541 Con_Printf(
"Generating font map %s (size: %.1f MB)\n", map_identifier, mapstart->glyphSize * (256 * 4 / 1048576.0) * mapstart->glyphSize);
1546 map->size = mapstart->size;
1547 map->intSize = mapstart->intSize;
1548 map->glyphSize = mapstart->glyphSize;
1549 map->sfx = mapstart->sfx;
1550 map->sfy = mapstart->sfy;
1552 width = map->glyphSize * chars_per_line;
1553 height = map->glyphSize * char_lines;
1555 datasize =
height * pitch;
1566 if (mapstart->incmap ==
NULL)
1576 incmap->fontmap = map;
1582 next = incmap->fontmap;
1583 while (next->next !=
NULL)
1591 next = use_incmap ? incmap->fontmap : mapstart;
1592 while(next->next && next->next->start < map->start)
1594 map->next = next->next;
1600 while (tp < datasize)
1613 ch = (
FT_ULong)(use_incmap ? _ch : map->start);
1621 unsigned char *imagedata =
NULL, *dst, *
src;
1624 int pad_l, pad_r, pad_t, pad_b;
1627 Con_DPrint(
"glyphinfo: ------------- GLYPH INFO -----------------\n");
1629 map->glyphchars[mapch] = (
Uchar)ch;
1633 imagedata =
data + glyph_row * pitch * map->glyphSize + glyph_column * map->glyphSize *
bytes_per_pixel;
1642 map->glyphs[mapch].image =
true;
1646 if (glyphIndex == 0)
1650 for(usefont = font->
next; usefont !=
NULL; usefont = usefont->
next)
1652 if (!
Font_SetSize(usefont, mapstart->intSize, mapstart->intSize))
1657 if (glyphIndex == 0)
1681 Con_DPrintf(
"failed to load glyph for char %lx from font %s\n", (
unsigned long)ch, font->
name);
1686 glyph = face->glyph;
1687 bmp = &glyph->bitmap;
1692 if (
w > (map->glyphSize - gpad_l - gpad_r) || h > (map->glyphSize - gpad_t - gpad_b)) {
1693 Con_Printf(
CON_WARN "WARNING: Glyph %lu is too big in font %s, size %g: %i x %i\n", ch, font->
name, map->size,
w, h);
1694 if (
w > map->glyphSize)
1695 w = map->glyphSize - gpad_l - gpad_r;
1696 if (h > map->glyphSize)
1710 Con_DPrint(
"glyphinfo: Pixel Mode: GRAY2\n");
1714 Con_DPrint(
"glyphinfo: Pixel Mode: GRAY4\n");
1727 for (
y = 0;
y < h; ++
y)
1729 dst = imagedata +
y * pitch;
1736 for (
x = 0;
x < bmp->
width;
x += 8)
1738 unsigned char c = *
src++;
1751 for (
x = 0;
x < bmp->
width;
x += 4)
1753 unsigned char c = *
src++;
1762 for (
x = 0;
x < bmp->
width;
x += 2)
1764 unsigned char c = *
src++;
1771 for (tp = 0; tp < bmp->
pitch; ++tp)
1799 mapglyph = &map->glyphs[mapch];
1805 double bearingX = (glyph->metrics.horiBearingX / 64.0) / map->size;
1807 double advance = (glyph->advance.x / 64.0) / map->size;
1811 mapglyph->
txmin = ( (double)(glyph_column * map->glyphSize) + (double)(gpad_l - pad_l) ) / ( (
double)(map->glyphSize * chars_per_line) );
1812 mapglyph->
txmax = mapglyph->
txmin + (double)(bmp->
width + pad_l + pad_r) / ( (double)(map->glyphSize * chars_per_line) );
1813 mapglyph->
tymin = ( (double)(glyph_row * map->glyphSize) + (double)(gpad_r - pad_r) ) / ( (
double)(map->glyphSize * char_lines) );
1814 mapglyph->
tymax = mapglyph->
tymin + (double)(bmp->
rows + pad_t + pad_b) / ( (double)(map->glyphSize * char_lines) );
1817 mapglyph->
vxmin = (glyph->bitmap_left - pad_l) / map->size;
1818 mapglyph->
vxmax = mapglyph->
vxmin + (bmp->
width + pad_l + pad_r) / map->size;
1821 mapglyph->
vymin = (-glyph->bitmap_top - pad_t) / map->size;
1822 mapglyph->
vymax = mapglyph->
vymin + (bmp->
rows + pad_t + pad_b) / map->size;
1831 Con_DPrintf(
"glyphinfo: Glyph: %lu at (%i, %i)\n", (
unsigned long)ch, glyph_column, glyph_row);
1832 Con_DPrintf(
"glyphinfo: %f, %f, %lu\n", bearingX, map->sfx, (
unsigned long)glyph->metrics.horiBearingX);
1833 if (ch >= 32 && ch <= 128)
1834 Con_DPrintf(
"glyphinfo: Character: %c\n", (
int)ch);
1844 map->glyphs[mapch].
image =
false;
1847 if ((
int)mapch == chars_per_map)
1849 if (++glyph_column % chars_per_line == 0)
1866 font->
name, mapstart->size, map_startglyph);
1881 if (outmapch !=
NULL)
1882 *outmapch = _ch - map->start;
1893 Con_DPrintf(
CON_WARN "Warning: You are using an legacy API '%s', which have certain limitations; please use 'Font_GetMapForChar' instead\n",
name);
1913 ft2_font_map_t *map = start;
1916 if (map && map->start > ch)
1939 font_incmap_t *incmap;
1941 incmap = map->incmap;
1946 map = incmap->fontmap;
1951 if (map->glyphchars[
i] == ch)
1957 else if (map->glyphchars[
i] == 0)
1974 ft2_font_map_t *map;
1997 if (map && map->start <= ch)
#define CF_CLIENT
cvar/command that only the client can change/execute
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
char * va(char *buf, size_t buflen, const char *format,...)
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
#define dp_strlcpy(dst, src, dsize)
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
void Con_DPrintf(const char *fmt,...)
A Con_Printf that only shows up if the "developer" cvar is set.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
void Con_DPrint(const char *msg)
A Con_Print that only shows up if the "developer" cvar is set.
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
cachepic_t * Draw_NewPic(const char *picname, int width, int height, unsigned char *pixels, textype_t textype, int texflags)
const char * Draw_GetPicName(cachepic_t *pic)
#define MAX_FONT_FALLBACKS
qbool Draw_IsPicLoaded(cachepic_t *pic)
unsigned char * FS_LoadFile(const char *path, mempool_t *pool, qbool quiet, fs_offset_t *filesizepointer)
static int(ZEXPORT *qz_inflate)(z_stream *strm
const char * FS_FileExists(const char *filename)
Look for a file in the packages and in the filesystem Returns its canonical name (same case as used i...
(* qFT_Get_Char_Index)(FT_Face face, FT_ULong charcode)
static void Font_Postprocess(ft2_font_t *fnt, unsigned char *imagedata, int pitch, int bpp, int w, int h, int *pad_l, int *pad_r, int *pad_t, int *pad_b)
cvar_t r_font_size_snapping
#define fix_glyph_coords_tier2(glyph, order)
(* qFT_Set_Pixel_Sizes)(FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height)
static const Uchar unicode_bigblocks[]
static qbool Font_LoadFile(const char *name, int _face, ft2_settings_t *settings, ft2_font_t *font)
cvar_t r_font_disable_incmaps
cvar_t r_font_nonpoweroftwo
(* qFT_Set_Char_Size)(FT_Face face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horz_resolution, FT_UInt vert_resolution)
qbool Font_OpenLibrary(void)
static int img_fontmap[256]
(* qFT_Done_FreeType)(FT_Library library)
ft2_font_map_t * Font_MapForIndex(ft2_font_t *font, int index)
static qbool Font_Attach(ft2_font_t *font, ft2_attachment_t *attachment)
static qbool Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ch, ft2_font_map_t **outmap, int *outmapch, qbool incmap_ok)
cvar_t r_font_disable_freetype
(* qFT_New_Memory_Face)(FT_Library library, const FT_Byte *file_base, FT_Long file_size, FT_Long face_index, FT_Face *aface)
static void incmap_post_process(font_incmap_t *incmap, Uchar ch, unsigned char *data, ft2_font_map_t **outmap, int *outmapch)
(* qFT_Select_Size)(FT_Face face, FT_Int strike_index)
float Font_SnapTo(float val, float snapwidth)
static FT_Library font_ft2lib
FreeType library handle.
ft2_font_t * Font_Alloc(void)
qbool Font_LoadFont(const char *name, dp_font_t *dpfnt)
static void UnloadMapChain(ft2_font_map_t *map)
static float Font_SearchSize(ft2_font_t *font, FT_Face fontface, float size)
qbool Font_GetKerningForMap(ft2_font_t *font, int map_index, float w, float h, Uchar left, Uchar right, float *outx, float *outy)
int Font_IndexForSize(ft2_font_t *font, float _fsize, float *outw, float *outh)
static void merge_single_map(ft2_font_map_t *targetmap, int targetindex, ft2_font_map_t *sourcemap, int sourceindex)
static qbool get_char_from_incmap(ft2_font_map_t *map, Uchar ch, ft2_font_map_t **outmap, int *outmapch)
static qbool Font_SetSize(ft2_font_t *font, float w, float h)
void Font_CloseLibrary(void)
float Font_VirtualToRealSize(float sz)
static void fontfilecache_FreeAll(void)
static const unsigned char * fontfilecache_LoadFile(const char *path, qbool quiet, fs_offset_t *filesizepointer)
static void fontfilecache_Free(const unsigned char *buf)
ft2_font_map_t * FontMap_FindForChar(ft2_font_map_t *start, Uchar ch)
static void transform_glyph_coords(glyph_slot_t *glyph, float shiftx, float shifty, float scalex, float scaley)
(* qFT_Init_FreeType)(FT_Library *alibrary)
static void update_pic_for_fontmap(ft2_font_map_t *fontmap, const char *identifier, int width, int height, unsigned char *data)
(* qFT_Render_Glyph)(FT_GlyphSlot slot, FT_Render_Mode render_mode)
qbool Font_LoadMapForIndex(ft2_font_t *font, int map_index, Uchar ch, ft2_font_map_t **outmap)
(* qFT_Attach_Stream)(FT_Face face, FT_Open_Args *parameters)
static void Font_Postprocess_Update(ft2_font_t *fnt, int bpp, int w, int h)
#define POSTPROCESS_MAXRADIUS
qbool Font_GetMapForChar(ft2_font_t *font, int map_index, Uchar ch, ft2_font_map_t **outmap, int *outmapch)
Query for or load a font map for a character, with the character's place on it.
#define calc_data_arguments(w, h)
static qbool Font_LoadSize(ft2_font_t *font, float size, qbool check_only)
void Font_UnloadFont(ft2_font_t *font)
static dllfunction_t ft2funcs[]
static qbool legacy_font_loading_api_alerted
qbool Font_GetKerningForSize(ft2_font_t *font, float w, float h, Uchar left, Uchar right, float *outx, float *outy)
static mempool_t * font_mempool
Memory pool for fonts.
static void alert_legacy_font_api(const char *name)
(* qFT_Get_Kerning)(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
(* qFT_Load_Char)(FT_Face face, FT_ULong char_code, FT_Int32 load_flags)
static dllhandle_t ft2_dll
Handle for FreeType2 DLL.
static font_postprocess_t pp
(* qFT_Done_Face)(FT_Face face)
static qbool should_use_incmap(Uchar ch)
static fontfilecache_t fontfiles[MAX_FONTFILES]
#define fix_glyph_coords_tier1(glyph, order)
(* qFT_Request_Size)(FT_Face face, FT_Size_Request req)
(* qFT_Load_Glyph)(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
#define FT_FACE_FLAG_KERNING
#define FT_LOAD_TARGET_MONO
#define FT_LOAD_TARGET_NORMAL
#define FT_LOAD_NO_HINTING
#define FT_LOAD_FORCE_AUTOHINT
#define FT_LOAD_MONOCHROME
struct FT_Size_RequestRec_ * FT_Size_Request
struct FT_GlyphSlotRec_ * FT_GlyphSlot
struct FT_FaceRec_ * FT_Face
#define FT_LOAD_NO_AUTOHINT
#define FT_LOAD_TARGET_LIGHT
#define FONT_CHARS_PER_MAP
#define FONT_CHARS_PER_LINE
GLenum GLsizei GLsizei height
GLubyte GLubyte GLubyte GLubyte w
GLsizei const GLfloat * value
GLenum GLenum GLsizei count
GLint GLenum GLint GLint y
GLsizeiptr const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
unsigned int CeilPowerOf2(unsigned int value)
returns the smallest integer greater than or equal to "value", or 0 if "value" is too big
#define bound(min, num, max)
#define MAX_QPATH
max length of a quake game pathname
const FT_Byte * memory_base
float req_sizes[MAX_FONT_SIZES]
int fallback_faces[MAX_FONT_FALLBACKS]
char fallbacks[MAX_FONT_FALLBACKS][MAX_QPATH]
unsigned char circlematrix[2 *POSTPROCESS_MAXRADIUS+1][2 *POSTPROCESS_MAXRADIUS+1]
unsigned char gausstable[2 *POSTPROCESS_MAXRADIUS+1]
ft2_font_map_t * font_maps[MAX_FONT_SIZES]
ft2_settings_t * settings
ft2_attachment_t * attachments
const unsigned char * data
viddef_mode_t mode
currently active video mode
qbool Sys_LoadDependency(const char **dllnames, dllhandle_t *handle, const dllfunction_t *fcts)
void Sys_FreeLibrary(dllhandle_t *handle)
viddef_t vid
global video state
#define Mem_FreePool(pool)
#define Mem_Alloc(pool, size)
#define Mem_AllocPool(name, flags, parent)