Get kerning offset value for given character pair and font in .NET
Asked Answered
O

0

4

How can I get kerning adjustment of space between 2 given chars in .NET? In WPF application?

For example, lets say I have font Times New Roman of size 22 that is bold. What kerning will be used for characters A and v ? How can I get this value in my WPF application ?

If you wander why do I need it: I want to make H.B.'s answer to my question Create guitar chords editor in WPF to work with kerning.

Odyssey answered 27/4, 2011 at 19:30 Comment(3)
I just did some digging to see if any approach leapt out. Found the following that might help you: In WPF kerning only works with OpenType fonts. You can get kerning info using the GetKerningPairs method in the winapi, so you could pInvoke that from .net code.Ambi
@David Hall: Can you please provide some code sample with that call to winapi ? I have never used winapi before... Goggling it right now but not getting it yet. If you like to post it as an answer it might be very well be the accepted one (nobody seems to know better solution :( ) .Odyssey
I don't understand your problem completely, but I tried to look through what you had in your previous question, and I'd suggest looking into the WPF Glyphs class (msdn.microsoft.com/en-us/library/ms601126(v=VS.100).aspx). It may make your solution easier.Gripsack

© 2022 - 2024 — McMap. All rights reserved.