예제 #1
0
CDwGdiTextRenderer::CDwGdiTextRenderer(
    CFX_DIBitmap* pBitmap,
    IDWriteBitmapRenderTarget* bitmapRenderTarget,
    IDWriteRenderingParams* renderingParams)
    : pBitmap_(pBitmap),
      pRenderTarget_(SafeAcquire(bitmapRenderTarget)),
      pRenderingParams_(SafeAcquire(renderingParams)) {}
ResourceFontFileEnumerator::ResourceFontFileEnumerator(
    IDWriteFactory* factory
    ) : 
    refCount_(0), 
    factory_(SafeAcquire(factory)),
    currentFile_(),
    nextIndex_(0)
{
}
예제 #3
0
HRESULT STDMETHODCALLTYPE CDwFontFileLoader::CreateStreamFromKey(
    void const* fontFileReferenceKey,
    UINT32 fontFileReferenceKeySize,
    OUT IDWriteFontFileStream** fontFileStream) {
  *fontFileStream = nullptr;
  CDwFontFileStream* stream =
      new CDwFontFileStream(fontFileReferenceKey, fontFileReferenceKeySize);
  if (!stream->IsInitialized()) {
    delete stream;
    return E_FAIL;
  }
  *fontFileStream = SafeAcquire(stream);
  return S_OK;
}
DWriteRenderer::DWriteRenderer(
    HWND hwnd,
    UINT width,
    UINT height,
    IDWriteTextFormat* textFormat,
    wchar_t const* text
) :
    hwnd_(hwnd),
    width_(width),
    height_(height),
    measuringMode_(DWRITE_MEASURING_MODE_NATURAL),
    transform_(g_identityTransform),
    text_(text),
    borderPen_(NULL),
    textFormat_(SafeAcquire(textFormat)),
    textLayout_(),
    renderTarget_(),
    magnifierTarget_(),
    renderingParams_()
{
    magnifier_.visible = false;
}
예제 #5
0
CDwFontContext::CDwFontContext(IDWriteFactory* dwriteFactory) :
    hr_(S_FALSE),
    dwriteFactory_(SafeAcquire(dwriteFactory))
{
}
HRESULT STDMETHODCALLTYPE ResourceFontFileEnumerator::GetCurrentFontFile(OUT IDWriteFontFile** fontFile)
{
    *fontFile = SafeAcquire(currentFile_);

    return (currentFile_ != NULL) ? S_OK : E_FAIL;
}