mirror of https://github.com/OpenTTD/OpenTTD
Codechange: nobody was using "str" parameter, so remove it
parent
57c45a2c01
commit
98400974a9
|
@ -347,7 +347,7 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT
|
||||||
PLOGFONT os_data = MallocT<LOGFONT>(1);
|
PLOGFONT os_data = MallocT<LOGFONT>(1);
|
||||||
*os_data = logfont->elfLogFont;
|
*os_data = logfont->elfLogFont;
|
||||||
info->callback->SetFontNames(info->settings, font_name, os_data);
|
info->callback->SetFontNames(info->settings, font_name, os_data);
|
||||||
if (info->callback->FindMissingGlyphs(nullptr)) return 1;
|
if (info->callback->FindMissingGlyphs()) return 1;
|
||||||
DEBUG(freetype, 1, "Fallback font: %s (%s)", font_name, english_name);
|
DEBUG(freetype, 1, "Fallback font: %s (%s)", font_name, english_name);
|
||||||
return 0; // stop enumerating
|
return 0; // stop enumerating
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
|
||||||
|
|
||||||
/* Save result. */
|
/* Save result. */
|
||||||
callback->SetFontNames(settings, name);
|
callback->SetFontNames(settings, name);
|
||||||
if (!callback->FindMissingGlyphs(nullptr)) {
|
if (!callback->FindMissingGlyphs()) {
|
||||||
DEBUG(freetype, 2, "CT-Font for %s: %s", language_isocode, name);
|
DEBUG(freetype, 2, "CT-Font for %s: %s", language_isocode, name);
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
|
@ -488,10 +488,10 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
|
||||||
/* For some OS versions, the font 'Arial Unicode MS' does not report all languages it
|
/* For some OS versions, the font 'Arial Unicode MS' does not report all languages it
|
||||||
* supports. If we didn't find any other font, just try it, maybe we get lucky. */
|
* supports. If we didn't find any other font, just try it, maybe we get lucky. */
|
||||||
callback->SetFontNames(settings, "Arial Unicode MS");
|
callback->SetFontNames(settings, "Arial Unicode MS");
|
||||||
result = !callback->FindMissingGlyphs(nullptr);
|
result = !callback->FindMissingGlyphs();
|
||||||
}
|
}
|
||||||
|
|
||||||
callback->FindMissingGlyphs(nullptr);
|
callback->FindMissingGlyphs();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,7 +623,7 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
|
||||||
|
|
||||||
callback->SetFontNames(settings, (const char*)file);
|
callback->SetFontNames(settings, (const char*)file);
|
||||||
|
|
||||||
bool missing = callback->FindMissingGlyphs(nullptr);
|
bool missing = callback->FindMissingGlyphs();
|
||||||
DEBUG(freetype, 1, "Font \"%s\" misses%s glyphs", file, missing ? "" : " no");
|
DEBUG(freetype, 1, "Font \"%s\" misses%s glyphs", file, missing ? "" : " no");
|
||||||
|
|
||||||
if (!missing) {
|
if (!missing) {
|
||||||
|
|
|
@ -1998,11 +1998,9 @@ const char *GetCurrentLanguageIsoCode()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether there are glyphs missing in the current language.
|
* Check whether there are glyphs missing in the current language.
|
||||||
* @param[out] str Pointer to an address for storing the text pointer.
|
|
||||||
* @return If glyphs are missing, return \c true, else return \c false.
|
* @return If glyphs are missing, return \c true, else return \c false.
|
||||||
* @post If \c true is returned and str is not nullptr, *str points to a string that is found to contain at least one missing glyph.
|
|
||||||
*/
|
*/
|
||||||
bool MissingGlyphSearcher::FindMissingGlyphs(const char **str)
|
bool MissingGlyphSearcher::FindMissingGlyphs()
|
||||||
{
|
{
|
||||||
InitFreeType(this->Monospace());
|
InitFreeType(this->Monospace());
|
||||||
const Sprite *question_mark[FS_END];
|
const Sprite *question_mark[FS_END];
|
||||||
|
@ -2014,7 +2012,6 @@ bool MissingGlyphSearcher::FindMissingGlyphs(const char **str)
|
||||||
this->Reset();
|
this->Reset();
|
||||||
for (const char *text = this->NextString(); text != nullptr; text = this->NextString()) {
|
for (const char *text = this->NextString(); text != nullptr; text = this->NextString()) {
|
||||||
FontSize size = this->DefaultSize();
|
FontSize size = this->DefaultSize();
|
||||||
if (str != nullptr) *str = text;
|
|
||||||
for (WChar c = Utf8Consume(&text); c != '\0'; c = Utf8Consume(&text)) {
|
for (WChar c = Utf8Consume(&text); c != '\0'; c = Utf8Consume(&text)) {
|
||||||
if (c >= SCC_FIRST_FONT && c <= SCC_LAST_FONT) {
|
if (c >= SCC_FIRST_FONT && c <= SCC_LAST_FONT) {
|
||||||
size = (FontSize)(c - SCC_FIRST_FONT);
|
size = (FontSize)(c - SCC_FIRST_FONT);
|
||||||
|
@ -2095,7 +2092,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
|
||||||
{
|
{
|
||||||
static LanguagePackGlyphSearcher pack_searcher;
|
static LanguagePackGlyphSearcher pack_searcher;
|
||||||
if (searcher == nullptr) searcher = &pack_searcher;
|
if (searcher == nullptr) searcher = &pack_searcher;
|
||||||
bool bad_font = !base_font || searcher->FindMissingGlyphs(nullptr);
|
bool bad_font = !base_font || searcher->FindMissingGlyphs();
|
||||||
#if defined(WITH_FREETYPE) || defined(_WIN32)
|
#if defined(WITH_FREETYPE) || defined(_WIN32)
|
||||||
if (bad_font) {
|
if (bad_font) {
|
||||||
/* We found an unprintable character... lets try whether we can find
|
/* We found an unprintable character... lets try whether we can find
|
||||||
|
|
|
@ -277,7 +277,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void SetFontNames(struct FreeTypeSettings *settings, const char *font_name, const void *os_data = nullptr) = 0;
|
virtual void SetFontNames(struct FreeTypeSettings *settings, const char *font_name, const void *os_data = nullptr) = 0;
|
||||||
|
|
||||||
bool FindMissingGlyphs(const char **str);
|
bool FindMissingGlyphs();
|
||||||
};
|
};
|
||||||
|
|
||||||
void CheckForMissingGlyphs(bool base_font = true, MissingGlyphSearcher *search = nullptr);
|
void CheckForMissingGlyphs(bool base_font = true, MissingGlyphSearcher *search = nullptr);
|
||||||
|
|
Loading…
Reference in New Issue