2

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;
}

enter image description here

It seems this is not a valid argument, why? does anyone encountered the same issue?

Community
  • 1
  • 1
zdd
  • 8,258
  • 8
  • 46
  • 75

1 Answers1

2

Got the answer from Microsoft DirectX forum, it is because, this flag does not support Win7, but the SDK document does not point it out. http://xboxforums.create.msdn.com/forums/p/108456/640004.aspx#640004

zdd
  • 8,258
  • 8
  • 46
  • 75