Pyro higlevel API
|
Public Types | |
typedef std::vector< float > | size_list_t |
Public Member Functions | |
Font () | |
Default Constructor... More... | |
Font (const Font &font) | |
Constructor... More... | |
Font (const font_properties &sProps) | |
Constructor... More... | |
Font (const String &cConfigName) | |
Constructor... More... | |
void | AddRef () |
Adds a reference counter. More... | |
void | Release () |
Releases all instances of a Font. More... | |
status_t | SetProperties (const font_properties &sProps) |
Sets the properties of the Font. More... | |
status_t | SetProperties (const String &cConfigName) |
Sets the properties of the Font. More... | |
status_t | SetProperties (float vSize, float vShear=0.0f, float vRotation=0.0f) |
Sets the properties of the Font. More... | |
status_t | SetFamilyAndStyle (const char *pzFamily, const char *pzStyle) |
Sets the family and style of the Font. More... | |
void | SetSize (float vSize) |
Sets the size... More... | |
void | SetShear (float vShear) |
Sets the shear. More... | |
void | SetRotation (float vRotation) |
Sets the rotation... More... | |
void | SetSpacing (int nSpacing) |
Sets the spacing of a font. More... | |
void | SetEncoding (int nEncoding) |
Sets the encoding of the Font. More... | |
void | SetFace (uint16 nFace) |
Sets the face of the Font. More... | |
void | SetFlags (uint32 nFlags) |
Sets the flags for the Font. More... | |
String | GetStyle () const |
Gets the Style of the Font... More... | |
String | GetFamily () const |
Gets the family of the Font... More... | |
float | GetSize () const |
Gets the size of the Font... More... | |
float | GetShear () const |
Gets the shear of the Font. More... | |
float | GetRotation () const |
Gets the rotation of the Font. More... | |
int | GetSpacing () const |
Gets the spacing of the Font. More... | |
int | GetEncoding () const |
Gets the encoding of the Font. More... | |
uint32 | GetFlags () const |
Gets the flags passed to the font. More... | |
font_direction | GetDirection () const |
Gets the direction of the Font. More... | |
void | GetTruncatedStrings (const char *stringArray[], int32 numStrings, uint32 mode, float width, char *resultArray[]) const |
Get truncated strings. More... | |
float | GetStringWidth (const char *pzString, int nLength=-1) const |
Gets the strings width.... More... | |
float | GetStringWidth (const String &cString) const |
Gets the strings width... More... | |
void | GetStringWidths (const char **apzStringArray, const int *anLengthArray, int nStringCount, float *avWidthArray) const |
Gets multiple string widths. More... | |
Point | GetTextExtent (const char *pzString, int nLength=-1, uint32 nFlags=0, int nTargetWidth=-1) const |
Point | GetTextExtent (const String &cString, uint32 nFlags=0, int nTargetWidth=-1) const |
void | GetTextExtents (const char **apzStringArray, const int *anLengthArray, int nStringCount, Point *acExtentArray, uint32 nFlags, int nTargetWidth=-1) const |
int | GetStringLength (const char *pzString, float vWidth, bool bIncludeLast=false) const |
Gets the length of a string. More... | |
int | GetStringLength (const char *pzString, int nLength, float vWidth, bool bIncludeLast=false) const |
Gets the length of a string. More... | |
int | GetStringLength (const String &cString, float vWidth, bool bIncludeLast=false) const |
Gets the length of a string. More... | |
void | GetStringLengths (const char **apzStringArray, const int *anLengthArray, int nStringCount, float vWidth, int anMaxLengthArray[], bool bIncludeLast=false) const |
Gets the lengths of multiple strings. More... | |
void | GetHeight (font_height *psHeight) const |
Gets the height of the Font. More... | |
std::vector< uint32 > | GetSupportedCharacters () const |
Gets the supported characters of the Font. More... | |
int | GetFontID (void) const |
Gets the Font handle ID. More... | |
bool | operator== (const Font &cOther) |
bool | operator!= (const Font &cOther) |
Font & | operator= (const Font &cOther) |
virtual size_t | GetFlattenedSize (void) const |
virtual status_t | Flatten (uint8 *pBuffer, size_t nSize) const |
virtual status_t | Unflatten (const uint8 *pBuffer) |
virtual int | GetType (void) const |
Public Member Functions inherited from os::Flattenable | |
virtual bool | TypeIsCompatible (int nType) const |
Static Public Member Functions | |
static status_t | GetConfigNames (std::vector< String > *pcTable) |
Get a list of default font names. More... | |
static status_t | GetDefaultFont (const String &cName, font_properties *psProps) |
Get the properties of a default font. More... | |
static status_t | SetDefaultFont (const String &cName, const font_properties &sProps) |
Set the properties of a default font. More... | |
static status_t | AddDefaultFont (const String &cName, const font_properties &sProps) |
Add a default font, or modify one if it already exists. More... | |
static int | GetFamilyCount () |
Get number of installed Font families. More... | |
static status_t | GetFamilyInfo (int nIndex, char *pzFamily) |
Get the name of a given font family. More... | |
static int | GetStyleCount (const char *pzFamily) |
Get number of styles in a given family. More... | |
static status_t | GetStyleInfo (const char *pzFamily, int nIndex, char *pzStyle, uint32 *pnFlags=NULL) |
Get info about a given font style. More... | |
static status_t | GetBitmapSizes (const String &cFamily, const String &cStyle, size_list_t *pcList) |
static bool | Rescan () |
Scans for new fonts... More... | |
Friends | |
class | View |
Font objects are reference counted to ease sharing between views. If the same font is set on two views they will both be affected by subsequent changes to the font.
A Font keeps track of all view's it has been added to so it can notify them whenever one of the properties of the Font changes.
Syllable primarily uses scalable TrueType Fonts but can also use various bitmap Fonts. When using TrueType Font's the glyphs will be scaled to the requested point-size, but when using bitmap Fonts the size will be "snapped" to the closest size supported by the Font.
When rendering TrueType Fonts, the glyphs have the ability to be antialiazed to improve the quality of the fonts. The view can either antialiaze against a fixed background color to maximize speed or against the background it is actually rendered at.
typedef std::vector<float> os::Font::size_list_t |
Font::Font | ( | ) |
Font::Font | ( | const Font & | font | ) |
References os::String::c_str(), os::font_properties::m_cFamily, os::font_properties::m_cStyle, os::font_properties::m_vRotation, os::font_properties::m_vShear, os::font_properties::m_vSize, and SetFamilyAndStyle().
Font::Font | ( | const font_properties & | sProps | ) |
References SetProperties().
Font::Font | ( | const String & | cConfigName | ) |
References os::String::c_str(), GetDefaultFont(), os::font_properties::m_cFamily, os::font_properties::m_cStyle, SetFamilyAndStyle(), and SetProperties().
|
static |
void Font::AddRef | ( | void | ) |
Referenced by os::View::SetFont().
|
virtual |
Implements os::Flattenable.
References os::String::c_str(), os::font_properties::m_cFamily, os::font_properties::m_cStyle, flattened_font_properties::m_nFlags, os::font_properties::m_nFlags, flattened_font_properties::m_vRotation, os::font_properties::m_vRotation, flattened_font_properties::m_vShear, os::font_properties::m_vShear, flattened_font_properties::m_vSize, os::font_properties::m_vSize, flattened_font_properties::m_zFamily, and flattened_font_properties::m_zStyle.
|
static |
|
static |
pcTable | - A vector pointer of os::String's to return all the config names in. |
References os::Application::GetInstance().
|
static |
cName | - Name of the default fFont. |
psProps | - font_propties pointer which will contain the properties of the default Font. |
References os::Application::GetInstance().
Referenced by Font(), and SetProperties().
font_direction Font::GetDirection | ( | ) | const |
References os::FONT_LEFT_TO_RIGHT.
int Font::GetEncoding | ( | ) | const |
String Font::GetFamily | ( | ) | const |
References os::font_properties::m_cFamily.
|
static |
\return |
References os::Application::GetInstance().
|
static |
uint32 Font::GetFlags | ( | ) | const |
References os::font_properties::m_nFlags.
|
virtual |
Implements os::Flattenable.
|
inline |
|
inline |
psHeight | - a font_height pointer which will contain the height of the Font. |
Referenced by os::View::GetFontHeight(), and os::TableView::Paint().
float Font::GetRotation | ( | ) | const |
References os::font_properties::m_vRotation.
float Font::GetShear | ( | ) | const |
References os::font_properties::m_vShear.
float Font::GetSize | ( | ) | const |
References os::font_properties::m_vSize.
Referenced by SplashView::GetPreferredSize(), and SplashView::SplashView().
int Font::GetSpacing | ( | ) | const |
int Font::GetStringLength | ( | const char * | pzString, |
float | vWidth, | ||
bool | bIncludeLast = false |
||
) | const |
int Font::GetStringLength | ( | const char * | pzString, |
int | nLength, | ||
float | vWidth, | ||
bool | bIncludeLast = false |
||
) | const |
int Font::GetStringLength | ( | const String & | cString, |
float | vWidth, | ||
bool | bIncludeLast = false |
||
) | const |
References os::String::c_str(), GetStringLengths(), and os::String::size().
void Font::GetStringLengths | ( | const char ** | apzStringArray, |
const int * | anLengthArray, | ||
int | nStringCount, | ||
float | vWidth, | ||
int | anMaxLengthArray[], | ||
bool | bIncludeLast = false |
||
) | const |
References os::Application::GetInstance().
Referenced by GetStringLength(), and os::View::GetStringLengths().
float Font::GetStringWidth | ( | const char * | pzString, |
int | nLength = -1 |
||
) | const |
References GetStringWidths().
Referenced by os::View::GetStringWidth(), GetStringWidth(), and os::TableView::Paint().
float Font::GetStringWidth | ( | const String & | cString | ) | const |
References os::String::c_str(), GetStringWidth(), and os::String::size().
void Font::GetStringWidths | ( | const char ** | apzStringArray, |
const int * | anLengthArray, | ||
int | nStringCount, | ||
float * | avWidthArray | ||
) | const |
References os::Application::GetInstance().
Referenced by GetStringWidth(), and os::View::GetStringWidths().
String Font::GetStyle | ( | ) | const |
References os::font_properties::m_cStyle.
|
static |
pzFamily | - The family. |
References os::Application::GetInstance().
|
static |
pzFamily | - The family of the Font. |
nIndex | - The index of the family. |
pzStyle | - The style of the Font. |
pnFlags | - The flags of the Font. |
References os::Application::GetInstance().
std::vector< uint32 > Font::GetSupportedCharacters | ( | ) | const |
References os::Message::AddInt32(), os::Message::FindBool(), os::Message::FindInt(), os::Message::FindInt32(), os::Application::GetAppPort(), os::Application::GetInstance(), and os::Messenger::SendMessage().
Point Font::GetTextExtent | ( | const char * | pzString, |
int | nLength = -1 , |
||
uint32 | nFlags = 0 , |
||
int | nTargetWidth = -1 |
||
) | const |
References GetTextExtents().
Referenced by os::View::GetTextExtent(), and GetTextExtent().
void Font::GetTextExtents | ( | const char ** | apzStringArray, |
const int * | anLengthArray, | ||
int | nStringCount, | ||
Point * | acExtentArray, | ||
uint32 | nFlags, | ||
int | nTargetWidth = -1 |
||
) | const |
void os::Font::GetTruncatedStrings | ( | const char * | stringArray[], |
int32 | numStrings, | ||
uint32 | mode, | ||
float | width, | ||
char * | resultArray[] | ||
) | const |
|
inlinevirtual |
Implements os::Flattenable.
References os::T_FONT.
bool Font::operator!= | ( | const Font & | cOther | ) |
bool Font::operator== | ( | const Font & | cOther | ) |
void Font::Release | ( | void | ) |
Referenced by os::View::View().
|
static |
References os::Message::FindBool(), and os::Application::GetInstance().
|
static |
void os::Font::SetEncoding | ( | int | nEncoding | ) |
void os::Font::SetFace | ( | uint16 | nFace | ) |
status_t Font::SetFamilyAndStyle | ( | const char * | pzFamily, |
const char * | pzStyle | ||
) |
References os::Message::AddInt32(), os::Message::AddString(), os::font_height::ascender, os::font_height::descender, os::Message::FindInt(), os::Application::GetAppPort(), os::Application::GetInstance(), os::font_height::line_gap, os::font_properties::m_cFamily, os::font_properties::m_cStyle, and os::Messenger::SendMessage().
Referenced by Font(), operator=(), os::View::SetFont(), and SetProperties().
void Font::SetFlags | ( | uint32 | nFlags | ) |
The flags that can be set are: FPF_MONOSPACED FPF_SMOOTHED //Antialiased FPF_BOLD FPF_ITALIC FPF_SYSTEM
References os::font_properties::m_nFlags.
status_t Font::SetProperties | ( | const font_properties & | sProps | ) |
References os::String::c_str(), os::font_properties::m_cFamily, os::font_properties::m_cStyle, and SetFamilyAndStyle().
Referenced by Font(), operator=(), os::View::SetFont(), SetProperties(), and Unflatten().
status_t Font::SetProperties | ( | const String & | cConfigName | ) |
References GetDefaultFont(), and SetProperties().
status_t Font::SetProperties | ( | float | vSize, |
float | vShear = 0.0f , |
||
float | vRotation = 0.0f |
||
) |
References os::font_properties::m_vRotation, os::font_properties::m_vShear, and os::font_properties::m_vSize.
void Font::SetRotation | ( | float | vRotation | ) |
References os::font_properties::m_vRotation.
void Font::SetShear | ( | float | vShear | ) |
References os::font_properties::m_vShear.
void Font::SetSize | ( | float | vSize | ) |
References os::font_properties::m_vSize.
Referenced by os::CalendarView::DayView::DayView(), and os::CalendarView::DOWView::DOWView().
void os::Font::SetSpacing | ( | int | nSpacing | ) |
|
virtual |
Implements os::Flattenable.
References os::font_properties::m_cFamily, os::font_properties::m_cStyle, flattened_font_properties::m_nFlags, os::font_properties::m_nFlags, flattened_font_properties::m_vRotation, os::font_properties::m_vRotation, flattened_font_properties::m_vShear, os::font_properties::m_vShear, flattened_font_properties::m_vSize, os::font_properties::m_vSize, flattened_font_properties::m_zFamily, flattened_font_properties::m_zStyle, and SetProperties().
|
friend |