Codechange: Return fontcache font name as std::string.

This commit is contained in:
Peter Nelson
2023-05-26 19:32:41 +01:00
committed by PeterN
parent 90fdf17e39
commit 9976293c1e
6 changed files with 6 additions and 6 deletions

View File

@@ -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(); }
};

View File

@@ -178,7 +178,7 @@ static CTRunDelegateCallbacks _sprite_font_callback = {
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();