// IDWriteTextRenderer methods virtual HRESULT STDMETHODCALLTYPE DrawGlyphRun( void* clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_MEASURING_MODE measuringMode, DWRITE_GLYPH_RUN const* glyphRun, DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription, IUnknown* clientDrawingEffect) override { SkTScopedComPtr<IDWriteFont> font; HRM(fOuter->fFontCollection->GetFontFromFontFace(glyphRun->fontFace, &font), "Could not get font from font face."); // It is possible that the font passed does not actually have the requested character, // due to no font being found and getting the fallback font. // Check that the font actually contains the requested character. BOOL exists; HRM(font->HasCharacter(fCharacter, &exists), "Could not find character."); if (exists) { SkTScopedComPtr<IDWriteFontFamily> fontFamily; HRM(font->GetFontFamily(&fontFamily), "Could not get family."); fResolvedTypeface = fOuter->createTypefaceFromDWriteFont(glyphRun->fontFace, font.get(), fontFamily.get()); } return S_OK; }