#include <GraphFont.h>
Maintains the fonts and handles drawing strings onto FXDC surfaces.
Definition at line 51 of file GraphFont.h.
Public Member Functions | |
| CGraphFont () | |
| Constructor. | |
| ~CGraphFont () | |
| Destructor. | |
| void | buildFont (FXApp *a, bool hqaa, float nummultiplier) |
| Initialises the FXDC fonts and measures the metrics. | |
| int | getPrecision (double d) |
| Calculates the number of digits after the decimal point. | |
| int | getStringDimensions (FXString txt) |
| Calculates the string length in pixels. | |
| FXColor * | drawAAString (FXString txt, int &length) |
| Draws an antialiased string. | |
| float * | drawAAStringf (FXString txt, int &length) |
| Draw a antialiased string then convert the result to a float array. | |
| int | getStringDimensions (double d, int precision=0) |
| Calculates string length of a number with specified precision in pixels and rounds close-to-zero numbers to zero. | |
| FXColor * | drawAAString (double d, int &length, int precision=0) |
| Draws the number as an antialiased string with specified precision and rounds close-to-zero numbers to zero. | |
| float * | drawAAStringf (double d, int &length, int precision=0) |
| Draws the number as an antialiased string with specified precision and rounds close-to-zero numbers to zero then converts to a float array. | |
| void | initCairoMeasurements (cairo_t *c) |
| Measure font metrics for the Cairo canvas. | |
| float | getStringDimensions (cairo_t *c, FXString txt) |
| Calculates the string length in units. | |
| float | getStringDimensions (cairo_t *c, double d, int precision=0) |
| Calculates string length of a number with specified precision in units and rounds close-to-zero numbers to zero. | |
| void | drawString (cairo_t *c, float x, float y, FXString txt) |
| Draws an antialiased string to the Cairo surface. | |
| void | drawString (cairo_t *c, float x, float y, double d, int precision=0) |
| Draws the number as an antialiased string to the Cairo surface with specified precision and rounds close-to-zero numbers to zero. | |
Public Attributes | |
| FXFontDesc | textFontdesc |
| FXFontDesc | symFontdesc |
| int | fontheight |
| int | numfontheight |
| float | cairofontheight |
| float | cairobaselineheight |
| float | caironumfontheight |
Private Member Functions | |
| FXString | doubleToString (double d) |
| Convert double to string. | |
| FXString | preciseString (double d, int precision) |
| Pads a string so it has the specified number of digits after the decimal. | |
Private Attributes | |
| FXFont * | textFont |
| Text font. | |
| FXFont * | symFont |
| Symbol font. | |
| FXFont * | textSFont |
| Text sup/sub font. | |
| FXFont * | symSFont |
| Symbol sup/sub font. | |
| FXFont * | numFont |
| Number font (slightly different size). | |
| int | fontbaseline |
| int | fontSupbaseline |
| int | fontSubbaseline |
| int | numfontbaseline |
| float | fontkernel [3][3] |
| Gaussian AA kernel. | |
| bool | aamethod |
| Antialiasing method: true == HQ, false == LQ. | |
| float | numfactor |
| Number font enlargement factor. | |
| float | cairofontraise |
| float | cairofontlower |
| FXApp * | app |
| Application object pointer. | |
| CGraphFont::CGraphFont | ( | ) |
Constructor.
Creates the low quality antialiasing kernel.
Definition at line 1124 of file GraphFont.cpp.
References fontkernel, numFont, symFont, symSFont, textFont, and textSFont.
| CGraphFont::~CGraphFont | ( | ) |
| FXString CGraphFont::doubleToString | ( | double | d | ) | [private] |
Convert double to string.
Also returns 0 if abs(d) < ZEROERR.
| d | Value to convert. |
Definition at line 49 of file GraphFont.cpp.
References ZEROERR.
Referenced by getPrecision(), and preciseString().

| FXString CGraphFont::preciseString | ( | double | d, | |
| int | precision | |||
| ) | [private] |
Pads a string so it has the specified number of digits after the decimal.
| d | Value to convert. | |
| precision | Number of digits after the decimal |
Definition at line 75 of file GraphFont.cpp.
References doubleToString(), and getPrecision().
Referenced by drawAAString(), drawString(), and getStringDimensions().


| void CGraphFont::buildFont | ( | FXApp * | a, | |
| bool | hqaa, | |||
| float | nummultiplier | |||
| ) |
Initialises the FXDC fonts and measures the metrics.
| a | The application object. | |
| hqaa | High quality antialiasing setting, see CGraphFont::aamethod. | |
| nummultiplier | Number font size ratio. |
Definition at line 1053 of file GraphFont.cpp.
References aamethod, app, fontbaseline, fontheight, fontSubbaseline, fontSupbaseline, numfactor, numFont, numfontbaseline, numfontheight, symFont, symFontdesc, symSFont, textFont, textFontdesc, and textSFont.
Referenced by GreyLabWindow::cmdBuildFont(), GreyLabWindow::cmdGSHiresSave(), GreyLabWindow::cmdLSHiresSave(), GreyLabWindow::cmdSelectNumberFont(), GreyLabWindow::cmdSelectSymbolFont(), GreyLabWindow::cmdSelectTextFont(), and GreyLabWindow::readSettings().

