X11workbench Toolkit  1.0
font_legacy.c File Reference

Implementation file for LEGACY font helper functions. More...

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <memory.h>
#include <string.h>
#include <strings.h>
#include <signal.h>
#include <time.h>
#include <X11/cursorfont.h>
#include <locale.h>
#include "window_helper.h"
#include "draw_text.h"

Go to the source code of this file.

Macros

#define FONT_DUMP_DEBUG_LEVEL   DebugLevel_Heavy
 
#define DO_FONT_PARSE_THING(X)   pRval->X=p1; while(*p1 && *p1 != '-') p1++; if(*p1 == '-') *(p1++) = 0
 
#define DO_FONT_PARSE_THING1()
 
#define DO_FONT_PARSE_THING2(X)
 
#define FUZZY_FONT_EXACT_MATCH   (3 + 10 + 5 + 5 + 2 + 4 + 3 + 3 + 1 + 5 + 4 + 4)
 
#define DO_FONT_BUILD_THING(X)
 

Functions

static char * InternalCheckSetLocale (void)
 
static XFontStruct * WBGetDefaultFontStruct ()
 
static XFontSet WBGetDefaultFontSet (Display *pDisplay)
 
XFontStruct * WBCopyFontX (XFontStruct *pOldFont)
 make a copy of an existing font (best when assigning to a window) More...
 
void WBFontNameFromAlias (const char *szFontName, char *szDest, int cbDest)
 
WB_FONT_INFOWBParseFontName (const char *szFontName)
 
static int InternalFontMatch (const WB_FONT_INFO *p1, const WB_FONT_INFO *p2)
 
static int InternalFontMatch2 (const char *p1, const char *p2)
 
static __inline__ int __string_valid_check (const char *pString)
 
static void InternalBuildFontString (const char *szFontName, int iSize, int iFlags, char *pBuf, int cbBuf, int bForceWildcard)
 
XFontStruct * WBLoadFontX (Display *pDisplay, const char *szFontName, int iFontSize, int iFlags)
 load a font based on a font name, size, and font flags More...
 
int WBFontAvgCharWidthX (Display *pDisplay, const XFontStruct *pFont)
 Get the average character width for a font. More...
 
int WBFontSetDescent (Display *pDisplay, XFontSet fontSet)
 Get the maximum character descent from a font set. More...
 
int WBFontSetAscent (Display *pDisplay, XFontSet fontSet)
 Get the maximum character ascent from a font set. More...
 
int WBFontSetHeight (Display *pDisplay, XFontSet fontSet)
 Get the maximum character height from a font set. More...
 
int WBFontSetAvgCharWidth (Display *pDisplay, XFontSet fontSet)
 Get the average character width for a font set. More...
 
XCharStruct WBFontSetMaxBounds (Display *pDisplay, XFontSet fontSet)
 Get a 'maximized' copy of the 'max_bounds' member for the font set. More...
 
XFontStruct * WBLoadModifyFontX (Display *pDisplay, const XFontStruct *pOriginal, int iFontSize, int iFlags)
 load and modify a font according to the specified size and flags More...
 
XFontSet WBCopyModifyFontSet (Display *pDisplay, XFontSet fsOrig, int iFontSize, int iFlags)
 copy and modify a font set according to the specified size and flags More...
 
XFontSet WBFontSetFromFont (Display *pDisplay, const XFontStruct *pFont)
 Creates an 'XFontSet' from an XFontStruct for a given display. More...
 
XFontSet WBFontSetFromFontSingle (Display *pDisplay, const XFontStruct *pFont)
 Creates an 'XFontSet' from an XFontStruct for a given display, with only a single font in the set. More...
 
XFontStruct * WBFontFromFontSet (Display *pDisplay, XFontSet fontSet)
 Creates an 'XFontStruct' from the first font assigned to a Font Set. More...
 
int WBTextWidthX (XFontSet fontSet, const char *szText, int cbText)
 Obtain the pixel width of specified text for a specified XFontSet. More...
 
void WBTextExtentX (XFontSet fontSet, const char *szText, int cbText, WB_EXTENT *pExtent)
 Obtain the pixel extent of specified text for a specified XFontSet. More...
 
static void WBDumpFontStruct (const XFontStruct *pFont)
 
static void WBDumpMatchingFontNames (Display *pDisplay, const char *szFontName)
 
static void WBDumpFontSet (Display *pDisplay, XFontSet fontSet)
 
void WBDumpFontInfo (const char *szFontName)
 Dump debug information about fonts according to pSpec. More...
 

Detailed Description

Implementation file for LEGACY font helper functions.

This is the implementation file for LEGACY font helper functions

Definition in file font_legacy.c.

Macro Definition Documentation

◆ DO_FONT_BUILD_THING

#define DO_FONT_BUILD_THING (   X)
Value:
if((p1 + 2) >= pEnd) return; *(p1++) = '-'; \
if(__string_valid_check(X)) { strncpy(p1, X, (pEnd - p1)); p1 += strlen(p1); } else *(p1++) = '*'; \
*p1 = 0; if((p1 + 1) >= pEnd) return

◆ DO_FONT_PARSE_THING1

#define DO_FONT_PARSE_THING1 ( )
Value:
bzero(tbuf2,sizeof(tbuf2)); p3=tbuf2; \
while(*p1 && *p1 != '-' && p3 < (tbuf2 + sizeof(tbuf2) - 2)) *(p3++)=*(p1++); \
while(*p1 && *p1 != '-') p1++; if(*p1 == '-') *(p1++) = 0

◆ DO_FONT_PARSE_THING2

#define DO_FONT_PARSE_THING2 (   X)
Value:
DO_FONT_PARSE_THING1(); \
if(!tbuf2[0] || tbuf2[0]=='*') pRval->X = -1; else pRval->X = atoi(tbuf2)