virtual HRESULT STDMETHODCALLTYPE CreateTextFormat( WCHAR const* fontFamilyName, IDWriteFontCollection* fontCollection, DWRITE_FONT_WEIGHT fontWeight, DWRITE_FONT_STYLE fontStyle, DWRITE_FONT_STRETCH fontStretch, FLOAT fontSize, WCHAR const* localeName, IDWriteTextFormat** textFormat ) { UINT32 index; BOOL exists; HRESULT result; OutputDebugString("delegate_dwritefactory::CreateTextFormat"); OutputDebugStringW(fontFamilyName); EnterCriticalSection(&collcs); result = this->mycoll->FindFamilyName(fontFamilyName, &index, &exists); if (SUCCEEDED(result)) { result = E_FAIL; if (exists != FALSE) { OutputDebugString("delegate_dwritefactory::CreateTextFormat -> mycoll"); result = orig_this->CreateTextFormat(fontFamilyName, this->mycoll, fontWeight, fontStyle, fontStretch, fontSize, localeName, textFormat); } } LeaveCriticalSection(&collcs); if (FAILED(result)) { OutputDebugString("delegate_dwritefactory::CreateTextFormat -> fallback"); result = orig_this->CreateTextFormat(fontFamilyName, fontCollection, fontWeight, fontStyle, fontStretch, fontSize, localeName, textFormat); } return result; }
D3D11CanvasWindowGraphicsPtr D3D11CanvasWindowGraphics::Create( HWND hWnd, D3D11DriverPtr driver, CameraPtr camera) { D3D11CanvasWindowGraphicsPtr p(new D3D11CanvasWindowGraphics); p->m_hWnd = hWnd; p->m_driver = driver; p->m_camera = camera; ID3D11Device* pDevice = p->m_driver->GetD3D11Device(); IDXGIFactory1* pDXGIFactory = p->m_driver->GetDXGIFactory(); IDWriteFactory* pDWriteFactory = p->m_driver->GetDWriteFactory(); // Create text format CHECK_HR(pDWriteFactory->CreateTextFormat( L"Calibri", NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 24.0f, L"en-US", p->m_textFormat.Receive())); // Create swap chain DXGI_SWAP_CHAIN_DESC scd = { 0 }; scd.BufferDesc.Format = BACKBUFFER_FORMAT; scd.SampleDesc.Count = 1; scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; scd.BufferCount = 1; scd.OutputWindow = hWnd; scd.Windowed = TRUE; CHECK_HR(pDXGIFactory->CreateSwapChain(pDevice, &scd, p->m_swapChain.Receive())); p->CreateSwapChainResources(); return p; }
void DWriteContext::SetRenderingParams( const DWriteRenderingParams *params) { if (mDWriteFactory == NULL) return; IDWriteRenderingParams *renderingParams = NULL; D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT; HRESULT hr; if (params != NULL) { hr = mDWriteFactory->CreateCustomRenderingParams(params->gamma, params->enhancedContrast, params->clearTypeLevel, ToPixelGeometry(params->pixelGeometry), ToRenderingMode(params->renderingMode), &renderingParams); textAntialiasMode = ToTextAntialiasMode(params->textAntialiasMode); } else hr = mDWriteFactory->CreateRenderingParams(&renderingParams); if (SUCCEEDED(hr) && renderingParams != NULL) { SafeRelease(&mRenderingParams); mRenderingParams = renderingParams; mTextAntialiasMode = textAntialiasMode; } }
void DWriteFontTypeface::onFilterRec(SkScalerContext::Rec* rec) const { if (rec->fFlags & SkScalerContext::kLCD_Vertical_Flag) { rec->fMaskFormat = SkMask::kA8_Format; } unsigned flagsWeDontSupport = SkScalerContext::kVertical_Flag | SkScalerContext::kDevKernText_Flag | SkScalerContext::kForceAutohinting_Flag | SkScalerContext::kEmbolden_Flag | SkScalerContext::kLCD_Vertical_Flag; rec->fFlags &= ~flagsWeDontSupport; SkPaint::Hinting h = rec->getHinting(); // DirectWrite does not provide for hinting hints. h = SkPaint::kSlight_Hinting; rec->setHinting(h); #if defined(SK_FONT_HOST_USE_SYSTEM_SETTINGS) IDWriteFactory* factory = sk_get_dwrite_factory(); if (factory != nullptr) { SkTScopedComPtr<IDWriteRenderingParams> defaultRenderingParams; if (SUCCEEDED(factory->CreateRenderingParams(&defaultRenderingParams))) { float gamma = defaultRenderingParams->GetGamma(); rec->setDeviceGamma(gamma); rec->setPaintGamma(gamma); rec->setContrast(defaultRenderingParams->GetEnhancedContrast()); } } #endif }
int CDirectWriteRenderer::GetFitCharCount(LPCWSTR pText, int Length, int Width, CDirectWriteFont &Font) { if (pText == nullptr || Length == 0) return 0; if (m_pRenderTarget == nullptr) return 0; int FitCharCount = 0; IDWriteFactory *pFactory = m_System.GetDWriteFactory(); if (pFactory != nullptr) { IDWriteTextFormat *pTextFormat = Font.GetTextFormat(); if (pTextFormat != nullptr) { IDWriteTextLayout *pTextLayout; pTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING); pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); if (Length < 0) Length = ::lstrlenW(pText); HRESULT hr = pFactory->CreateTextLayout( pText, Length, pTextFormat, static_cast<float>(Width), m_pRenderTarget->GetSize().height, &pTextLayout); if (SUCCEEDED(hr)) { Util::CTempBuffer<DWRITE_CLUSTER_METRICS, 256> ClusterMetrics(Length); UINT32 ClusterCount; hr = pTextLayout->GetClusterMetrics(ClusterMetrics.GetBuffer(), Length, &ClusterCount); if (SUCCEEDED(hr)) { float Pos = 0.0f; for (UINT32 i = 0; i < ClusterCount; i++) { Pos += ClusterMetrics[i].width; if (static_cast<int>(std::ceil(Pos)) > Width) break; FitCharCount += ClusterMetrics[i].length; } } pTextLayout->Release(); } pTextFormat->Release(); } pFactory->Release(); } return FitCharCount; }
bool setupLayout (const AttributedString& text, const float maxWidth, const float maxHeight, ID2D1RenderTarget& renderTarget, IDWriteFactory& directWriteFactory, IDWriteFontCollection& fontCollection, ComSmartPtr<IDWriteTextLayout>& textLayout) { // To add color to text, we need to create a D2D render target // Since we are not actually rendering to a D2D context we create a temporary GDI render target Font defaultFont; BOOL fontFound = false; uint32 fontIndex; fontCollection.FindFamilyName (defaultFont.getTypeface()->getName().toWideCharPointer(), &fontIndex, &fontFound); if (! fontFound) fontIndex = 0; ComSmartPtr<IDWriteFontFamily> dwFontFamily; HRESULT hr = fontCollection.GetFontFamily (fontIndex, dwFontFamily.resetAndGetPointerAddress()); ComSmartPtr<IDWriteFont> dwFont; hr = dwFontFamily->GetFirstMatchingFont (DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STRETCH_NORMAL, DWRITE_FONT_STYLE_NORMAL, dwFont.resetAndGetPointerAddress()); jassert (dwFont != nullptr); const float defaultFontHeightToEmSizeFactor = getFontHeightToEmSizeFactor (*dwFont); ComSmartPtr<IDWriteTextFormat> dwTextFormat; hr = directWriteFactory.CreateTextFormat (defaultFont.getTypefaceName().toWideCharPointer(), &fontCollection, DWRITE_FONT_WEIGHT_REGULAR, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, defaultFont.getHeight() * defaultFontHeightToEmSizeFactor, L"en-us", dwTextFormat.resetAndGetPointerAddress()); setTextFormatProperties (text, *dwTextFormat); { DWRITE_TRIMMING trimming = { DWRITE_TRIMMING_GRANULARITY_CHARACTER, 0, 0 }; ComSmartPtr<IDWriteInlineObject> trimmingSign; hr = directWriteFactory.CreateEllipsisTrimmingSign (dwTextFormat, trimmingSign.resetAndGetPointerAddress()); hr = dwTextFormat->SetTrimming (&trimming, trimmingSign); } const int textLen = text.getText().length(); hr = directWriteFactory.CreateTextLayout (text.getText().toWideCharPointer(), textLen, dwTextFormat, maxWidth, maxHeight, textLayout.resetAndGetPointerAddress()); if (FAILED (hr) || textLayout == nullptr) return false; const int numAttributes = text.getNumAttributes(); for (int i = 0; i < numAttributes; ++i) addAttributedRange (*text.getAttribute (i), *textLayout, textLen, renderTarget, fontCollection); return true; }
delegate_dwritefactory(IDWriteFactory *inst) : refnum(0), orig_this(inst), mycoll(nullptr) { OutputDebugString("delegate_dwritefactory::delegate_dwritefactory"); InitializeCriticalSection(&collcs); fontfile_collection_loader &loader = fontfile_collection_loader::get_instance(); if (SUCCEEDED(orig_this->RegisterFontCollectionLoader(&loader))) { EnterCriticalSection(&fontpathscs); orig_this->CreateCustomFontCollection(&loader, nullptr, 0, &mycoll); LeaveCriticalSection(&fontpathscs); } factories.insert(this); }
bool CDirectWriteRenderer::GetTextMetrics( LPCWSTR pText, int Length, CDirectWriteFont &Font, TextMetrics *pMetrics) { if (pText == nullptr || pMetrics == nullptr) return false; if (m_pRenderTarget == nullptr) return false; HRESULT hr = E_UNEXPECTED; IDWriteFactory *pFactory = m_System.GetDWriteFactory(); if (pFactory != nullptr) { IDWriteTextFormat *pTextFormat = Font.GetTextFormat(); if (pTextFormat != nullptr) { D2D1_SIZE_F Size; IDWriteTextLayout *pTextLayout; pTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING); pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); if (Length < 0) Length = ::lstrlenW(pText); Size = m_pRenderTarget->GetSize(); hr = pFactory->CreateTextLayout( pText, Length, pTextFormat, Size.width, Size.height, &pTextLayout); if (SUCCEEDED(hr)) { DWRITE_TEXT_METRICS Metrics; hr = pTextLayout->GetMetrics(&Metrics); if (SUCCEEDED(hr)) { pMetrics->Width = Metrics.width; pMetrics->WidthIncludingTrailingWhitespace = Metrics.widthIncludingTrailingWhitespace; pMetrics->Height = Metrics.height; } pTextLayout->Release(); } pTextFormat->Release(); } pFactory->Release(); } return SUCCEEDED(hr); }
FX_BOOL CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap, void** renderTarget) { if (pBitmap->GetFormat() > FXDIB_Argb) { return FALSE; } IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory; IDWriteGdiInterop* pGdiInterop = NULL; IDWriteBitmapRenderTarget* pBitmapRenderTarget = NULL; IDWriteRenderingParams* pRenderingParams = NULL; HRESULT hr = S_OK; hr = pDwFactory->GetGdiInterop(&pGdiInterop); if (FAILED(hr)) { goto failed; } hr = pGdiInterop->CreateBitmapRenderTarget(NULL, pBitmap->GetWidth(), pBitmap->GetHeight(), &pBitmapRenderTarget); if (FAILED(hr)) { goto failed; } hr = pDwFactory->CreateCustomRenderingParams( 1.0f, 0.0f, 1.0f, DWRITE_PIXEL_GEOMETRY_RGB, DWRITE_RENDERING_MODE_DEFAULT, &pRenderingParams ); if (FAILED(hr)) { goto failed; } hr = pBitmapRenderTarget->SetPixelsPerDip(1.0f); if (FAILED(hr)) { goto failed; } *(CDwGdiTextRenderer**)renderTarget = FX_NEW CDwGdiTextRenderer(pBitmap, pBitmapRenderTarget, pRenderingParams); if (*(CDwGdiTextRenderer**)renderTarget == NULL) { goto failed; } SafeRelease(&pGdiInterop); SafeRelease(&pBitmapRenderTarget); SafeRelease(&pRenderingParams); return TRUE; failed: SafeRelease(&pGdiInterop); SafeRelease(&pBitmapRenderTarget); SafeRelease(&pRenderingParams); return FALSE; }
HRESULT CDwFontContext::Initialize() { if (hr_ == S_FALSE) { return hr_ = dwriteFactory_->RegisterFontFileLoader(CDwFontFileLoader::GetLoader()); } return hr_; }
virtual HRESULT STDMETHODCALLTYPE CreateEllipsisTrimmingSign( IDWriteTextFormat* textFormat, IDWriteInlineObject** trimmingSign ) { return orig_this->CreateEllipsisTrimmingSign(textFormat, trimmingSign); }
virtual HRESULT STDMETHODCALLTYPE GetSystemFontCollection( IDWriteFontCollection** fontCollection, BOOL checkForUpdates = FALSE ) { return orig_this->GetSystemFontCollection(fontCollection, checkForUpdates); }
virtual HRESULT STDMETHODCALLTYPE CreateMonitorRenderingParams( HMONITOR monitor, IDWriteRenderingParams** renderingParams ) { return orig_this->CreateMonitorRenderingParams(monitor, renderingParams); }
bool CDirectWriteRenderer::UpdateRenderingParams() { if (m_pRenderTarget == nullptr) return false; bool fUpdated = false; IDWriteFactory *pFactory = m_System.GetDWriteFactory(); if (pFactory != nullptr) { IDWriteRenderingParams *pRenderingParams; HRESULT hr = pFactory->CreateMonitorRenderingParams(m_hMonitor, &pRenderingParams); if (SUCCEEDED(hr)) { if (m_RenderingParams.Mask != 0) { IDWriteRenderingParams *pCustomRenderingParams; hr = pFactory->CreateCustomRenderingParams( (m_RenderingParams.Mask & RenderingParams::PARAM_GAMMA) != 0 ? m_RenderingParams.Gamma : pRenderingParams->GetGamma(), (m_RenderingParams.Mask & RenderingParams::PARAM_ENHANCED_CONTRAST) != 0 ? m_RenderingParams.EnhancedContrast : pRenderingParams->GetEnhancedContrast(), (m_RenderingParams.Mask & RenderingParams::PARAM_CLEARTYPE_LEVEL) != 0 ? m_RenderingParams.ClearTypeLevel : pRenderingParams->GetClearTypeLevel(), (m_RenderingParams.Mask & RenderingParams::PARAM_PIXEL_GEOMETRY) != 0 ? m_RenderingParams.PixelGeometry : pRenderingParams->GetPixelGeometry(), (m_RenderingParams.Mask & RenderingParams::PARAM_RENDERING_MODE) != 0 ? m_RenderingParams.RenderingMode : pRenderingParams->GetRenderingMode(), &pCustomRenderingParams); if (SUCCEEDED(hr)) { m_pRenderTarget->SetTextRenderingParams(pCustomRenderingParams); pCustomRenderingParams->Release(); } } else { m_pRenderTarget->SetTextRenderingParams(pRenderingParams); } if (SUCCEEDED(hr)) fUpdated = true; pRenderingParams->Release(); } pFactory->Release(); } return fUpdated; }
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; }
virtual HRESULT STDMETHODCALLTYPE CreateFontFileReference( WCHAR const* filePath, FILETIME const* lastWriteTime, IDWriteFontFile** fontFile ) { return orig_this->CreateFontFileReference(filePath, lastWriteTime, fontFile); }
virtual HRESULT STDMETHODCALLTYPE CreateCustomFontCollection( IDWriteFontCollectionLoader* collectionLoader, void const* collectionKey, UINT32 collectionKeySize, IDWriteFontCollection** fontCollection ) { return orig_this->CreateCustomFontCollection(collectionLoader, collectionKey, collectionKeySize, fontCollection); }
virtual HRESULT STDMETHODCALLTYPE CreateCustomFontFileReference( void const* fontFileReferenceKey, UINT32 fontFileReferenceKeySize, IDWriteFontFileLoader* fontFileLoader, IDWriteFontFile** fontFile ) { return orig_this->CreateCustomFontFileReference(fontFileReferenceKey, fontFileReferenceKeySize, fontFileLoader, fontFile); }
virtual HRESULT STDMETHODCALLTYPE CreateNumberSubstitution( DWRITE_NUMBER_SUBSTITUTION_METHOD substitutionMethod, WCHAR const* localeName, BOOL ignoreUserOverride, IDWriteNumberSubstitution** numberSubstitution ) { return orig_this->CreateNumberSubstitution(substitutionMethod, localeName, ignoreUserOverride, numberSubstitution); }
void DWriteContext::DrawText(HDC hdc, const WCHAR* text, int len, int x, int y, int w, int h, int cellWidth, COLORREF color) { HRESULT hr = S_OK; IDWriteBitmapRenderTarget *bmpRT = NULL; // Skip when any fonts are not set. if (mTextFormat == NULL) return; // Check possibility of zero divided error. if (cellWidth == 0 || mDpiScaleX == 0.0f || mDpiScaleY == 0.0f) return; if (SUCCEEDED(hr)) hr = mGdiInterop->CreateBitmapRenderTarget(hdc, w, h, &bmpRT); if (SUCCEEDED(hr)) { IDWriteTextLayout *textLayout = NULL; HDC memdc = bmpRT->GetMemoryDC(); BitBlt(memdc, 0, 0, w, h, hdc, x, y, SRCCOPY); hr = mDWriteFactory->CreateGdiCompatibleTextLayout( text, len, mTextFormat, PixelsToDipsX(w), PixelsToDipsY(h), mDpiScaleX, NULL, TRUE, &textLayout); if (SUCCEEDED(hr)) { DWRITE_TEXT_RANGE textRange = { 0, (UINT32)len }; textLayout->SetFontWeight(mFontWeight, textRange); textLayout->SetFontStyle(mFontStyle, textRange); } if (SUCCEEDED(hr)) { GdiTextRenderer *renderer = new GdiTextRenderer(bmpRT, mRenderingParams); GdiTextRendererContext data = { color, PixelsToDipsX(cellWidth), 0.0f }; textLayout->Draw(&data, renderer, 0, 0); SafeRelease(&renderer); } BitBlt(hdc, x, y, w, h, memdc, 0, 0, SRCCOPY); SafeRelease(&textLayout); } SafeRelease(&bmpRT); }
bool CDirectWriteFont::Create(CDirectWriteRenderer &Renderer, const LOGFONT &lf) { Destroy(); IDWriteFactory *pFactory = Renderer.GetSystem().GetDWriteFactory(); if (pFactory == nullptr) return false; float FontSize; if (lf.lfHeight < 0 || Renderer.GetDC() == nullptr) { FontSize = static_cast<float>(std::abs(lf.lfHeight)); } else { HDC hdc = Renderer.GetDC(); HFONT hfont = ::CreateFontIndirect(&lf); HGDIOBJ hOldFont = ::SelectObject(hdc, hfont); TEXTMETRIC tm; ::GetTextMetrics(hdc, &tm); FontSize = static_cast<float>(tm.tmHeight - tm.tmInternalLeading); ::SelectObject(hdc, hOldFont); ::DeleteObject(hfont); } IDWriteTextFormat *pTextFormat; HRESULT hr = pFactory->CreateTextFormat( lf.lfFaceName, nullptr, static_cast<DWRITE_FONT_WEIGHT>(lf.lfWeight), lf.lfItalic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, FontSize, L"", &pTextFormat); if (SUCCEEDED(hr)) { m_pTextFormat = pTextFormat; m_LogFont = lf; } pFactory->Release(); return true; }
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); }
virtual HRESULT STDMETHODCALLTYPE CreateCustomRenderingParams( FLOAT gamma, FLOAT enhancedContrast, FLOAT clearTypeLevel, DWRITE_PIXEL_GEOMETRY pixelGeometry, DWRITE_RENDERING_MODE renderingMode, IDWriteRenderingParams** renderingParams ) { return orig_this->CreateCustomRenderingParams(gamma, enhancedContrast, clearTypeLevel, pixelGeometry, renderingMode, renderingParams); }
virtual HRESULT STDMETHODCALLTYPE CreateTextLayout( WCHAR const* string, UINT32 stringLength, IDWriteTextFormat* textFormat, FLOAT maxWidth, FLOAT maxHeight, IDWriteTextLayout** textLayout ) { return orig_this->CreateTextLayout(string, stringLength, textFormat, maxWidth, maxHeight, textLayout); }
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!"; } }
void update_font_collection() { fontfile_collection_loader &loader = fontfile_collection_loader::get_instance(); EnterCriticalSection(&collcs); EnterCriticalSection(&fontpathscs); IDWriteFontCollection* coll; if (SUCCEEDED(orig_this->CreateCustomFontCollection(&loader, nullptr, 0, &coll))) { InterlockedExchangePointer((void**)&mycoll, coll); iunknown_release(coll); } LeaveCriticalSection(&fontpathscs); LeaveCriticalSection(&collcs); }
virtual HRESULT STDMETHODCALLTYPE CreateGlyphRunAnalysis( DWRITE_GLYPH_RUN const* glyphRun, FLOAT pixelsPerDip, DWRITE_MATRIX const* transform, DWRITE_RENDERING_MODE renderingMode, DWRITE_MEASURING_MODE measuringMode, FLOAT baselineOriginX, FLOAT baselineOriginY, IDWriteGlyphRunAnalysis** glyphRunAnalysis ) { return orig_this->CreateGlyphRunAnalysis(glyphRun, pixelsPerDip, transform, renderingMode, measuringMode, baselineOriginX, baselineOriginY, glyphRunAnalysis); }
virtual HRESULT STDMETHODCALLTYPE GetGdiInterop( IDWriteGdiInterop** gdiInterop ) { HRESULT result; result = orig_this->GetGdiInterop(gdiInterop); if (SUCCEEDED(result)) { IDWriteGdiInterop *delegate = new(std::nothrow) delegate_dwrite_gdi_interop(*gdiInterop, mycoll); if (delegate != nullptr) { *gdiInterop = iunknown_addref(delegate); } } return result; }
virtual HRESULT STDMETHODCALLTYPE CreateGdiCompatibleTextLayout( WCHAR const* string, UINT32 stringLength, IDWriteTextFormat* textFormat, FLOAT layoutWidth, FLOAT layoutHeight, FLOAT pixelsPerDip, DWRITE_MATRIX const* transform, BOOL useGdiNatural, IDWriteTextLayout** textLayout ) { return orig_this->CreateGdiCompatibleTextLayout(string, stringLength, textFormat, layoutWidth, layoutHeight, pixelsPerDip, transform, useGdiNatural, textLayout); }
virtual HRESULT STDMETHODCALLTYPE MoveNext(BOOL* hasCurrentFile) { OutputDebugString("fontfile_enumerator::MoveNext"); if(hasCurrentFile == nullptr) { return E_INVALIDARG; } iunknown_release(curfile); *hasCurrentFile = FALSE; if (curiter != fontpaths.end()) { HRESULT result = factory_->CreateFontFileReference(a2w(*curiter).c_str(), nullptr, &curfile); if (SUCCEEDED(result)) { *hasCurrentFile = TRUE; } ++curiter; } return S_OK; }