See the question and my original answer on StackOverflow

The freetype glyph bitmap is essentially an opacity mask, it's a 1 byte (0-255 level) per pixel, like an alpha channel bitmap.

Direct2D's ID2D1HwndRenderTarget only supports a limited set of formats, the most useful being DXGI_FORMAT_B8G8R8A8_UNORM + D2D1_ALPHA_MODE_PREMULTIPLIED, so a 4-bytes (BGRA) per pixel format.

Here is how you can convert the glyph format into a Direct2D ID2D1Bitmap (error checks ommited):

auto ftb = Face->glyph->bitmap;

// build a memory buffer (1 pixel => 4 bytes)
// from glyph bitmap (1 pixel => 1 byte)
auto bits = new unsigned char[ftb.width * 4 * ftb.rows];
for (unsigned int row = 0; row < ftb.rows; row++)
{
  auto ptr = (unsigned int*)bits + row * ftb.pitch;
  for (unsigned int i = 0; i < ftb.width; i++)
  {
    auto opacity = (unsigned int)ftb.buffer[row * ftb.pitch + i];
    *ptr = opacity << 24; // ARGB format with A = opacity from glyph
    ptr++;
  }
}

auto bmpSize = D2D1::SizeU(ftb.width, ftb.rows);
D2D1_BITMAP_PROPERTIES props{};
props.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM;
props.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;

ID2D1Bitmap* bmp;
m_pRenderTarget->CreateBitmap(bmpSize, (const void*)bits, ftb.width * 4, props, &bmp);
delete[] bits;
...
// do some work with bitmap ...
...
bmp->Release();