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.
精彩评论