IDWriteTextFormat::SetTextAlignment was used to alignment text in DirectWrite, it takes a parameter of DWRITE_TEXT_ALIGNMENT type
enum DWRITE_TEXT_ALIGNMENT {
DWRITE_TEXT_ALIGNMENT_LEADING,
DWRITE_TEXT_ALIGNMENT_TRAILING,
DWRITE_TEXT_ALIGNMENT_CENTER,
DWRITE_TEXT_ALIGNMENT_JUSTIFIED
};
the first 3 type all work well, but the last one DWRITE_TEXT_ALIGNMENT_JUSTIFIED does not work, when I try to set it, I got an invalid argument error
HRESULT hr = g_pTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_JUSTIFIED);
if(FAILED(hr))
{
MessageBox(NULL, L"Center text failed!", L"Error", 0);
return;
}
It seems this is not a valid argument, why? does anyone encountered the same issue?