[deploy] fix font
This commit is contained in:
parent
abac7c9444
commit
c6d15dfd08
|
|
@ -110,27 +110,27 @@ void RendererImpl::MakeContextForWindow(WindowPtr window)
|
|||
}
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
IDWriteFactory* dwrite = d2d_res_->GetDWriteFactory();
|
||||
if (dwrite)
|
||||
{
|
||||
ComPtr<IDWriteFontCollection> system_collection;
|
||||
if (SUCCEEDED(dwrite->GetSystemFontCollection(&system_collection, FALSE)))
|
||||
{
|
||||
Vector<String> family_names;
|
||||
if (SUCCEEDED(d2d_res_->GetFontFamilyNames(family_names, system_collection)))
|
||||
{
|
||||
// dummy font
|
||||
FontPtr font = MakePtr<Font>();
|
||||
for (const auto& name : family_names)
|
||||
{
|
||||
FontCache::GetInstance().AddFontByFamily(name, font);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (SUCCEEDED(hr))
|
||||
//{
|
||||
// IDWriteFactory* dwrite = d2d_res_->GetDWriteFactory();
|
||||
// if (dwrite)
|
||||
// {
|
||||
// ComPtr<IDWriteFontCollection> system_collection;
|
||||
// if (SUCCEEDED(dwrite->GetSystemFontCollection(&system_collection, FALSE)))
|
||||
// {
|
||||
// Vector<String> family_names;
|
||||
// if (SUCCEEDED(d2d_res_->GetFontFamilyNames(family_names, system_collection)))
|
||||
// {
|
||||
// // dummy font
|
||||
// FontPtr font = MakePtr<Font>();
|
||||
// for (const auto& name : family_names)
|
||||
// {
|
||||
// FontCache::GetInstance().AddFontByFamily(name, font);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
KGE_THROW_IF_FAILED(hr, "Create render resources failed");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ Font::Font(const String& family_name, float size, uint32_t weight, FontPosture p
|
|||
, weight_(weight)
|
||||
, posture_(posture)
|
||||
, stretch_(stretch)
|
||||
, family_name_(family_name)
|
||||
{
|
||||
if (family_name.empty())
|
||||
return;
|
||||
|
|
@ -105,11 +106,6 @@ Font::Font(const String& family_name, float size, uint32_t weight, FontPosture p
|
|||
if (found)
|
||||
{
|
||||
this->ResetNativePointer(found->GetNativePointer());
|
||||
this->SetFamilyName(family_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->Fail(strings::Format("Font::Load failed: cannot find family name \"%s\"", family_name.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue