ライブラリを使用FW1FontWrapper
して、DirectX 11 C++ アプリケーションでフォントをラップしています。
でレンダリングされたテキストの行間隔 (テキストの 2 行間の距離) を変更したいFW1FontWrapper
。
私は DirectX で使用できることを知っていIDWriteTextFormat::SetLineSpacing(DWRITE_LINE_SPACING_METHOD_UNIFORM, 30.0f, 20.0f)
ます。
IDWriteTextFormat
残念ながら、正しい構造にアクセスする方法がわかりません。
私はしようとしました:
HRESULT hResult = FW1CreateFactory(FW1_VERSION, &FW1Factory);
hResult = FW1Factory->CreateFontWrapper(device, L"Arial", &fontWrapper);
//my attemp - first get the IDWriteFactory
IDWriteFactory *pDWriteFactory;
hResult = fontWrapper->GetDWriteFactory(&pDWriteFactory);
//and now the IDWriteTextFormat
IDWriteTextFormat *pTextFormat;
hResult = pDWriteFactory->CreateTextFormat(L"Arial", NULL,
DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH_NORMAL, 10.0f, L"", &pTextFormat);
pTextFormat->SetLineSpacing(DWRITE_LINE_SPACING_METHOD_UNIFORM, 100.f, 20.0f);
そのようにして、次の方法でレンダリングに影響を与えるものではなく、新しい を作成および変更するため、機能しないと思います。IDWriteTextFormat
fontWrapper->DrawString(
context,
s2ws(content).c_str(),// String
fontSize,// Font size
startTextPosition.getX(),// X position
startTextPosition.getY(),// Y position
color,// Text color, 0xAaBbGgRr
FW1_RESTORESTATE// Flags (for example FW1_RESTORESTATE to keep
//context states unchanged)
);
では、どのようにして権利にアクセスするのIDWriteTextFormat
でしょうか (新しいものではなく、変更するときにレンダリングに影響を与えるもの)。
私の知る限り、FW1FontWrapper
行間隔を設定する独自の方法はありません。