开发者

Will GetPath() work for this?

开发者 https://www.devze.com 2023-01-06 05:43 出处:网络
I basically want to get the outline for a character. I was wondering how I could do this without drawing to the DC. Could I do something like this: (Psudocodeishly)

I basically want to get the outline for a character. I was wondering how I could do this without drawing to the DC. Could I do something like this: (Psudocodeishly)

BeginPath()

TextOut("H")

EndPath()

GetPath()

Will something like this work for GetPath? Will it return the glyph outline that I can then draw?

Otherwise, how else cou开发者_JAVA百科ld I do this (without freetype)

Thanks


If you want to get a glyph outline, why not just use GetGlyphOutline? There's the theoretical limitation that this is limited to TrueType fonts, but given the percentage of other fonts typically used on Windows, that's rarely a concern...

Edit: Yes, if you want to avoid using GetGlyphOutline, using a path instead will work (though only with TrueType fonts, not bitmapped fonts). The sample code included with the documentation for CDC::BeginPath shows how to do exactly what you seem to be after (though I'd strongly recommend using std::vector instead of new[] and delete[] as it does). One minor detail: that sample includes an implementation of PolyDraw. You'd only need (or want) this if you need to support ancient 16-bit versions of Windows -- all NT-based versions of Windows include it.

0

精彩评论

暂无评论...
验证码 换一张
取 消