| int CGraphFont::getPrecision | ( | double | d | ) |
Calculates the number of digits after the decimal point.
| d | Value to analyse. |
Definition at line 62 of file GraphFont.cpp.
References doubleToString().
Referenced by GreyLabWindow::cmdGSRedraw(), GreyLabWindow::cmdGSVectorRedraw(), GreyLabWindow::cmdLSRedraw(), GreyLabWindow::cmdLSVectorRedraw(), and preciseString().


| int CGraphFont::getStringDimensions | ( | FXString | txt | ) |
Calculates the string length in pixels.
| txt | String to measure. |
Definition at line 122 of file GraphFont.cpp.
References aamethod, symFont, symSFont, textFont, and textSFont.
Referenced by GreyLabWindow::cmdGSRedraw(), GreyLabWindow::cmdGSVectorRedraw(), GreyLabWindow::cmdLSRedraw(), GreyLabWindow::cmdLSVectorRedraw(), getStringDimensions(), HeightWinDialog::onGLRefresh(), and GreyLabWindow::renderString().

| FXColor * CGraphFont::drawAAString | ( | FXString | txt, | |
| int & | length | |||
| ) |
Draws an antialiased string.
| txt | Text to render. | |
| [out] | length | Length of resulting string. |
Definition at line 318 of file GraphFont.cpp.
References aamethod, app, fontbaseline, fontheight, fontkernel, fontSubbaseline, fontSupbaseline, symFont, symSFont, textFont, and textSFont.
Referenced by GreyLabWindow::cmdGSRedraw(), GreyLabWindow::cmdLSRedraw(), drawAAStringf(), and GreyLabWindow::renderString().

| float * CGraphFont::drawAAStringf | ( | FXString | txt, | |
| int & | length | |||
| ) |
Draw a antialiased string then convert the result to a float array.
Definition at line 631 of file GraphFont.cpp.
References drawAAString(), and fontheight.
Referenced by HeightWinDialog::onGLRefresh().


| int CGraphFont::getStringDimensions | ( | double | d, | |
| int | precision = 0 | |||
| ) |
Calculates string length of a number with specified precision in pixels and rounds close-to-zero numbers to zero.
| d | Value to measure. | |
| precision | Number of digits after the decimal |
Definition at line 105 of file GraphFont.cpp.
References aamethod, numFont, and preciseString().

| FXColor * CGraphFont::drawAAString | ( | double | d, | |
| int & | length, | |||
| int | precision = 0 | |||
| ) |
Draws the number as an antialiased string with specified precision and rounds close-to-zero numbers to zero.
| d | Number to render. | |
| [out] | length | Length of resulting string. |
| precision | Required number precision. |
Definition at line 216 of file GraphFont.cpp.
References aamethod, app, fontkernel, numFont, numfontbaseline, numfontheight, and preciseString().

| float * CGraphFont::drawAAStringf | ( | double | d, | |
| int & | length, | |||
| int | precision = 0 | |||
| ) |
Draws the number as an antialiased string with specified precision and rounds close-to-zero numbers to zero then converts to a float array.
Definition at line 608 of file GraphFont.cpp.
References drawAAString(), and numfontheight.

| void CGraphFont::initCairoMeasurements | ( | cairo_t * | c | ) |
Measure font metrics for the Cairo canvas.
| c | The Cairo canvas object. |
Definition at line 1006 of file GraphFont.cpp.
References cairobaselineheight, cairofontheight, cairofontlower, cairofontraise, caironumfontheight, numfactor, symFontdesc, and textFontdesc.
Referenced by GreyLabWindow::cmdGSVectorRedraw(), and GreyLabWindow::cmdLSVectorRedraw().

| float CGraphFont::getStringDimensions | ( | cairo_t * | c, | |
| FXString | txt | |||
| ) |
Calculates the string length in units.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| c | The Cairo canvas object. | |
| txt | String to measure. |
Definition at line 673 of file GraphFont.cpp.
References symFontdesc, and textFontdesc.
| float CGraphFont::getStringDimensions | ( | cairo_t * | c, | |
| double | d, | |||
| int | precision = 0 | |||
| ) |
Calculates string length of a number with specified precision in units and rounds close-to-zero numbers to zero.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| c | The Cairo canvas object. | |
| d | Value to measure. | |
| precision | Number of digits after the decimal |
Definition at line 660 of file GraphFont.cpp.
References getStringDimensions(), and preciseString().

| void CGraphFont::drawString | ( | cairo_t * | c, | |
| float | x, | |||
| float | y, | |||
| FXString | txt | |||
| ) |
Draws an antialiased string to the Cairo surface.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| c | The Cairo canvas object. | |
| x | X position on the canvas. | |
| y | Y position on the canvas. | |
| txt | Text to render. |
Definition at line 844 of file GraphFont.cpp.
References cairofontlower, cairofontraise, symFontdesc, and textFontdesc.
Referenced by GreyLabWindow::cmdGSVectorRedraw(), GreyLabWindow::cmdLSVectorRedraw(), and GreyLabWindow::renderString().

| void CGraphFont::drawString | ( | cairo_t * | c, | |
| float | x, | |||
| float | y, | |||
| double | d, | |||
| int | precision = 0 | |||
| ) |
Draws the number as an antialiased string to the Cairo surface with specified precision and rounds close-to-zero numbers to zero.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| c | The Cairo canvas object. | |
| x | X position on the canvas. | |
| y | Y position on the canvas. | |
| d | Number to render. | |
| precision | Required number precision. |
Definition at line 822 of file GraphFont.cpp.
References numfactor, preciseString(), and textFontdesc.

1.5.3