OpenCPN Partial API docs
Loading...
Searching...
No Matches
FontMgr.cpp
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 *
5 ***************************************************************************
6 * Copyright (C) 2013 by David S. Register *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22 **************************************************************************/
23
24#include <locale>
25#include <set>
26
27#include <wx/gdicmn.h>
28#include <wx/tokenzr.h>
29
30#include "FontMgr.h"
31#include "OCPNPlatform.h"
32#include "ocpn_plugin.h"
33
35 wxFont *font;
36 int pointsize_req;
37 wxFontStyle style_req;
38 wxFontWeight weight_req;
39 bool underline_req;
40};
41
43public:
44 ~OCPNwxFontList() { FreeAll(); }
45 wxFont *FindOrCreateFont(int pointSize, wxFontFamily family,
46 wxFontStyle style, wxFontWeight weight,
47 bool underline = false,
48 const wxString &face = wxEmptyString,
49 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
50 void FreeAll(void);
51
52private:
53 bool isCached(font_cache_record &record, int pointSize, wxFontFamily family,
54 wxFontStyle style, wxFontWeight weight, bool underline,
55 const wxString &facename, wxFontEncoding encoding);
56
57 std::vector<font_cache_record> m_fontVector;
58};
59
60extern wxString g_locale;
61
70wxString s_locale;
78int g_default_font_size;
79wxString g_default_font_facename;
80
81FontMgr *FontMgr::instance = NULL;
82
83FontMgr &FontMgr::Get() {
84 if (!instance) instance = new FontMgr;
85 return *instance;
86}
87
88void FontMgr::Shutdown() {
89 if (instance) {
90 delete instance;
91 instance = NULL;
92 }
93}
94
95FontMgr::FontMgr() : m_wxFontCache(NULL), m_fontlist(NULL), pDefFont(NULL) {
96 // Create the list of fonts
97 m_fontlist = new FontList;
98 m_fontlist->DeleteContents(true);
99
100 s_locale = g_locale;
101
102 // Get a nice generic font as default
103 pDefFont = FindOrCreateFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
104 wxFONTWEIGHT_BOLD, FALSE, wxString(_T ( "" )),
105 wxFONTENCODING_SYSTEM);
106}
107
108FontMgr::~FontMgr() {
109 m_fontlist->Clear();
110 delete m_fontlist;
111
112 delete m_wxFontCache;
113}
114
115void FontMgr::SetLocale(wxString &newLocale) { s_locale = newLocale; }
116
117wxColour FontMgr::GetFontColor(const wxString &TextElement) const {
118 MyFontDesc *pmfd = GetFontDesc(TextElement);
119 return pmfd ? pmfd->m_color : wxColour(0, 0, 0);
120}
121
122bool FontMgr::SetFontColor(const wxString &TextElement,
123 const wxColour color) const {
124 MyFontDesc *pmfd = GetFontDesc(TextElement);
125 if (pmfd) {
126 pmfd->m_color = color;
127 return true;
128 }
129 return false;
130}
131
132wxString FontMgr::GetFontConfigKey(const wxString &description) {
133 // Create the configstring by combining the locale with
134 // a hash of the font description. Hash is used because the i18n
135 // description can contain characters that mess up the config file.
136
137 wxString configkey;
138 configkey = s_locale;
139 configkey.Append(_T("-"));
140
141 using namespace std;
142 locale loc;
143 const collate<char> &coll = use_facet<collate<char> >(loc);
144 // char cFontDesc[101];
145 // wcstombs( cFontDesc, description.c_str(), 100 );
146 // cFontDesc[100] = 0;
147
148 wxCharBuffer abuf = description.ToUTF8();
149
150 int fdLen = strlen(abuf);
151
152 configkey.Append(wxString::Format(
153 _T("%08lx"), coll.hash(abuf.data(), abuf.data() + fdLen)));
154 return configkey;
155}
156
157int FontMgr::GetSystemFontSize() {
158 static int sys_font_size = 0;
159 if (!sys_font_size) {
160 wxFont sys_font = *wxNORMAL_FONT;
161 sys_font_size = sys_font.GetPointSize();
162 }
163 return sys_font_size;
164}
165
166wxString FontMgr::GetSystemFontFaceName() {
167 static wxString sys_font_facename;
168 if (sys_font_facename.IsEmpty()) {
169 wxFont sys_font = *wxNORMAL_FONT;
170 sys_font_facename = sys_font.GetFaceName();
171 }
172 return sys_font_facename;
173}
174
175bool FontMgr::IsDefaultFontEntry(const MyFontDesc *font_desc) const {
176 return font_desc && font_desc->m_is_default;
177 /*
178 if (!font_desc || !font_desc->m_font) return false;
179
180 int font_size = font_desc->m_font->GetPointSize();
181 return (g_default_font_size && font_size == g_default_font_size) ||
182 (!g_default_font_size && font_size == GetSystemFontSize());
183 */
184}
185
186wxFont *FontMgr::GetFont(const wxString &TextElement, int requested_font_size) {
187 // Look thru the font list for a match
188 MyFontDesc *pmfd;
189 auto node = m_fontlist->GetFirst();
190
191 while (node) {
192 pmfd = node->GetData();
193 // Check if the font matches both the text element and the requested size.
194 if (pmfd->m_dialogstring == TextElement &&
195 (pmfd->m_configstring.BeforeFirst('-') == s_locale)) {
196 if (requested_font_size == 0 && IsDefaultFontEntry(pmfd)) {
197 // Caller did not specify a font size, so return the default font.
198 // The user may have customized the default font in Options->User Fonts,
199 // else the system default font is used.
200 return pmfd->m_font;
201 } else if (requested_font_size != 0 &&
202 pmfd->m_font->GetPointSize() == requested_font_size) {
203 return pmfd->m_font;
204 }
205 }
206 node = node->GetNext();
207 }
208
209 // Found no font, so create a nice one and add to the list
210 wxString configkey = GetFontConfigKey(TextElement);
211
212 // Now create a benign, always present native font
213 // with optional user requested default size
214
215 int new_size;
216 if (0 == requested_font_size) {
217 new_size = g_default_font_size ? g_default_font_size : GetSystemFontSize();
218 } else
219 new_size = requested_font_size;
220
221 wxString face_name = g_default_font_facename.Length()
222 ? g_default_font_facename
223 : GetSystemFontFaceName();
224
225 wxString nativefont = GetSimpleNativeFont(new_size, face_name);
226 wxFont *nf = wxFont::New(nativefont);
227
228 wxColor color = GetDefaultFontColor(TextElement);
229
230 bool is_default = (requested_font_size == 0);
231 MyFontDesc *pnewfd =
232 new MyFontDesc(TextElement, configkey, nf, color, is_default);
233 m_fontlist->Append(pnewfd);
234
235 return pnewfd->m_font;
236}
237
238MyFontDesc *FontMgr::GetFontDesc(const wxString &TextElement) const {
239 // First try to find the default font entry
240 MyFontDesc *pmfd;
241 auto node = m_fontlist->GetFirst();
242 while (node) {
243 pmfd = node->GetData();
244 if (pmfd->m_dialogstring == TextElement && pmfd->m_is_default &&
245 pmfd->m_configstring.BeforeFirst('-') == s_locale) {
246 return pmfd;
247 }
248 node = node->GetNext();
249 }
250
251 // No default entry found, fall back to first matching entry
252 node = m_fontlist->GetFirst();
253 while (node) {
254 pmfd = node->GetData();
255 if (pmfd->m_dialogstring == TextElement &&
256 pmfd->m_configstring.BeforeFirst('-') == s_locale) {
257 return pmfd;
258 }
259 node = node->GetNext();
260 }
261
262 return NULL;
263}
264
265wxColour FontMgr::GetDefaultFontColor(const wxString &TextElement) {
266 wxColor defaultColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
267
268 // Special cases here
269 if (TextElement.IsSameAs(_("Console Legend")))
270 defaultColor = wxColour(0, 255, 0);
271 else if (TextElement.IsSameAs(_("Console Value")))
272 defaultColor = wxColour(0, 255, 0);
273 else if (TextElement.IsSameAs(_("Marks")))
274 defaultColor = wxColour(0, 0, 0);
275 else if (TextElement.IsSameAs(_("RouteLegInfoRollover")))
276 defaultColor = wxColour(0, 0, 0);
277 else if (TextElement.IsSameAs(_("AISRollover")))
278 defaultColor = wxColour(0, 0, 0);
279 else if (TextElement.IsSameAs(_("ExtendedTideIcon")))
280 defaultColor = wxColour(0, 0, 0);
281 else if (TextElement.IsSameAs(_("ChartTexts")))
282 defaultColor = wxColour(0, 0, 0);
283 else if (TextElement.IsSameAs(_("AIS Target Name")))
284 defaultColor = wxColour(0, 0, 0);
285#ifdef __WXMAC__
286 // Override, to adjust for light/dark mode
287 return wxColour(0, 0, 0);
288#endif
289
290 return defaultColor;
291}
292
293wxString FontMgr::GetSimpleNativeFont(int size, wxString face) {
294 // Now create a benign, always present native string
295 wxString nativefont;
296
297 // this should work for all platforms
298 nativefont = wxFont(size, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
299 wxFONTWEIGHT_NORMAL, false, face)
300 .GetNativeFontInfoDesc();
301
302 return nativefont;
303}
304
305bool FontMgr::SetFont(const wxString &TextElement, wxFont *pFont,
306 wxColour color) {
307 // Look thru the font list for a match
308 MyFontDesc *pmfd = GetFontDesc(TextElement);
309 // Todo Think about this
310 //
311 // Cannot delete the present font, since it may be in use elsewhere
312 // This WILL leak....but only on font changes
313 // delete pmfd->m_font; // purge
314 // any old value
315 if (pmfd) {
316 pmfd->m_font = pFont;
317 pmfd->m_nativeInfo = pFont->GetNativeFontInfoDesc();
318 pmfd->m_color = color;
319
320 return true;
321 }
322 return false;
323}
324
325int FontMgr::GetNumFonts(void) const { return m_fontlist->GetCount(); }
326
327const wxString &FontMgr::GetConfigString(int i) const {
328 MyFontDesc *pfd = m_fontlist->Item(i)->GetData();
329 return pfd->m_configstring;
330}
331
332const wxString &FontMgr::GetDialogString(int i) const {
333 MyFontDesc *pfd = m_fontlist->Item(i)->GetData();
334 return pfd->m_dialogstring;
335}
336
337wxArrayString FontMgr::GetDialogStrings(const wxString &locale) const {
338 std::set<wxString> uniqueStrings;
339
340 auto node = m_fontlist->GetFirst();
341 while (node) {
342 MyFontDesc *pmfd = node->GetData();
343 if (locale.IsEmpty() || pmfd->m_configstring.BeforeFirst('-') == locale) {
344 uniqueStrings.insert(pmfd->m_dialogstring);
345 }
346 node = node->GetNext();
347 }
348 wxArrayString strings;
349 strings.reserve(uniqueStrings.size()); // Pre-allocate for efficiency
350 for (const auto &str : uniqueStrings) {
351 strings.Add(str);
352 }
353
354 return strings;
355}
356
357const wxString &FontMgr::GetNativeDesc(int i) const {
358 MyFontDesc *pfd = m_fontlist->Item(i)->GetData();
359 return pfd->m_nativeInfo;
360}
361
362wxString FontMgr::GetFullConfigDesc(int i) const {
363 MyFontDesc *pfd = m_fontlist->Item(i)->GetData();
364 wxString ret = pfd->m_dialogstring;
365 ret.Append(_T ( ":" ));
366 ret.Append(pfd->m_nativeInfo);
367 ret.Append(_T ( ":" ));
368
369 wxString cols(_T("rgb(0,0,0)"));
370 if (pfd->m_color.IsOk()) cols = pfd->m_color.GetAsString(wxC2S_CSS_SYNTAX);
371
372 ret.Append(cols);
373 return ret;
374}
375
377 // Search for a match in the list
378 MyFontDesc *pmfd;
379 auto node = m_fontlist->GetFirst();
380
381 while (node) {
382 pmfd = node->GetData();
383 if (pmfd->m_configstring == pConfigString) {
384 return pmfd;
385 }
386 node = node->GetNext();
387 }
388
389 return NULL;
390}
391
392void FontMgr::LoadFontNative(wxString *pConfigString, wxString *pNativeDesc) {
393 // Parse the descriptor string
394
395 wxStringTokenizer tk(*pNativeDesc, _T ( ":" ));
396 wxString dialogstring = tk.GetNextToken();
397 wxString nativefont = tk.GetNextToken();
398
399 wxString c = tk.GetNextToken();
400 wxColour color(c); // from string description
401
402 // Search for a match in the list
403 MyFontDesc *pmfd;
404 auto node = m_fontlist->GetFirst();
405
406 while (node) {
407 pmfd = node->GetData();
408 if (pmfd->m_configstring == *pConfigString) {
409 if (pmfd->m_configstring.BeforeFirst('-') == g_locale) {
410 pmfd->m_nativeInfo = nativefont;
411 wxFont *nf = pmfd->m_font->New(pmfd->m_nativeInfo);
412 pmfd->m_font = nf;
413 break;
414 }
415 }
416 node = node->GetNext();
417 }
418
419 // Create and add the font to the list
420 if (!node) {
421 wxFont *nf0 = new wxFont();
422
423#ifdef __OCPN__ANDROID__
424 wxFont *nf = new wxFont(nativefont);
425#else
426 wxFont *nf = nf0->New(nativefont);
427#endif
428
429 double font_size = nf->GetPointSize();
430 wxString s = nf->GetNativeFontInfoDesc();
431
432 // Scrub the native font string for bad unicode conversion
433#ifdef __WXMSW__
434 wxString face = nf->GetFaceName();
435 const wxChar *t = face.c_str();
436 if (*t > 255) {
437 delete nf;
438 wxString substitute_native = GetSimpleNativeFont(12, _T(""));
439 nf = nf0->New(substitute_native);
440 }
441#endif
442 delete nf0;
443
444 MyFontDesc *pnewfd =
445 new MyFontDesc(dialogstring, *pConfigString, nf, color);
446 m_fontlist->Append(pnewfd);
447 }
448}
449
450wxFont *FontMgr::FindOrCreateFont(int point_size, wxFontFamily family,
451 wxFontStyle style, wxFontWeight weight,
452 bool underline, const wxString &facename,
453 wxFontEncoding encoding) {
454 if (m_wxFontCache == 0) m_wxFontCache = new OCPNwxFontList;
455 return m_wxFontCache->FindOrCreateFont(point_size, family, style, weight,
456 underline, facename, encoding);
457}
458
459bool OCPNwxFontList::isCached(font_cache_record &record, int pointSize,
460 wxFontFamily family, wxFontStyle style,
461 wxFontWeight weight, bool underline,
462 const wxString &facename,
463 wxFontEncoding encoding) {
464 if (record.pointsize_req == pointSize && record.style_req == style &&
465 record.weight_req == weight && record.underline_req == underline) {
466 bool same;
467
468 wxFont *font = record.font;
469 // empty facename matches anything at all: this is bad because
470 // depending on which fonts are already created, we might get back
471 // a different font if we create it with empty facename, but it is
472 // still better than never matching anything in the cache at all
473 // in this case
474 if (!facename.empty()) {
475 const wxString &fontFace = font->GetFaceName();
476
477 // empty facename matches everything
478 same = !fontFace || fontFace == facename;
479 } else {
480 same = font->GetFamily() == family;
481 }
482 if (same && (encoding != wxFONTENCODING_DEFAULT)) {
483 // have to match the encoding too
484 same = font->GetEncoding() == encoding;
485 }
486 return same;
487 }
488 return false;
489}
490
491wxFont *OCPNwxFontList::FindOrCreateFont(int pointSize, wxFontFamily family,
492 wxFontStyle style, wxFontWeight weight,
493 bool underline,
494 const wxString &facename,
495 wxFontEncoding encoding) {
496 // from wx source code
497 // In all ports but wxOSX, the effective family of a font created using
498 // wxFONTFAMILY_DEFAULT is wxFONTFAMILY_SWISS so this is what we need to
499 // use for comparison.
500 //
501 // In wxOSX the original wxFONTFAMILY_DEFAULT seems to be kept and it uses
502 // a different font than wxFONTFAMILY_SWISS anyhow so we just preserve it.
503#ifndef __WXOSX__
504 if (family == wxFONTFAMILY_DEFAULT) family = wxFONTFAMILY_SWISS;
505#endif // !__WXOSX__
506
507 wxFont *font;
508 for (size_t i = 0; i < m_fontVector.size(); i++) {
509 font_cache_record record = m_fontVector[i];
510 if (isCached(record, pointSize, family, style, weight, underline, facename,
511 encoding))
512 return record.font;
513 }
514
515 // font not found, create the new one
516 // Support scaled HDPI displays automatically
517
518 font = NULL;
519 wxFont fontTmp(OCPN_GetDisplayContentScaleFactor() * pointSize, family, style,
520 weight, underline, facename, encoding);
521 if (fontTmp.IsOk()) {
522 font = new wxFont(fontTmp);
523 font_cache_record record;
524 record.font = font;
525 record.pointsize_req = pointSize;
526 record.style_req = style;
527 record.weight_req = weight;
528 record.underline_req = underline;
529 m_fontVector.push_back(record);
530 }
531
532 return font;
533}
534
535void OCPNwxFontList::FreeAll(void) {
536 wxFont *font;
537 for (size_t i = 0; i < m_fontVector.size(); i++) {
538 font_cache_record record = m_fontVector[i];
539 font = record.font;
540 delete font;
541 }
542 m_fontVector.clear();
543}
544
545static wxString FontCandidates[] = {_("AISTargetAlert"),
546 _("AISTargetQuery"),
547 _("StatusBar"),
548 _("AIS Target Name"),
549 _("ObjectQuery"),
550 _("RouteLegInfoRollover"),
551 _("ExtendedTideIcon"),
552 _("CurrentValue"),
553 _("Console Legend"),
554 _("Console Value"),
555 _("AISRollover"),
556 _("TideCurrentGraphRollover"),
557 _("Marks"),
558 _("ChartTexts"),
559 _("ToolTips"),
560 _("Dialog"),
561 _("Menu"),
562 _("GridText"),
563 _T("END_OF_LIST")};
564
566 wxString now_locale = g_locale;
567 wxArrayString string_array;
568
569 // Build the composite candidate array
570 wxArrayString candidateArray;
571 unsigned int i = 0;
572
573 // The fixed, static list
574 while (true) {
575 wxString candidate = FontCandidates[i];
576 if (candidate == _T("END_OF_LIST")) {
577 break;
578 }
579
580 candidateArray.Add(candidate);
581 i++;
582 }
583
584 // The Aux Key array
585 for (unsigned int i = 0; i < m_AuxKeyArray.GetCount(); i++) {
586 candidateArray.Add(m_AuxKeyArray[i]);
587 }
588
589 for (unsigned int i = 0; i < candidateArray.GetCount(); i++) {
590 wxString candidate = candidateArray[i];
591
592 // For each font identifier string in the FontCandidate array...
593
594 // In the current locale, walk the loaded list looking for a translation
595 // that is correct, according to the currently load .mo file.
596 // If found, add to a temporary array
597
598 wxString trans = wxGetTranslation(candidate);
599
600 MyFontDesc *pmfd;
601 auto node = m_fontlist->GetFirst();
602 while (node) {
603 pmfd = node->GetData();
604 wxString tlocale = pmfd->m_configstring.BeforeFirst('-');
605 if (tlocale == now_locale) {
606 if (trans == pmfd->m_dialogstring) {
607 string_array.Add(pmfd->m_dialogstring);
608 }
609 }
610
611 node = node->GetNext();
612 }
613 }
614
615 // now we have an array of correct translations
616 // Walk the loaded list again.
617 // If a list item's translation is not in the "good" array, mark it for
618 // removal
619
620 MyFontDesc *pmfd;
621 auto node = m_fontlist->GetFirst();
622 while (node) {
623 pmfd = node->GetData();
624 wxString tlocale = pmfd->m_configstring.BeforeFirst('-');
625 if (tlocale == now_locale) {
626 bool bfound = false;
627 for (unsigned int i = 0; i < string_array.GetCount(); i++) {
628 if (string_array[i] == pmfd->m_dialogstring) {
629 bfound = true;
630 break;
631 }
632 }
633 if (!bfound) { // mark for removal
634 pmfd->m_dialogstring = _T("");
635 pmfd->m_configstring = _T("");
636 }
637 }
638
639 node = node->GetNext();
640 }
641
642 // Remove the marked list items
643 node = m_fontlist->GetFirst();
644 while (node) {
645 pmfd = node->GetData();
646 if (pmfd->m_dialogstring == _T("")) {
647 bool bd = m_fontlist->DeleteObject(pmfd);
648 if (bd) node = m_fontlist->GetFirst();
649 } else
650 node = node->GetNext();
651 }
652
653 // And finally, for good measure, make sure that everything in the candidate
654 // array has a valid entry in the list
655 i = 0;
656 while (true) {
657 wxString candidate = FontCandidates[i];
658 if (candidate == _T("END_OF_LIST")) {
659 break;
660 }
661
662 GetFont(wxGetTranslation(candidate), g_default_font_size);
663
664 i++;
665 }
666}
667
668bool FontMgr::AddAuxKey(wxString key) {
669 for (unsigned int i = 0; i < m_AuxKeyArray.GetCount(); i++) {
670 if (m_AuxKeyArray[i] == key) return false;
671 }
672 m_AuxKeyArray.Add(key);
673 return true;
674}
675
676bool FontMgr::ResetFontToDefault(const wxString &TextElement) {
677 // Create default font with system settings
678 int size = g_default_font_size ? g_default_font_size : GetSystemFontSize();
679 wxString face = g_default_font_facename.Length() ? g_default_font_facename
680 : GetSystemFontFaceName();
681 wxString native = GetSimpleNativeFont(size, face);
682 wxFont *defaultFont = wxFont::New(native);
683
684 // Find and update the font descriptor
685 MyFontDesc *desc = GetFontDesc(TextElement);
686 if (desc) {
687 // Update font properties
688 desc->m_font = defaultFont;
689 desc->m_nativeInfo = native;
690 desc->m_color = GetDefaultFontColor(TextElement);
691 desc->m_is_default = true;
692 return true;
693 }
694
695 return false;
696}
Manages the font list.
Definition FontMgr.h:37
wxFont * FindOrCreateFont(int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underline=false, const wxString &facename=wxEmptyString, wxFontEncoding encoding=wxFONTENCODING_DEFAULT)
Creates or finds a matching font in the font cache.
Definition FontMgr.cpp:450
wxString GetFullConfigDesc(int i) const
Gets description of font at index i.
Definition FontMgr.cpp:362
wxColour GetFontColor(const wxString &TextElement) const
Gets the text color for a UI element.
Definition FontMgr.cpp:117
bool AddAuxKey(wxString key)
Adds new plugin-defined font configuration key.
Definition FontMgr.cpp:668
bool ResetFontToDefault(const wxString &TextElement)
Resets the font configuration for a UI element back to system defaults.
Definition FontMgr.cpp:676
void LoadFontNative(wxString *pConfigString, wxString *pNativeDesc)
Loads font settings from a string descriptor.
Definition FontMgr.cpp:392
bool SetFontColor(const wxString &TextElement, const wxColour color) const
Sets the text color for a UI element.
Definition FontMgr.cpp:122
static wxString GetFontConfigKey(const wxString &description)
Creates configuration key from UI element name by combining locale with hash.
Definition FontMgr.cpp:132
bool SetFont(const wxString &TextElement, wxFont *pFont, wxColour color)
Sets the default font properties for a UI element.
Definition FontMgr.cpp:305
int GetNumFonts(void) const
Gets the total number of font configurations currently loaded.
Definition FontMgr.cpp:325
wxColour GetDefaultFontColor(const wxString &TextElement)
Gets the default text color for a UI element.
Definition FontMgr.cpp:265
void ScrubList()
Cleans up stale font entries after a locale change.
Definition FontMgr.cpp:565
wxArrayString GetDialogStrings(const wxString &locale=wxEmptyString) const
Gets the list of unique dialog strings.
Definition FontMgr.cpp:337
MyFontDesc * FindFontByConfigString(wxString pConfigString)
Finds font descriptor by its configuration key.
Definition FontMgr.cpp:376
const wxString & GetNativeDesc(int i) const
Gets the native font descriptor string for the font at index i.
Definition FontMgr.cpp:357
const wxString & GetConfigString(int i) const
Gets the locale-specific configuration key for a font at index i.
Definition FontMgr.cpp:327
wxFont * GetFont(const wxString &TextElement, int requested_font_size=0)
Gets a font object for a UI element.
Definition FontMgr.cpp:186
const wxString & GetDialogString(int i) const
Gets the UI element identifier string for the font at index i.
Definition FontMgr.cpp:332
wxString m_nativeInfo
Platform-specific font descriptor string.
Definition FontDesc.h:54
wxString m_dialogstring
UI element identifier, e.g., "AISTargetAlert", "StatusBar".
Definition FontDesc.h:46
wxString m_configstring
Configuration key in "locale-hash" format.
Definition FontDesc.h:50
wxFont * m_font
Font object.
Definition FontDesc.h:58
wxColour m_color
Text color.
Definition FontDesc.h:62
bool m_is_default
Indicates if this is the default font entry for the TextElement.
Definition FontDesc.h:64
PlugIn Object Definition/API.