本文整理汇总了C++中IDWriteFactory::CreateFontFace方法的典型用法代码示例。如果您正苦于以下问题:C++ IDWriteFactory::CreateFontFace方法的具体用法?C++ IDWriteFactory::CreateFontFace怎么用?C++ IDWriteFactory::CreateFontFace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDWriteFactory
的用法示例。
在下文中一共展示了IDWriteFactory::CreateFontFace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateFontFace
virtual HRESULT STDMETHODCALLTYPE CreateFontFace(
DWRITE_FONT_FACE_TYPE fontFaceType,
UINT32 numberOfFiles,
IDWriteFontFile* const* fontFiles,
UINT32 faceIndex,
DWRITE_FONT_SIMULATIONS fontFaceSimulationFlags,
IDWriteFontFace** fontFace
)
{
return orig_this->CreateFontFace(fontFaceType, numberOfFiles, fontFiles, faceIndex, fontFaceSimulationFlags, fontFace);
}
示例2: SafeRelease
LPVOID CDWriteExt::DwCreateFontFaceFromStream(uint8_t* pData, FX_DWORD size, int simulation_style)
{
IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory;
IDWriteFontFile* pDwFontFile = NULL;
IDWriteFontFace* pDwFontFace = NULL;
BOOL isSupportedFontType = FALSE;
DWRITE_FONT_FILE_TYPE fontFileType;
DWRITE_FONT_FACE_TYPE fontFaceType;
UINT32 numberOfFaces;
DWRITE_FONT_SIMULATIONS fontStyle = (DWRITE_FONT_SIMULATIONS)(simulation_style & 3);
HRESULT hr = S_OK;
hr = pDwFactory->CreateCustomFontFileReference(
(void const*)pData,
(UINT32)size,
CDwFontFileLoader::GetLoader(),
&pDwFontFile
);
if (FAILED(hr)) {
goto failed;
}
hr = pDwFontFile->Analyze(
&isSupportedFontType,
&fontFileType,
&fontFaceType,
&numberOfFaces
);
if (FAILED(hr) || !isSupportedFontType || fontFaceType == DWRITE_FONT_FACE_TYPE_UNKNOWN) {
goto failed;
}
hr = pDwFactory->CreateFontFace(
fontFaceType,
1,
&pDwFontFile,
0,
fontStyle,
&pDwFontFace
);
if (FAILED(hr)) {
goto failed;
}
SafeRelease(&pDwFontFile);
return pDwFontFace;
failed:
SafeRelease(&pDwFontFile);
return NULL;
}
示例3: ScaledFontBase
ScaledFontDWrite::ScaledFontDWrite(uint8_t *aData, uint32_t aSize,
uint32_t aIndex, Float aGlyphSize)
: ScaledFontBase(aGlyphSize)
{
IDWriteFactory *factory = DrawTargetD2D::GetDWriteFactory();
ffReferenceKey key;
key.mData = aData;
key.mSize = aSize;
RefPtr<IDWriteFontFile> fontFile;
if (FAILED(factory->CreateCustomFontFileReference(&key, sizeof(ffReferenceKey), DWriteFontFileLoader::Instance(), byRef(fontFile)))) {
gfxWarning() << "Failed to load font file from data!";
return;
}
IDWriteFontFile *ff = fontFile;
if (FAILED(factory->CreateFontFace(DWRITE_FONT_FACE_TYPE_TRUETYPE, 1, &ff, aIndex, DWRITE_FONT_SIMULATIONS_NONE, byRef(mFontFace)))) {
gfxWarning() << "Failed to create font face from font file data!";
}
}