#include <C4FontLoader.h>
Public Types | |
typedef CStdFontCustomImages | CustomImages |
Public Member Functions | |
void | DrawText (C4Surface *sfcDest, float iX, float iY, DWORD dwColor, const char *szText, DWORD dwFlags, C4Markup &Markup, float fZoom) |
bool | GetTextExtent (const char *szText, int32_t &rsx, int32_t &rsy, bool fCheckMarkup=true) |
int | GetLineHeight () const |
int | GetFontHeight () const |
int32_t | GetTextWidth (const char *szText, bool fCheckMarkup=true) |
std::tuple< std::string, int > | BreakMessage (const char *szMsg, int iWdt, bool fCheckMarkup, float fZoom=1.0f) |
int | BreakMessage (const char *szMsg, int iWdt, char *szOut, int iMaxOutLen, bool fCheckMarkup, float fZoom=1.0f) |
int | BreakMessage (const char *szMsg, int iWdt, StdStrBuf *pOut, bool fCheckMarkup, float fZoom=1.0f) |
int | GetMessageBreak (const char *szMsg, const char **ppNewPos, int iBreakWidth, float fZoom=1.0f) |
CStdFont () | |
~CStdFont () | |
void | Init (CStdVectorFont &VectorFont, const char *font_face_name, DWORD dwHeight, DWORD dwFontWeight=FW_NORMAL, bool fDoShadow=true) |
void | Clear () |
bool | IsInitialized () const |
bool | IsSameAsID (const char *szCFontName, int iCID, int iCIndent) const |
bool | IsSameAs (const char *szCFontName, DWORD iCHeight, DWORD dwCWeight) const |
void | SetCustomImages (CustomImages *pHandler) |
bool | GetFontImageSize (const char *szTag, int &width, int &height) const |
Public Attributes | |
int | id |
Protected Member Functions | |
bool | AddSurface () |
bool | CheckRenderedCharSpace (uint32_t iCharWdt, uint32_t iCharHgt) |
bool | AddRenderedChar (uint32_t dwChar, C4Facet *pfctTarget) |
C4Facet & | GetCharacterFacet (uint32_t c) |
C4Facet & | GetUnicodeCharacterFacet (uint32_t c) |
Protected Attributes | |
DWORD | dwDefFontHeight |
char | szFontName [80+1] |
std::vector< std::unique_ptr< C4Surface > > | psfcFontData |
int | iSfcSizes |
int | iFontZoom |
C4Surface * | sfcCurrent |
int32_t | iCurrentSfcX |
int32_t | iCurrentSfcY |
int | iHSpace |
int | iGfxLineHgt |
DWORD | dwWeight |
bool | fDoShadow |
C4Facet | fctAsciiTexCoords [256-' '] |
std::map< uint32_t, C4Facet > | fctUnicodeMap |
CustomImages * | pCustomImages |
CStdVectorFont * | pVectorFont |
int | iLineHgt |
Definition at line 75 of file C4FontLoader.h.
Definition at line 78 of file C4FontLoader.h.
CStdFont::CStdFont | ( | ) |
Definition at line 278 of file C4FontLoader.cpp.
References dwDefFontHeight, dwWeight, fDoShadow, FW_NORMAL, iFontZoom, iGfxLineHgt, iHSpace, iLineHgt, iSfcSizes, pCustomImages, pVectorFont, sfcCurrent, and szFontName.
|
inline |
Definition at line 150 of file C4FontLoader.h.
References Clear().
|
protected |
Definition at line 332 of file C4FontLoader.cpp.
References BltAlpha(), CheckRenderedCharSpace(), dwDefFontHeight, dwWeight, fDoShadow, iCurrentSfcX, iCurrentSfcY, iGfxLineHgt, C4Surface::Lock(), pVectorFont, RGBA(), C4Facet::Set(), C4Surface::SetPixDw(), sfcCurrent, C4Surface::Unlock(), and C4Facet::Wdt.
Referenced by GetUnicodeCharacterFacet(), and Init().
|
protected |
Definition at line 299 of file C4FontLoader.cpp.
References iCurrentSfcX, iCurrentSfcY, iSfcSizes, C4Surface::IsLocked(), psfcFontData, sfcCurrent, and C4Surface::Unlock().
Referenced by CheckRenderedCharSpace(), and Init().
std::tuple< std::string, int > CStdFont::BreakMessage | ( | const char * | szMsg, |
int | iWdt, | ||
bool | fCheckMarkup, | ||
float | fZoom = 1.0f |
||
) |
Definition at line 599 of file C4FontLoader.cpp.
References GetCharacterFacet(), GetFontImageSize(), GetNextCharacter(), iFontZoom, iHSpace, iLineHgt, SCharPos(), SCopy(), and C4Markup::SkipTags().
Referenced by BreakMessage(), C4LeagueSignupDialog::C4LeagueSignupDialog(), C4StartupModsDlg::C4StartupModsDlg(), C4GameMessage::Draw(), C4ScriptGuiWindow::Draw(), C4MenuItem::DrawElement(), C4GUI::Screen::DrawToolTip(), C4Menu::InitLocation(), C4GUI::InputDialog::InputDialog(), C4GUI::MessageDialog::MessageDialog(), C4GUI::ProgressDialog::ProgressDialog(), C4GUI::ProgressDialog::SetMessage(), C4Menu::UpdateElementPositions(), and C4ScriptGuiWindow::UpdateLayout().
int CStdFont::BreakMessage | ( | const char * | szMsg, |
int | iWdt, | ||
char * | szOut, | ||
int | iMaxOutLen, | ||
bool | fCheckMarkup, | ||
float | fZoom = 1.0f |
||
) |
Definition at line 563 of file C4FontLoader.cpp.
References BreakMessage().
int CStdFont::BreakMessage | ( | const char * | szMsg, |
int | iWdt, | ||
StdStrBuf * | pOut, | ||
bool | fCheckMarkup, | ||
float | fZoom = 1.0f |
||
) |
Definition at line 584 of file C4FontLoader.cpp.
References StdStrBuf::Append(), BreakMessage(), and StdStrBuf::Clear().
|
protected |
Definition at line 315 of file C4FontLoader.cpp.
References AddSurface(), iCurrentSfcX, iCurrentSfcY, and iSfcSizes.
Referenced by AddRenderedChar().
void CStdFont::Clear | ( | ) |
Definition at line 480 of file C4FontLoader.cpp.
References C4FontLoader::DestroyFont(), dwDefFontHeight, dwWeight, fctAsciiTexCoords, fctUnicodeMap, fDoShadow, FontLoader, FW_NORMAL, iFontZoom, iGfxLineHgt, iHSpace, iLineHgt, psfcFontData, pVectorFont, sfcCurrent, and szFontName.
Referenced by C4GraphicsResource::ClearFonts(), Init(), C4FontLoader::InitFont(), and ~CStdFont().
void CStdFont::DrawText | ( | C4Surface * | sfcDest, |
float | iX, | ||
float | iY, | ||
DWORD | dwColor, | ||
const char * | szText, | ||
DWORD | dwFlags, | ||
C4Markup & | Markup, | ||
float | fZoom | ||
) |
Definition at line 789 of file C4FontLoader.cpp.
References C4Draw::ActivateBlitModulation(), C4Markup::Apply(), C4Draw::Blit(), C4Markup::Clean(), C4Draw::DeactivateBlitModulation(), CStdFontCustomImages::DrawFontImage(), C4Draw::GetBlitModulation(), GetCharacterFacet(), GetFontImageSize(), GetNextCharacter(), GetTextExtent(), C4Facet::Hgt, iFontZoom, iGfxLineHgt, iHSpace, IsValidUtf8(), C4BltTransform::mat, ModulateClr(), ModulateClrA(), pCustomImages, pDraw, C4Markup::Read(), SCharPos(), SCopy(), C4Facet::Set(), C4DrawTransform::Set(), STDFONT_CENTERED, STDFONT_NOMARKUP, STDFONT_RIGHTALGN, C4Facet::Surface, C4Facet::Wdt, C4Facet::X, and C4Facet::Y.
Referenced by C4Draw::StringOut().
|
inlineprotected |
Definition at line 109 of file C4FontLoader.h.
References fctAsciiTexCoords, and GetUnicodeCharacterFacet().
Referenced by BreakMessage(), DrawText(), and GetTextExtent().
|
inline |
Definition at line 134 of file C4FontLoader.h.
References GetLineHeight().
bool CStdFont::GetFontImageSize | ( | const char * | szTag, |
int & | width, | ||
int & | height | ||
) | const |
Definition at line 911 of file C4FontLoader.cpp.
References CStdFontCustomImages::GetFontImageAspect(), iGfxLineHgt, and pCustomImages.
Referenced by BreakMessage(), DrawText(), and GetTextExtent().
|
inline |
Definition at line 125 of file C4FontLoader.h.
References iLineHgt.
Referenced by C4GameOverDlg::C4GameOverDlg(), C4Network2ClientListDlg::C4Network2ClientListDlg(), C4StartupAboutDlg::C4StartupAboutDlg(), C4StartupModsDlg::C4StartupModsDlg(), C4StartupModsListEntry::C4StartupModsListEntry(), C4StartupNetListEntry::C4StartupNetListEntry(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4FileSelDlg::DefaultListItem::DefaultListItem(), C4UpperBoard::Draw(), C4LoaderScreen::Draw(), C4IDList::Draw(), C4ScriptGuiWindow::Draw(), C4GUI::Tabular::Sheet::DrawCaption(), C4Game::DrawCrewOverheadText(), C4GUI::WoodenLabel::DrawElement(), C4GUI::MultilineLabel::DrawElement(), C4GUI::ProgressBar::DrawElement(), C4GUI::GroupBox::DrawElement(), C4GUI::Button::DrawElement(), C4GUI::Edit::DrawElement(), C4GUI::CheckBox::DrawElement(), C4GUI::ComboBox::DrawElement(), C4MenuItem::DrawElement(), C4ScoreboardDlg::DrawElement(), C4Chart::DrawElement(), C4GUI::ContextMenu::Entry::Entry(), C4GUI::FullscreenDialog::FullscreenDialog(), C4StartupGraphics::GetBlackFontByHeight(), C4GUI::Tabular::Sheet::GetCaptionSize(), C4GUI::Edit::GetCustomEditHeight(), C4GUI::ComboBox::GetDefaultHeight(), C4GUI::WoodenLabel::GetDefaultHeight(), C4GUI::Dialog::GetDefaultTitleHeight(), C4GraphicsResource::GetFontByHeight(), GetFontHeight(), C4GUI::GroupBox::GetMarginTop(), C4UpperBoard::Init(), C4MessageBoard::Init(), C4FileSelDlg::InitElements(), C4Menu::InitLocation(), C4GUI::MessageDialog::MessageDialog(), C4ChatControl::ChatSheet::NickItem::NickItem(), C4Game::SaveGameTitle(), C4StartupScenSelDlg::ScenListItem::ScenListItem(), C4GUI::FullscreenDialog::SetTitle(), C4Draw::TextOut(), C4ScoreboardDlg::Update(), C4Menu::UpdateElementPositions(), C4GUI::MultilineLabel::UpdateHeight(), and C4ChatControl::UpdateSize().
int CStdFont::GetMessageBreak | ( | const char * | szMsg, |
const char ** | ppNewPos, | ||
int | iBreakWidth, | ||
float | fZoom = 1.0f |
||
) |
Definition at line 731 of file C4FontLoader.cpp.
References fctAsciiTexCoords, iFontZoom, and iHSpace.
Referenced by C4LogBuffer::AppendLines().
bool CStdFont::GetTextExtent | ( | const char * | szText, |
int32_t & | rsx, | ||
int32_t & | rsy, | ||
bool | fCheckMarkup = true |
||
) |
Definition at line 505 of file C4FontLoader.cpp.
References GetCharacterFacet(), GetFontImageSize(), GetNextCharacter(), iFontZoom, iHSpace, iLineHgt, IsValidUtf8(), SCharPos(), SCopy(), C4Markup::SkipTags(), and C4Facet::Wdt.
Referenced by C4LogBuffer::AppendLines(), C4StartupModsDlg::C4StartupModsDlg(), C4StartupNetDlg::C4StartupNetDlg(), C4StartupOptionsDlg::C4StartupOptionsDlg(), C4StartupScenSelDlg::C4StartupScenSelDlg(), C4LoaderScreen::Draw(), C4Object::Draw(), C4GameMessage::Draw(), C4ScriptGuiWindow::Draw(), C4Game::DrawCrewOverheadText(), C4GUI::GroupBox::DrawElement(), C4GUI::Edit::DrawElement(), C4Chart::DrawElement(), DrawText(), C4GUI::Screen::DrawToolTip(), C4Facet::DrawValue(), C4Facet::DrawValue2(), C4GUI::ContextMenu::Entry::Entry(), C4GUI::Tabular::Sheet::GetCaptionSize(), C4GUI::LabeledEdit::GetControlSize(), C4GUI::CheckBox::GetStandardCheckBoxSize(), GetTextWidth(), C4Menu::InitLocation(), C4GUI::InputDialog::InputDialog(), IsSmallInputQuery(), C4GUI::LabeledEdit::LabeledEdit(), C4GUI::MessageDialog::MessageDialog(), C4GUI::Label::SetText(), and C4Menu::UpdateElementPositions().
|
inline |
Definition at line 140 of file C4FontLoader.h.
References GetTextExtent().
Referenced by C4GameOverDlg::C4GameOverDlg(), C4GameMessage::Draw(), C4GUI::WoodenLabel::DrawElement(), C4UpperBoard::Init(), C4FileSelDlg::InitElements(), and C4ScoreboardDlg::Update().
|
protected |
Definition at line 415 of file C4FontLoader.cpp.
References AddRenderedChar(), fctUnicodeMap, and C4Facet::Surface.
Referenced by GetCharacterFacet().
void CStdFont::Init | ( | CStdVectorFont & | VectorFont, |
const char * | font_face_name, | ||
DWORD | dwHeight, | ||
DWORD | dwFontWeight = FW_NORMAL , |
||
bool | fDoShadow = true |
||
) |
Definition at line 426 of file C4FontLoader.cpp.
References AddRenderedChar(), AddSurface(), Clear(), dwDefFontHeight, dwWeight, fctAsciiTexCoords, fDoShadow, iFontZoom, iGfxLineHgt, iHSpace, iLineHgt, iSfcSizes, C4Surface::Lock(), pVectorFont, CStdVectorFont::RefCnt, SCopy(), sfcCurrent, szFontName, and C4Surface::Unlock().
Referenced by C4FontLoader::InitFont().
|
inline |
Definition at line 159 of file C4FontLoader.h.
References szFontName.
Referenced by C4FontLoader::InitFont().
Definition at line 176 of file C4FontLoader.h.
References dwDefFontHeight, dwWeight, SEqual(), and szFontName.
Referenced by C4FontLoader::InitFont().
|
inline |
Definition at line 168 of file C4FontLoader.h.
References iHSpace, SEqual(), and szFontName.
|
inline |
Definition at line 186 of file C4FontLoader.h.
References pCustomImages.
Referenced by C4GraphicsResource::Clear(), and C4GraphicsResource::InitFonts().
|
protected |
Definition at line 83 of file C4FontLoader.h.
Referenced by AddRenderedChar(), Clear(), CStdFont(), Init(), and IsSameAs().
|
protected |
Definition at line 95 of file C4FontLoader.h.
Referenced by AddRenderedChar(), Clear(), CStdFont(), Init(), and IsSameAs().
|
protected |
Definition at line 98 of file C4FontLoader.h.
Referenced by Clear(), GetCharacterFacet(), GetMessageBreak(), and Init().
|
protected |
Definition at line 99 of file C4FontLoader.h.
Referenced by Clear(), and GetUnicodeCharacterFacet().
|
protected |
Definition at line 96 of file C4FontLoader.h.
Referenced by AddRenderedChar(), Clear(), CStdFont(), and Init().
|
protected |
Definition at line 91 of file C4FontLoader.h.
Referenced by AddRenderedChar(), AddSurface(), and CheckRenderedCharSpace().
|
protected |
Definition at line 91 of file C4FontLoader.h.
Referenced by AddRenderedChar(), AddSurface(), and CheckRenderedCharSpace().
int CStdFont::id |
Definition at line 79 of file C4FontLoader.h.
|
protected |
Definition at line 88 of file C4FontLoader.h.
Referenced by BreakMessage(), Clear(), CStdFont(), DrawText(), GetMessageBreak(), GetTextExtent(), and Init().
|
protected |
Definition at line 94 of file C4FontLoader.h.
Referenced by AddRenderedChar(), Clear(), CStdFont(), DrawText(), GetFontImageSize(), and Init().
|
protected |
Definition at line 93 of file C4FontLoader.h.
Referenced by BreakMessage(), Clear(), CStdFont(), DrawText(), GetMessageBreak(), GetTextExtent(), Init(), and IsSameAsID().
|
protected |
Definition at line 115 of file C4FontLoader.h.
Referenced by BreakMessage(), Clear(), CStdFont(), GetLineHeight(), GetTextExtent(), and Init().
|
protected |
Definition at line 87 of file C4FontLoader.h.
Referenced by AddSurface(), CheckRenderedCharSpace(), CStdFont(), and Init().
|
protected |
Definition at line 101 of file C4FontLoader.h.
Referenced by CStdFont(), DrawText(), GetFontImageSize(), and SetCustomImages().
|
protected |
Definition at line 86 of file C4FontLoader.h.
Referenced by AddSurface(), and Clear().
|
protected |
Definition at line 103 of file C4FontLoader.h.
Referenced by AddRenderedChar(), Clear(), CStdFont(), and Init().
|
protected |
Definition at line 90 of file C4FontLoader.h.
Referenced by AddRenderedChar(), AddSurface(), Clear(), CStdFont(), and Init().
|
protected |
Definition at line 84 of file C4FontLoader.h.
Referenced by Clear(), CStdFont(), Init(), IsInitialized(), IsSameAs(), and IsSameAsID().