Changeset - r27445:74a12d52c1af
[Not reviewed]
master
0 6 0
Peter Nelson - 16 months ago 2023-05-26 18:32:41
peter1138@openttd.org
Codechange: Return fontcache font name as std::string.
6 files changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/fontcache.h
Show inline comments
 
@@ -134,7 +134,7 @@ public:
 
	 * Get the name of this font.
 
	 * @return The name of the font.
 
	 */
 
	virtual const char *GetFontName() = 0;
 
	virtual std::string GetFontName() = 0;
 

	
 
	/**
 
	 * Get the font cache of a given font size.
src/fontcache/freetypefontcache.cpp
Show inline comments
 
@@ -42,7 +42,7 @@ public:
 
	~FreeTypeFontCache();
 
	void ClearFontCache() override;
 
	GlyphID MapCharToGlyph(WChar key) override;
 
	const char *GetFontName() override { return face->family_name; }
 
	std::string GetFontName() override { return face->family_name; }
 
	bool IsBuiltInFont() override { return false; }
 
	const void *GetOSHandle() override { return &face; }
 
};
src/fontcache/spritefontcache.h
Show inline comments
 
@@ -31,7 +31,7 @@ public:
 
	virtual bool GetDrawGlyphShadow();
 
	virtual GlyphID MapCharToGlyph(WChar key) { assert(IsPrintable(key)); return SPRITE_GLYPH | key; }
 
	virtual const void *GetFontTable(uint32 tag, size_t &length) { length = 0; return nullptr; }
 
	virtual const char *GetFontName() { return "sprite"; }
 
	virtual std::string GetFontName() { return "sprite"; }
 
	virtual bool IsBuiltInFont() { return true; }
 
};
 

	
src/os/macosx/font_osx.h
Show inline comments
 
@@ -30,7 +30,7 @@ public:
 

	
 
	void ClearFontCache() override;
 
	GlyphID MapCharToGlyph(WChar key) override;
 
	const char *GetFontName() override { return font_name.c_str(); }
 
	std::string GetFontName() override { return font_name; }
 
	bool IsBuiltInFont() override { return false; }
 
	const void *GetOSHandle() override { return font.get(); }
 
};
src/os/macosx/string_osx.cpp
Show inline comments
 
@@ -178,7 +178,7 @@ static CTRunDelegateCallbacks _sprite_fo
 
		if (font == nullptr) {
 
			if (!_font_cache[i.second->fc->GetSize()]) {
 
				/* Cache font information. */
 
				CFAutoRelease<CFStringRef> font_name(CFStringCreateWithCString(kCFAllocatorDefault, i.second->fc->GetFontName(), kCFStringEncodingUTF8));
 
				CFAutoRelease<CFStringRef> font_name(CFStringCreateWithCString(kCFAllocatorDefault, i.second->fc->GetFontName().c_str(), kCFStringEncodingUTF8));
 
				_font_cache[i.second->fc->GetSize()].reset(CTFontCreateWithName(font_name.get(), i.second->fc->GetFontSize(), nullptr));
 
			}
 
			font = _font_cache[i.second->fc->GetSize()].get();
src/os/windows/font_win32.h
Show inline comments
 
@@ -34,7 +34,7 @@ public:
 
	~Win32FontCache();
 
	void ClearFontCache() override;
 
	GlyphID MapCharToGlyph(WChar key) override;
 
	const char *GetFontName() override { return this->fontname.c_str(); }
 
	std::string GetFontName() override { return this->fontname; }
 
	const void *GetOSHandle() override { return &this->logfont; }
 
};
 

	
0 comments (0 inline, 0 general)