0

I am Drawing the set of characters in Graphics, by Calculating the points using GraphicsPath for each Character. I Need to know how to calculate the distance should be given between the two characters?

I am using this code to generate points

PointF [] pnts;

var p=new GraphicsPath();

path.AddString("A","Arial",(int)FontStyle.Regular,50,new pointF(0f,0f),StringFormat.GenericDefault);

Matrix m=new Matric(1,0,0,1,0,0);

path.Flatten(m,1,0f);

pnts=path.pathpoints;

i am getting the points for all characters using the above code.

Now i am combining the two character Using the points generated by the above code. Eg "AB"

Help me to calculate the the character space should be given between two characters? Thanks in Advance..

Andrey Korneyev
  • 26,353
  • 15
  • 70
  • 71
Shanthu
  • 19
  • 1
  • This is non-trivial. Why don't you convert an entire string in one go? – 500 - Internal Server Error Mar 03 '15 at 11:34
  • You could a) use the bounds of the GraphicsPath instead. Or if you want to do kerning you could b) draw them on two bitmap and move them towards each other until they overlap and then move back a little. [Here](http://stackoverflow.com/questions/28677440/per-pixel-collision-detection-algorithm-for-windowsforms/28679168#28679168) is code to check overlapping bitmaps.. Ot you could indeed draw them all in one go. Can you expand on your aim a little – TaW Mar 03 '15 at 12:31
  • Thanks for the reply. i cant use bitmap comparison because its time taken process.My requirement is Initially i had generated Points for all the characters. And i am using the points later to form a string. i need to know, how to place the characters.. – Shanthu Mar 04 '15 at 11:56

0 Answers0