SGL
Static Public Member Functions | List of all members
GFont Class Reference

This class contains static methods for dealing with fonts in our GUI system. More...

#include "gfont.h"

Static Public Member Functions

static void boldFont(GInteractor *interactor)
 Makes the given interactor's font bold. More...
 
static void changeFontSize(GInteractor *interactor, int dsize)
 Modifies the font of the given interactor, changing its size by the given number of points. More...
 
static void changeFontSize(GText *label, int dsize)
 Modifies the font of the given label, changing its size by the given number of points. More...
 
static QFont changeFontSize(const QFont &font, int dsize)
 Modifies the size of the given Qt font object, changing its size by the given number of points, and returning the new modified font. More...
 
static QFont deriveQFont(const QFont &font, QFont::Weight weight=QFont::Normal, int size=-1)
 Modifies the given font object, changing its weight and/or size to the given values, and returning the new modified font. More...
 
static QFont deriveQFont(const QFont &font, string fontFamily, QFont::Weight weight=QFont::Normal, int size=-1)
 Modifies the given font object, changing its font family, weight, and/or size to the given values, and returning the new modified font. More...
 
static QFont deriveQFont(string font, QFont::Weight weight=QFont::Normal, int size=-1)
 Modifies the given font object, changing its weight and/or size to the given values, and returning the new modified font. More...
 
static QFont deriveQFont(string font, string fontFamily, QFont::Weight weight=QFont::Normal, int size=-1)
 Modifies the given font object, changing its font family, weight, and/or size to the given values, and returning the new modified font. More...
 
static void italicFont(GInteractor *interactor)
 Makes the given interactor's font italic. More...
 
static string toFontString(const QFont &font)
 Converts the given Qt font object into a font string such as "Helvetica-12-Bold". More...
 
static QFont toQFont(string fontString)
 Converts a font string such as "Helvetica-12-Bold" into a Qt font object. More...
 
static QFont toQFont(const QFont &basisFont, string fontString)
 Converts a font string such as "Helvetica-*-12" into a Qt font object, using the given 'basis' object for any defaults that are not present in the font string. More...
 

Detailed Description

This class contains static methods for dealing with fonts in our GUI system.

A font string has the following format:

"family-style-size"

where both style and size are optional. If any of these elements are missing or specified as an asterisk, the existing value is retained.

Member Function Documentation

◆ boldFont()

void boldFont ( GInteractor interactor)
static

Makes the given interactor's font bold.

The font name and size are unchanged.

Exceptions
ErrorExceptionif the interactor is null

◆ changeFontSize() [1/3]

void changeFontSize ( GInteractor interactor,
int  dsize 
)
static

Modifies the font of the given interactor, changing its size by the given number of points.

The change in size can be positive or negative.

Exceptions
ErrorExceptionif the interactor is null

◆ changeFontSize() [2/3]

void changeFontSize ( GText label,
int  dsize 
)
static

Modifies the font of the given label, changing its size by the given number of points.

The change in size can be positive or negative.

Exceptions
ErrorExceptionif the interactor is null

◆ changeFontSize() [3/3]

QFont changeFontSize ( const QFont &  font,
int  dsize 
)
static

Modifies the size of the given Qt font object, changing its size by the given number of points, and returning the new modified font.

The change in size can be positive or negative.

◆ deriveQFont() [1/4]

QFont deriveQFont ( const QFont &  font,
QFont::Weight  weight = QFont::Normal,
int  size = -1 
)
static

Modifies the given font object, changing its weight and/or size to the given values, and returning the new modified font.

◆ deriveQFont() [2/4]

QFont deriveQFont ( const QFont &  font,
string   fontFamily,
QFont::Weight  weight = QFont::Normal,
int  size = -1 
)
static

Modifies the given font object, changing its font family, weight, and/or size to the given values, and returning the new modified font.

◆ deriveQFont() [3/4]

QFont deriveQFont ( string   font,
QFont::Weight  weight = QFont::Normal,
int  size = -1 
)
static

Modifies the given font object, changing its weight and/or size to the given values, and returning the new modified font.

The font you pass should be a font string such as "Helvetica-12-Bold".

◆ deriveQFont() [4/4]

QFont deriveQFont ( string   font,
string   fontFamily,
QFont::Weight  weight = QFont::Normal,
int  size = -1 
)
static

Modifies the given font object, changing its font family, weight, and/or size to the given values, and returning the new modified font.

The font you pass should be a font string such as "Helvetica-12-Bold".

◆ italicFont()

void italicFont ( GInteractor interactor)
static

Makes the given interactor's font italic.

The font name and size are unchanged.

Exceptions
ErrorExceptionif the interactor is null

◆ toFontString()

string toFontString ( const QFont &  font)
static

Converts the given Qt font object into a font string such as "Helvetica-12-Bold".

◆ toQFont() [1/2]

QFont toQFont ( string   fontString)
static

Converts a font string such as "Helvetica-12-Bold" into a Qt font object.

◆ toQFont() [2/2]

QFont toQFont ( const QFont &  basisFont,
string   fontString 
)
static

Converts a font string such as "Helvetica-*-12" into a Qt font object, using the given 'basis' object for any defaults that are not present in the font string.