Measuring exact size of a string

E

EgregioSignore

Hi all, hope not to be OT here.

I want to write a function that gets the following parameters:

a string "s"
a font "f"

and returns the EXACT width and height of the font.

I tried first with MeasureString but it adds me extra space;
then I tried with MeasureCharacterRanges but I didn't manage
to get rid of an extra space.

I need to have a pair of values that could enable me to draw,
let's say, a bounding box that TOUCHES the string on every border,
no matter how the glyphs are shaped (f.ex. a string with only
a period, ".", should return a very small b.box instead of taking
account of the extra space OVER the dot).

Thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top