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

A wrapper for fonts that contains various metric information. More...

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

List of all members.

Public Member Functions

 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 ()
virtual double charwidth (unsigned long chr, int real, double *width=NULL, double *height=NULL)=0
 Return the character width of ch.
virtual double contextcharwidth (char *start, char *pos, int real, double *width=NULL, double *height=NULL)=0
virtual double ascent ()=0
virtual double descent ()=0
virtual double textheight ()=0
virtual double Resize (double newsize)=0
- 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 id
unsigned long textstyle
char cntlchar
- 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

Additional Inherited Members

- Protected Attributes inherited from Laxkit::anObject
int _count
 The reference count of the object.

Detailed Description

A wrapper for fonts that contains various metric information.

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, and (?) FVontSets, have ability to maintain charwidths[] for multiple ranges, not just the basic Latin1/small [firstcharinfont + numcharsinfont]. Must be able to facilitate font subsetting

Member Function Documentation

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

Return the character width of ch.

If the real character width is 0, and r==0, this should return width of "\9f" or "?" or some default replacement character.

Implemented in Laxkit::LaxFontXlib, and Laxkit::LaxFontCairo.


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

Mon Feb 17 2014 11:52:59, Laxkit