Laxkit
0.0.7.1
|
A wrapper for fonts that contains various metric information. More...
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 char * | whattype () |
Returns the type of anObject. | |
virtual anObject * | duplicate (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 |
char * | object_idstr |
Additional Inherited Members | |
Protected Attributes inherited from Laxkit::anObject | |
int | _count |
The reference count of the object. |
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.
|
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.