Changeset - r24651:d256fd14817f
[Not reviewed]
master
0 3 0
Patric Stout - 3 years ago 2021-01-12 18:52:30
truebrain@openttd.org
Codechange: nobody was using "str" parameter, so remove it
3 files changed with 8 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/fontdetection.cpp
Show inline comments
 
@@ -347,7 +347,7 @@ static int CALLBACK EnumFontCallback(con
 
	PLOGFONT os_data = MallocT<LOGFONT>(1);
 
	*os_data = logfont->elfLogFont;
 
	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);
 
	return 0; // stop enumerating
 
}
 
@@ -477,7 +477,7 @@ bool SetFallbackFont(FreeTypeSettings *s
 

	
 
		/* Save result. */
 
		callback->SetFontNames(settings, name);
 
		if (!callback->FindMissingGlyphs(nullptr)) {
 
		if (!callback->FindMissingGlyphs()) {
 
			DEBUG(freetype, 2, "CT-Font for %s: %s", language_isocode, name);
 
			result = true;
 
			break;
 
@@ -488,10 +488,10 @@ bool SetFallbackFont(FreeTypeSettings *s
 
		/* 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. */
 
		callback->SetFontNames(settings, "Arial Unicode MS");
 
		result = !callback->FindMissingGlyphs(nullptr);
 
		result = !callback->FindMissingGlyphs();
 
	}
 

	
 
	callback->FindMissingGlyphs(nullptr);
 
	callback->FindMissingGlyphs();
 
	return result;
 
}
 

	
 
@@ -623,7 +623,7 @@ bool SetFallbackFont(FreeTypeSettings *s
 

	
 
			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");
 

	
 
			if (!missing) {
src/strings.cpp
Show inline comments
 
@@ -1998,11 +1998,9 @@ const char *GetCurrentLanguageIsoCode()
 

	
 
/**
 
 * 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.
 
 * @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());
 
	const Sprite *question_mark[FS_END];
 
@@ -2014,7 +2012,6 @@ bool MissingGlyphSearcher::FindMissingGl
 
	this->Reset();
 
	for (const char *text = this->NextString(); text != nullptr; text = this->NextString()) {
 
		FontSize size = this->DefaultSize();
 
		if (str != nullptr) *str = text;
 
		for (WChar c = Utf8Consume(&text); c != '\0'; c = Utf8Consume(&text)) {
 
			if (c >= SCC_FIRST_FONT && c <= SCC_LAST_FONT) {
 
				size = (FontSize)(c - SCC_FIRST_FONT);
 
@@ -2095,7 +2092,7 @@ void CheckForMissingGlyphs(bool base_fon
 
{
 
	static LanguagePackGlyphSearcher 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 (bad_font) {
 
		/* We found an unprintable character... lets try whether we can find
src/strings_func.h
Show inline comments
 
@@ -277,7 +277,7 @@ public:
 
	 */
 
	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);
0 comments (0 inline, 0 general)