mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 718513 - [dwrite] implement synthetic bolding for fonts loaded via @font-face with src:local(). r=bas
This commit is contained in:
parent
67c06fca06
commit
cca6cd92d3
@ -431,6 +431,36 @@ gfxDWriteFontEntry::CreateFontFace(IDWriteFontFace **aFontFace,
|
||||
HRESULT hr;
|
||||
if (mFont) {
|
||||
hr = mFont->CreateFontFace(aFontFace);
|
||||
if (SUCCEEDED(hr) && (aSimulations & DWRITE_FONT_SIMULATIONS_BOLD) &&
|
||||
!((*aFontFace)->GetSimulations() & DWRITE_FONT_SIMULATIONS_BOLD)) {
|
||||
// need to replace aFontFace with a version that has the Bold
|
||||
// simulation - unfortunately, DWrite doesn't provide a simple API
|
||||
// for this
|
||||
nsRefPtr<IDWriteFontFace> origFace = (*aFontFace);
|
||||
(*aFontFace)->Release();
|
||||
*aFontFace = NULL;
|
||||
UINT32 numberOfFiles = 0;
|
||||
hr = origFace->GetFiles(&numberOfFiles, NULL);
|
||||
if (FAILED(hr)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsAutoTArray<IDWriteFontFile*,1> files;
|
||||
files.AppendElements(numberOfFiles);
|
||||
hr = origFace->GetFiles(&numberOfFiles, files.Elements());
|
||||
if (FAILED(hr)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
hr = gfxWindowsPlatform::GetPlatform()->GetDWriteFactory()->
|
||||
CreateFontFace(origFace->GetType(),
|
||||
numberOfFiles,
|
||||
files.Elements(),
|
||||
origFace->GetIndex(),
|
||||
aSimulations,
|
||||
aFontFace);
|
||||
for (UINT32 i = 0; i < numberOfFiles; ++i) {
|
||||
files[i]->Release();
|
||||
}
|
||||
}
|
||||
} else if (mFontFile) {
|
||||
IDWriteFontFile *fontFile = mFontFile.get();
|
||||
hr = gfxWindowsPlatform::GetPlatform()->GetDWriteFactory()->
|
||||
|
Loading…
Reference in New Issue
Block a user