|
PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
|
#include <PlatformFont.h>
Public Member Functions | |
| PlatformFont (const std::string &filename) | |
| PlatformFont (const std::string &filename, int style, int size, PColor fgcolor, PColor bgcolor, bool aa) | |
| Convenience constructor of PlatformFont: | |
| PlatformFont (PlatformFont &font) | |
| Copy constructor of PlatformFont: | |
| virtual | ~PlatformFont () |
| Copy constructor. | |
| virtual void | SetFontColor (PColor color) |
| Set*Color needs to be overridden because it doesn't change the SDL_Color data. | |
| virtual void | SetBackgroundColor (PColor color) |
| Set*Color needs to be overridden because it doesn't change the SDL_Color data. | |
| virtual void | SetFontSize (const int size) |
| Override SetFontSize to update TTF font and mark as changed. | |
| virtual void | SetFontStyle (const int style) |
| Override SetFontStyle to update TTF font and mark as changed. | |
| SDL_Surface * | RenderText (const std::string &text) |
| This takes care of all the busy work of rendering the text. | |
| unsigned int | GetTextWidth (const std::string &text) |
| unsigned int | GetTextHeight (const std::string &text) |
| unsigned int | GetPosition (const std::string &text, unsigned int x) |
| virtual std::string | ObjectName () const |
| TTF_Font * | GetTTFFont () const |
| bool | HasChanged () |
| Check if font or its colors have changed. | |
| void | ClearChanged () |
| Clear all changed flags. | |
| void | UpdateSDLColors () |
| Update SDL color cache from PColor objects. | |
| PlatformFont (const std::string &filename) | |
| PlatformFont (const std::string &filename, int style, int size, PColor fgcolor, PColor bgcolor, bool aa) | |
| PlatformFont (PlatformFont &font) | |
| virtual | ~PlatformFont () |
| Copy constructor. | |
| virtual void | SetFontColor (PColor color) |
| virtual void | SetBackgroundColor (PColor color) |
| SDL_Texture * | RenderTexture (const std::wstring &text) |
| This takes care of all the busy work of rendering the text. | |
| SDL_Texture * | RenderText (const std::wstring &text) |
| unsigned int | GetTextWidth (const std::string &text) |
| unsigned int | GetTextHeight (const std::string &text) |
| unsigned int | GetPosition (const std::string &text, unsigned int x) |
| virtual std::string | ObjectName () const |
| PlatformFont (const std::string &filename) | |
| PlatformFont (const std::string &filename, int style, int size, PColor fgcolor, PColor bgcolor, bool aa) | |
| PlatformFont (PlatformFont &font) | |
| virtual | ~PlatformFont () |
| unsigned int | GetTextWidth (const std::string &text) |
| unsigned int | GetTextHeight (const std::string &text) |
Public Member Functions inherited from PFont | |
| PFont () | |
| Standard constructors: | |
| PFont (const std::string &filename) | |
| PFont (const std::string &filename, int style, int size, PColor fgcolor, PColor bgcolor, bool aa) | |
| Convenience constructor of PFont: | |
| PFont (const PFont &font) | |
| Copy constructor of PFont: | |
| virtual | ~PFont () |
| Copy constructor. | |
| virtual bool | SetProperty (std::string, Variant v) |
| Standard Destructors. | |
| virtual Variant | GetProperty (std::string) const |
| virtual ObjectValidationError | ValidateProperty (std::string, Variant v) const |
| virtual ObjectValidationError | ValidateProperty (std::string) const |
| virtual void | SetFontFileName (const std::string &name) |
| Set methods for all of the data in font. | |
| virtual void | SetAntiAliased (const bool aa) |
| virtual std::string | GetFontFileName () const |
| virtual int | GetFontStyle () const |
| virtual int | GetFontSize () const |
| virtual PColor | GetFontColor () const |
| virtual PColor | GetBackgroundColor () const |
| virtual bool | GetAntiAliased () const |
| virtual bool | IsNormalFont () const |
| virtual bool | IsBoldFont () const |
| virtual bool | IsItalicFont () const |
| virtual bool | IsUnderlineFont () const |
Public Member Functions inherited from PEBLObjectBase | |
| PEBLObjectBase () | |
| Standard Constructor. | |
| PEBLObjectBase (ComplexDataType cdt) | |
| Standard Constructor. | |
| PEBLObjectBase (const PEBLObjectBase &pob) | |
| virtual | ~PEBLObjectBase () |
| Standard Destructor. | |
| virtual bool | InitializeProperty (std::string name, Variant v) |
| Variant | GetProperty (std::string) const |
| ComplexDataType | GetType () |
| virtual std::ostream & | PrintProperties (std::ostream &out) |
| virtual Variant | GetPropertyList () |
Protected Member Functions | |
| virtual std::ostream & | SendToStream (std::ostream &out) const |
| This sends the font descriptions to the specified stream. | |
| virtual std::ostream & | SendToStream (std::ostream &out) const |
| This sends the font descriptions to the specified stream. | |
| virtual std::ostream & | SendToStream (std::ostream &out) const |
| This sends the font descriptions to the specified stream. | |
Protected Member Functions inherited from PFont | |
| PColor * | GetFontColorPtr () const |
| PColor * | GetBackgroundColorPtr () const |
Additional Inherited Members | |
Protected Attributes inherited from PFont | |
| std::string | mFontFileName |
| int | mFontStyle |
| int | mFontSize |
| bool | mAntiAliased |
Protected Attributes inherited from PEBLObjectBase | |
| ComplexDataType | mCDT |
| std::map< std::string, Variant > | mProperties |
This is a platform-specific font class. Much of the information is held in the generic PFont class, but this class needs to hold onto an actual font structure from the font library, and handle the rendering.
Validator platform font - provides dummy text metrics Used only for compilation/linking, never executed
Definition at line 52 of file sdl/PlatformFont.h.
| PlatformFont::PlatformFont | ( | const std::string & | filename | ) |
Definition at line 27 of file validator/PlatformFont.cpp.
| PlatformFont::PlatformFont | ( | const std::string & | filename, |
| int | style, | ||
| int | size, | ||
| PColor | fgcolor, | ||
| PColor | bgcolor, | ||
| bool | aa | ||
| ) |
Convenience constructor of PlatformFont:
Definition at line 117 of file sdl/PlatformFont.cpp.
References FontCache::FontCacheKey::filename, PEBLPath::FindFile(), PFont::GetBackgroundColorPtr(), FontCache::FontCacheManager::GetFont(), PFont::GetFontColorPtr(), FontCache::FontCacheManager::GetInstance(), Evaluator::gPath, PFont::mFontFileName, PFont::mFontSize, PFont::mFontStyle, SDLUtility::PColorToSDLColor(), PError::SignalFatalError(), FontCache::FontCacheKey::size, and FontCache::FontCacheKey::style.
| PlatformFont::PlatformFont | ( | PlatformFont & | font | ) |
Copy constructor of PlatformFont:
Definition at line 152 of file sdl/PlatformFont.cpp.
References FontCache::FontCacheKey::filename, PEBLPath::FindFile(), PFont::GetAntiAliased(), PFont::GetBackgroundColorPtr(), FontCache::FontCacheManager::GetFont(), PFont::GetFontColorPtr(), PFont::GetFontFileName(), PFont::GetFontSize(), PFont::GetFontStyle(), FontCache::FontCacheManager::GetInstance(), Evaluator::gPath, PFont::mAntiAliased, PFont::mFontFileName, PFont::mFontSize, PFont::mFontStyle, SDLUtility::PColorToSDLColor(), FontCache::FontCacheKey::size, and FontCache::FontCacheKey::style.
|
virtual |
Copy constructor.
Fonts are not geting cleaned up, I think. Standard destructor of PlatformFont
Definition at line 183 of file sdl/PlatformFont.cpp.
References FontCache::FontCacheManager::GetInstance(), NULL, and FontCache::FontCacheManager::ReleaseFont().
| PlatformFont::PlatformFont | ( | const std::string & | filename | ) |
| PlatformFont::PlatformFont | ( | const std::string & | filename, |
| int | style, | ||
| int | size, | ||
| PColor | fgcolor, | ||
| PColor | bgcolor, | ||
| bool | aa | ||
| ) |
| PlatformFont::PlatformFont | ( | PlatformFont & | font | ) |
|
virtual |
Copy constructor.
| PlatformFont::PlatformFont | ( | const std::string & | filename | ) |
| PlatformFont::PlatformFont | ( | const std::string & | filename, |
| int | style, | ||
| int | size, | ||
| PColor | fgcolor, | ||
| PColor | bgcolor, | ||
| bool | aa | ||
| ) |
| PlatformFont::PlatformFont | ( | PlatformFont & | font | ) |
|
virtual |
| void PlatformFont::ClearChanged | ( | ) |
Clear all changed flags.
Definition at line 290 of file sdl/PlatformFont.cpp.
References PColor::ClearChanged(), PFont::GetBackgroundColorPtr(), and PFont::GetFontColorPtr().
Referenced by PlatformLabel::Draw(), and PlatformTextBox::Draw().
| unsigned int PlatformFont::GetPosition | ( | const std::string & | text, |
| unsigned int | x | ||
| ) |
Definition at line 562 of file sdl/PlatformFont.cpp.
References GetTextWidth(), and PEBLUtility::is_utf8().
Referenced by PlatformTextBox::FindCursorPosition().
| unsigned int PlatformFont::GetPosition | ( | const std::string & | text, |
| unsigned int | x | ||
| ) |
| unsigned int PlatformFont::GetTextHeight | ( | const std::string & | text | ) |
Definition at line 547 of file sdl/PlatformFont.cpp.
References PEBLUtility::is_utf8().
Referenced by PlatformTextBox::FindCursorPosition(), PlatformTextBox::HandleKeyPress(), and PlatformTextBox::RenderText().
| unsigned int PlatformFont::GetTextHeight | ( | const std::string & | text | ) |
| unsigned int PlatformFont::GetTextHeight | ( | const std::string & | text | ) |
| unsigned int PlatformFont::GetTextWidth | ( | const std::string & | text | ) |
Definition at line 517 of file sdl/PlatformFont.cpp.
References PEBLUtility::DetectScript(), PEBLUtility::is_utf8(), and PEBLUtility::IsRTLScript().
Referenced by PlatformTextBox::FindCursorPosition(), GetPosition(), PlatformTextBox::HandleKeyPress(), and PlatformTextBox::RenderText().
| unsigned int PlatformFont::GetTextWidth | ( | const std::string & | text | ) |
| unsigned int PlatformFont::GetTextWidth | ( | const std::string & | text | ) |
|
inline |
Definition at line 78 of file sdl/PlatformFont.h.
Referenced by PlatformLabel::RenderText(), and PlatformTextBox::RenderText().
| bool PlatformFont::HasChanged | ( | ) |
Check if font or its colors have changed.
Definition at line 270 of file sdl/PlatformFont.cpp.
References PFont::GetBackgroundColorPtr(), PFont::GetFontColorPtr(), PColor::HasChanged(), and UpdateSDLColors().
|
inlinevirtual |
Reimplemented from PFont.
Definition at line 75 of file sdl/PlatformFont.h.
|
inlinevirtual |
Reimplemented from PFont.
Definition at line 87 of file PlatformFont_RTL.h.
| SDL_Surface * PlatformFont::RenderText | ( | const std::string & | text | ) |
This takes care of all the busy work of rendering the text.
Definition at line 318 of file sdl/PlatformFont.cpp.
References PEBLUtility::DetectScript(), PEBLUtility::is_utf8(), PEBLUtility::IsRTLScript(), PFont::mAntiAliased, NULL, PError::SignalFatalError(), and PError::SignalWarning().
Referenced by PlatformLabel::RenderText(), and PlatformTextBox::RenderText().
| SDL_Surface * PlatformFont::RenderText | ( | const std::wstring & | text | ) |
Definition at line 626 of file PlatformFont_RTL.cpp.
References NULL.
| SDL_Texture * PlatformFont::RenderTexture | ( | const std::wstring & | text | ) |
This takes care of all the busy work of rendering the text.
|
protectedvirtual |
This sends the font descriptions to the specified stream.
Reimplemented from PFont.
Definition at line 619 of file sdl/PlatformFont.cpp.
|
protectedvirtual |
This sends the font descriptions to the specified stream.
Reimplemented from PFont.
|
protectedvirtual |
This sends the font descriptions to the specified stream.
Reimplemented from PFont.
|
virtual |
Set*Color needs to be overridden because it doesn't change the SDL_Color data.
Reimplemented from PFont.
Definition at line 212 of file sdl/PlatformFont.cpp.
References PFont::GetBackgroundColorPtr(), SDLUtility::PColorToSDLColor(), and PFont::SetBackgroundColor().
|
virtual |
Set*Color needs to be overridden because it doesn't change the SDL_Color data.
Reimplemented from PFont.
Definition at line 198 of file sdl/PlatformFont.cpp.
References PFont::GetFontColorPtr(), SDLUtility::PColorToSDLColor(), and PFont::SetFontColor().
|
virtual |
Override SetFontSize to update TTF font and mark as changed.
Reimplemented from PFont.
Definition at line 226 of file sdl/PlatformFont.cpp.
References PEBLPath::FindFile(), FontCache::FontCacheManager::GetFont(), FontCache::FontCacheManager::GetInstance(), Evaluator::gPath, PFont::mFontFileName, PFont::mFontSize, FontCache::FontCacheManager::ReleaseFont(), PFont::SetFontSize(), and FontCache::FontCacheKey::size.
|
virtual |
Override SetFontStyle to update TTF font and mark as changed.
Reimplemented from PFont.
Definition at line 248 of file sdl/PlatformFont.cpp.
References PEBLPath::FindFile(), FontCache::FontCacheManager::GetFont(), FontCache::FontCacheManager::GetInstance(), Evaluator::gPath, PFont::mFontFileName, PFont::mFontStyle, FontCache::FontCacheManager::ReleaseFont(), PFont::SetFontStyle(), and FontCache::FontCacheKey::style.
| void PlatformFont::UpdateSDLColors | ( | ) |
Update SDL color cache from PColor objects.
Definition at line 300 of file sdl/PlatformFont.cpp.
References PFont::GetBackgroundColorPtr(), PFont::GetFontColorPtr(), and SDLUtility::PColorToSDLColor().
Referenced by HasChanged().