Jump to content

change space letter


Recommended Posts


Thanks to this excellent forum and assistance

I could create plugin for drawing text on the canvas; and now I want that when I use certain Font; I can reduce the spacing (Kerning Font) between each letter.


Thank you for the help provided and the time spent.

Link to comment
Share on other sites

Hello thank you for your answers

Too bad the topic and was moved because I would really like to know the code to achieve this.

I repecte Decision

Too bad the plugin link does not work for downloaded.

Thank you for the help and time spent

Link to comment
Share on other sites

@BoltBait has written a fantastic series of CodeLab tutorials which you can find on his website BoltBait.com. You might find this one of interest http://boltbait.com/pdn/CodeLab/help/tutorial4.php. It covers rendering text which should get you started.

As you will see, GDI+ is used to render the text. I'm not sure if you can configure kerning via GDI+, but thats where I would start looking.

Link to comment
Share on other sites

Are you trying to write your own plugin? It wasn't clear that you were asking about actual plugin development. If so then I can simply move this back to the Plugin Developer Center.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html


Link to comment
Share on other sites

Yes I create a text effect plugins; and I wanted in my plugin manage the spacing of the letters; here is the code already implemented:
code for transform text and drawtext
    // Write and transformation text
    g.ScaleTransform(Amount7, Amount8, System.Drawing.Drawing2D.MatrixOrder.Append);
    g.TranslateTransform(cx, cy,System.Drawing.Drawing2D.MatrixOrder.Append);
    StringFormat string_format = new StringFormat();
    string_format.Alignment = StringAlignment.Center;
    string_format.LineAlignment = StringAlignment.Center;
    g.DrawString(Amount1, SelectedFont, Brush1, 0, 0, string_format);

Thank you for their time and assistance provided

Link to comment
Share on other sites

You can't do this out of the box in .NET.

Maybe google for "gdi+ character spacing".

You may use SetTextCharacterExtra or ExtTextOut.

[DllImport("gdi32.dll", CharSet=CharSet.Auto)] 
public static extern int SetTextCharacterExtra( 
    IntPtr hdc,    // DC handle
    int nCharExtra // extra-space value 

//set spacing between characters 
IntPtr hdc = g.GetHdc(); 
SetTextCharacterExtra(hdc, 10); 

midoras signature.gif

Link to comment
Share on other sites

The markup plugin/technique I demonstrate here http://forums.getpaint.net/index.php?/topic/106683-block-of-text-with-different-sizes/#entry509712 may be of interest. CSS allows some basic kerning (called letter-spacing in the code).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...