views:

234

answers:

6

I'm rendering text in Direct2D/DirectWrite, but calling SetLineSpacing() on either TextFormat or TextLayout seems to have no effect. Does anyone know why?

A: 

Can you post a code snippet?

sdtom
Why the down vote? Asking to see code is a perfectly reasonable thing to do.
sdtom
Yep, but I'm guessing you got downvoted b/c code is usually requested as a comment to the question. In any case, here's an upvote.
Goose Bumper
Ahh. Makes sense. At the time I didn't have enough reputation to comment. Thanks for the feedback and the upvote.
sdtom
A: 

Am i missing something?

Neither IDWriteTextFormat nor IDWriteTextLayout has a SetLineHeight function ...

Goz
I meant `SetLineSpacing()`, sorry.
Dmitri Nesteruk
A: 

Have you checked the HRESULT error code returned by SetLineSpacing()?

Hint: If you're using Visual Studio just type eax,hr in one of the debug Watch windows to see any possible error code right after the call.

Jonas Gulle
Yes, and it's S_OK
Dmitri Nesteruk
+8  A: 

I'm 99% sure that this is a bug. I have done a little playing around with Direct2D lately and also had a problem with SetLineSpacing() on TextLayout, think it is the same as what you are describing, in that case I can confirm that it's not just you. Reopen your bug report on MS Connect, it has been closed.

Dale Halliwell
A: 

Source

minimum supported client: Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista.

Do you run any of the above stated versions of windows? I believe the reason why you aren't seeing any changes is because any version below the ones states above doesn't support the SetLineSpacing() in DirectWrite.

Pieter888
The fact that I'm running it would imply that I am, in fact, using a supported operating system, in this case 2008R2.
Dmitri Nesteruk
A: 

I even have the same problem as Dmitri Nesteruk said.

However, I find out that if you set the lineSpacing "after CreateTextLayout", SetLineSpacing cannot work.

Otherwise, if you set LineSpacing before CreateTextLayout, it can work now.

Maybe you can try this soluton.

PS: My env. is in Window Vista SP2.

Many thanks.

hellosan