Laxkit  0.0.7.1
Public Member Functions | Public Attributes
Laxkit::LaxFontXlib Class Reference

A LaxFont using Xft. More...

Inheritance diagram for Laxkit::LaxFontXlib:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 LaxFontXlib (XftFont *f, int nid)
 LaxFontXlib (Display *dpy, const char *xlfd, int nid)
 Constructor. Uses an X Logical Font Description.
virtual int SetupMetrics ()
 Return 0 success else nonzero error.
virtual double charwidth (unsigned long chr, int real, double *width=NULL, double *height=NULL)
 Return the character width of ch.
virtual double contextcharwidth (char *start, char *pos, int real, double *width=NULL, double *height=NULL)
virtual double textheight ()
virtual double ascent ()
virtual double descent ()
virtual double Resize (double newsize)
- Public Member Functions inherited from Laxkit::LaxFont
 LaxFont (const char *fontconfigstr, int nid)
 Constructor. Uses a fontconfig description.
 LaxFont (const char *family, const char *style, double size, int nid)
virtual int laxfid ()
- Public Member Functions inherited from Laxkit::anObject
 anObject ()
 Set object_id=getUniqueNumber().
virtual ~anObject ()
 Empty virtual destructor.
virtual const charwhattype ()
 Returns the type of anObject.
virtual anObjectduplicate (anObject *ref=NULL)
virtual int inc_count ()
 Increment the data's count by 1. Returns count.
virtual int dec_count ()
 Decrement the count of the data, deleting if count is less than or equal to 0.
virtual int the_count ()

Public Attributes

int numcharsinfont
int firstchar
unsigned long textstyle
intcharwidths
intrealcharwidths
char cntlchar
XftFont * font
- Public Attributes inherited from Laxkit::LaxFont
int id
- Public Attributes inherited from Laxkit::anObject
int suppress_debug
DeleteRefCountedFunc deleteMe
 Called when the count is decremented to 0.
unsigned long object_id
charobject_idstr

Detailed Description

A LaxFont using Xft.

In addition to an XftFont holding the font, LaxFont also contains easy to get to info about the range of characters defined in the font (one continuous range is allowed per LaxFont), the text height, ascent, and descent, and the widths of the characters. The width is actually separated into 2 width arrays. One has the real character width, which could be 0, and one has the charwidths based on converted the 0 width characters into a hex representation. For instance, the character '\n' has ascii value 10, and it might be converted to "\0a". This is to aid text editors such as LineEdit.

These objects are reference counted via dec_count() and inc_count(). If a dec_count() results in a count of 0, then delete this is called.

Todo:
read up on Xft, have ability to maintain charwidths[] for multiple ranges, not just the basic Latin1/small [firstcharinfont + numcharsinfont]. Must be able to facilitate font subsetting

Constructor & Destructor Documentation

Laxkit::LaxFontXlib::LaxFontXlib ( XftFont *  f,
int  nid 
)

Takes over xfs. Calling code must not free it.

References Laxkit::getUniqueNumber().


Member Function Documentation

double Laxkit::LaxFontXlib::charwidth ( unsigned long  chr,
int  real,
double *  width = NULL,
double *  height = NULL 
)
virtual

Return the character width of ch.

This assumes the charwidth array exists already. If the real character width is 0, and r==0, this returns width of "\9f" or some such. Of course, this function is for latin-1 only.

Todo:
*** this is broken

Implements Laxkit::LaxFont.

double Laxkit::LaxFontXlib::contextcharwidth ( char start,
char pos,
int  real,
double *  width = NULL,
double *  height = NULL 
)
virtual

Some languages change the character based on where letter is in word.

Todo:
This function as it stands is totally worthless and meaningless.

Implements Laxkit::LaxFont.

int Laxkit::LaxFontXlib::SetupMetrics ( )
virtual

Return 0 success else nonzero error.

This fills up charwidths and realcharwidths with appropriate values.

Todo:
*** this is old and basically broken. is all core xlib

The documentation for this class was generated from the following files:

Mon Feb 17 2014 11:52:59, Laxkit