开发者

obtain x,y coords of individual Chars in a gdi widget

开发者 https://www.devze.com 2022-12-08 06:09 出处:网络
if i use text开发者_如何学Pythonout(\"this text\") with a particular font/style, i want to find out the (x,y) coords of \'t\' \'h\' \'i\' \'s\' chars.

if i use text开发者_如何学Pythonout("this text") with a particular font/style, i want to find out the (x,y) coords of 't' 'h' 'i' 's' chars. i cant use the printer route. how else can i obtain the individual x,y coords.


For non-complex scripts, you can use GetCharacterPlacement(). It's a GDI function that'll tell you the positions of each glyph in the string. This will work for western languages.

If you need to handle complex scripts (right-to-left languages, writing systems where the glyphs change shape depending on context), you'll need to use Uniscribe. It can get pretty complicated.

0

精彩评论

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