JWM Source Documentation
Macros | Typedefs | Functions
font.h File Reference

Header for the font functions. More...

#include "color.h"

Go to the source code of this file.

Macros

#define FONT_BORDER   0
 
#define FONT_MENU   1
 
#define FONT_POPUP   2
 
#define FONT_TRAY   3
 
#define FONT_PAGER   4
 
#define FONT_CLOCK   5
 
#define FONT_TASKLIST   6
 
#define FONT_TRAYBUTTON   7
 
#define FONT_COUNT   8
 

Typedefs

typedef unsigned char FontType
 Enumeration of different components that use fonts.
 

Functions

void InitializeFonts (void)
 Initialize font data.
 
void StartupFonts (void)
 Startup font support.
 
void ShutdownFonts (void)
 Shutdown font support.
 
void DestroyFonts (void)
 Destroy font data.
 
void SetFont (FontType type, const char *value)
 Set the font to use for a component.
 
void RenderString (Drawable d, FontType font, ColorType color, int x, int y, int width, const char *str)
 Render a string.
 
int GetStringWidth (FontType ft, const char *str)
 Get the width of a string.
 
int GetStringHeight (FontType ft)
 Get the height of a string.
 
char * ConvertFromUTF8 (char *str)
 Convert a string from UTF-8.
 

Detailed Description

Header for the font functions.

Author
Joe Wingbermuehle
Date
2004-2006

Definition in file font.h.

Macro Definition Documentation

#define FONT_BORDER   0

Definition at line 17 of file font.h.

Referenced by DrawBorderHelper(), GetTitleHeight(), and ParseWindowStyle().

#define FONT_CLOCK   5

Definition at line 22 of file font.h.

Referenced by DrawClock(), ParseClockStyle(), and StartupClock().

#define FONT_COUNT   8

Definition at line 25 of file font.h.

Referenced by DestroyFonts(), InitializeFonts(), ShutdownFonts(), and StartupFonts().

#define FONT_MENU   1
#define FONT_PAGER   4

Definition at line 21 of file font.h.

Referenced by DrawPager(), and ParsePagerStyle().

#define FONT_POPUP   2

Definition at line 19 of file font.h.

Referenced by MeasurePopupText(), ParsePopupStyle(), and ShowPopup().

#define FONT_TASKLIST   6

Definition at line 23 of file font.h.

Referenced by ComputeItemSize(), Parse(), Render(), and UpdateTaskBar().

#define FONT_TRAY   3

Definition at line 20 of file font.h.

Referenced by Draw(), Parse(), ResetButton(), SetSize(), and StartupTrayButtons().

#define FONT_TRAYBUTTON   7

Definition at line 24 of file font.h.

Referenced by Parse(), and ParseTrayButtonStyle().

Typedef Documentation

typedef unsigned char FontType

Enumeration of different components that use fonts.

Definition at line 16 of file font.h.

Function Documentation

char* ConvertFromUTF8 ( char *  str)

Convert a string from UTF-8.

Note that the string passed into this function is freed via Release if the same string is not returned from the function.

Definition at line 180 of file font.c.

References Allocate, Release, and Warning().

Referenced by ReadWMName().

void DestroyFonts ( void  )

Destroy font data.

Definition at line 158 of file font.c.

References FONT_COUNT, fontNames, and Release.

Referenced by Destroy().

int GetStringHeight ( FontType  ft)

Get the height of a string.

Parameters
ftThe font used to determine the height.
Returns
The height in pixels.

Definition at line 305 of file font.c.

References Assert, and fonts.

Referenced by ComputeDimensions(), ComputeItemSize(), CreateMoveResizeWindow(), DrawBorderHelper(), DrawButton(), DrawClock(), DrawPager(), GetTitleHeight(), InitializeMenu(), MeasurePopupText(), RenderString(), SetSize(), ShowPopup(), StartupClock(), StartupTrayButtons(), and UpdateTaskBar().

int GetStringWidth ( FontType  ft,
const char *  str 
)

Get the width of a string.

Parameters
ftThe font used to determine the width.
strThe string whose width to get.
Returns
The width of the string in pixels.

Definition at line 247 of file font.c.

References AllocateStack, display, fonts, GetUTF8String(), JXftTextExtentsUtf8, ReleaseStack, and ReleaseUTF8String().

Referenced by ComputeDimensions(), CreateMoveResizeWindow(), DrawBorderHelper(), DrawButton(), DrawButtons(), DrawClock(), DrawPager(), InitializeMenu(), MeasurePopupText(), SetSize(), StartupTrayButtons(), UpdateMoveWindow(), and UpdateResizeWindow().

void InitializeFonts ( void  )

Initialize font data.

Definition at line 59 of file font.c.

References FONT_COUNT, fontNames, and fonts.

Referenced by Initialize().

void RenderString ( Drawable  d,
FontType  font,
ColorType  color,
int  x,
int  y,
int  width,
const char *  str 
)

Render a string.

Parameters
dThe drawable on which to render the string.
fontThe font to use.
colorThe text color to use.
xThe x-coordinate at which to render.
yThe y-coordinate at which to render.
widthThe maximum width allowed.
strThe string to render.

Definition at line 325 of file font.c.

References AllocateStack, colors, display, fonts, GetStringHeight(), GetUTF8String(), GetXftColor(), JXCreateGC, JXDrawString, JXFreeGC, JXftDrawChange, JXftDrawSetClip, JXftDrawStringUtf8, JXftTextExtentsUtf8, JXSetFont, JXSetForeground, JXSetRegion, Min, ReleaseStack, ReleaseUTF8String(), rootColormap, rootVisual, and rootWindow.

Referenced by DrawBorderHelper(), DrawButton(), DrawClock(), DrawDialog(), DrawPager(), ShowPopup(), UpdateMoveWindow(), and UpdateResizeWindow().

void SetFont ( FontType  type,
const char *  value 
)

Set the font to use for a component.

Parameters
typeThe font component.
valueThe font to use.

Definition at line 312 of file font.c.

References _, CopyString(), fontNames, JUNLIKELY, Release, and Warning().

Referenced by ParseClockStyle(), ParseMenuStyle(), ParsePagerStyle(), ParsePopupStyle(), ParseTrayButtonStyle(), ParseTrayStyle(), and ParseWindowStyle().

void ShutdownFonts ( void  )

Shutdown font support.

Definition at line 142 of file font.c.

References display, FONT_COUNT, fonts, JXFreeFont, and JXftFontClose.

Referenced by Shutdown().

void StartupFonts ( void  )

joewing.net / Projects / JWM