Jump to content
How to Install Plugins ×

WhichSymbolPlus (updated 12 Dec 2010)


Ego Eram Reputo

Recommended Posts

Updated 12 December 2010 - 'Recent History' buttons! B)

Update 24 October 2010 - New UI

WhichSymbolPlus allows a symbol or character to be chosen and applied to the canvas from any installed font.

Thanks to these guys for their help:

  • Pyrochild for his help with the XML loading & saving.
  • Simon Brown who revised and recoded the original codelab plug-in, and was most generous with his time and source.
  • BoltBait for the TextRenderingHint!

You will find this plugin located in the RENDER submenu.

(New) When you commit a character to the canvas (by clicking OK), the character is saved to the upper most 'History" button (the contents of the other buttons cascade downward). You can easily reproduce the character by running the plugin again and selecting the appropriate 'History' button. Note that the anti-aliasing setting is not saved, nor the color used (the plugin always uses the current primary color).

This is the fourth incarnation of this plugin. Here's how the new UI looks....,

Which_Symbol_Redux2.png

The UI explained:

  • Select or change a font by clicking on the font name.
  • Choose your symbol by clicking directly on it (it will appear in the preview area and also on the canvas). Click OK to commit the symbol to the canvas.
  • Anti aliasing checkbox chooses between smooth & pixelated.
  • Symbol size is changed with the up/down arrows or by typing a number into the size box. Measurements are in pixels (maximum is 1000).
  • (New) Quickly recall any one of your 10 most recently chosen characters by clicking on one of the 'History' buttons.

To install the plugin, download my Plugin Pack and unzip it. Run the *.exe installer (written by BoltBait). Restart paint.net.

 

Edited by toe_head2001
Fixed broken Postimg images
  • Upvote 5
Link to comment
Share on other sites

Thanks.

I was thinking of making this a while back.. but I know no C++.

:lol:

Anyway.. thanks. :D

I wrote this with codelab, which uses c# I believe. To be honest I find c# remarkably easy to understand and would recommend you grab codelab and go through some of the source files. You might find yourself coding plugins before you know it. :wink:

I am always happy to release the source (if requested), though I have to admit a certain brute-force style of getting things to happen rather than any coding finesse :)

Link to comment
Share on other sites

If this is CodeLab created than I want src.

Mike, your wish is my command (well, a list of commands anyway....,)

This is purely an exercise in getting-it-done, and should not be read as an example of best coding practice :!:

Feel free to ask if there is anything you want explained.

/*==============================================================================
WhichSymbol.cs 
(c) 2008 Ego Eram Reputo 

Description: Draws a selectable symbol from the Webdings/Webdings fonts. 

==============================================================================*/ 
#region UICode
int Amount1=42; // [32,255] Character
int Amount2=150; // [8,255] FontSize
int Amount3 = 1; // [1,4] Webdings Wingdings Wingdings2 Wingdings3
bool Amount4 = true; // [0,1] Show Entire Font
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{

// Init variables and settings

string symbol;

Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); 

Graphics g = new RenderArgs(dst).Graphics;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.Clip = new Region(rect);
ColorBgra PC = (ColorBgra)EnvironmentParameters.PrimaryColor;
SolidBrush B1 = new SolidBrush(Color.FromArgb(PC.A, PC.R, PC.G, PC.);
Font F1 = new Font("Webdings", Amount2);
Font F2 = new Font("Wingdings", Amount2);
Font F3 = new Font("Wingdings 2", Amount2);
Font F4 = new Font("Wingdings 3", Amount2);

Font F7 = new Font("Arial", 10); 

Font F11 = new Font("Webdings", 16);
Font F12 = new Font("Wingdings", 16);
Font F13 = new Font("Wingdings 2", 16);
Font F14 = new Font("Wingdings 3", 16); 

// Clear the canvas by copying existing image (source) to destination
for(int y = rect.Top; y < rect.Bottom; y++)
for (int x = rect.Left; x < rect.Right; x++) 
dst[x,y] = src[x,y]; 

// draw a single symbol if we are not drawing the whole lot

if (Amount4==false)
{

switch (Amount3)
{
case 1: 
symbol = Convert.ToString((char)Amount1);
g.DrawString(symbol, F1, B1, selection.Left, selection.Top); 
break;

case 2: 
symbol = Convert.ToString((char)Amount1);
g.DrawString(symbol, F2, B1, selection.Left, selection.Top); 
break;

case 3: 
symbol = Convert.ToString((char)Amount1);
g.DrawString(symbol, F3, B1, selection.Left, selection.Top); 
break;

case 4: 
symbol = Convert.ToString((char)Amount1);
g.DrawString(symbol, F4, B1, selection.Left, selection.Top); 
break;
}

}

// Or if we are drawing them all...,

if (Amount4==true)
{

// Start with a clear the canvas 
for(int y = rect.Top; y < rect.Bottom; y++)
for (int x = rect.Left; x < rect.Right; x++) 
dst[x,y] = src[x,y]; 

// loop to write top character codes

for (int File=1; File<=15; File++)
{
symbol = "+" + Convert.ToString(File);
g.DrawString(symbol, F7, B1, selection.Left+(File*32), selection.Top+1*16);
}

// loop to draw all characters
for (int Rank=0; Rank<=14; Rank++)
{
for (int File=0; File<15; File++)
{
// Draw characters
switch (Amount3)
{
case 1: 
symbol = Convert.ToString((char)(32+(Rank*15)+File));
g.DrawString(symbol, F11, B1, selection.Left+((File+1)*32), selection.Top+((Rank+1)*2*16));
break;

case 2: 
symbol = Convert.ToString((char)(32+(Rank*15)+File));
g.DrawString(symbol, F12, B1, selection.Left+((File+1)*32), selection.Top+((Rank+1)*2*16));
break;

case 3: 
symbol = Convert.ToString((char)(32+(Rank*15)+File));
g.DrawString(symbol, F13, B1, selection.Left+((File+1)*32), selection.Top+((Rank+1)*2*16));
break;

case 4: 
symbol = Convert.ToString((char)(32+(Rank*15)+File));
g.DrawString(symbol, F14, B1, selection.Left+((File+1)*32), selection.Top+((Rank+1)*2*16));
break;
}
}
// draw the number codes
symbol = Convert.ToString(31+(Rank*15));
g.DrawString(symbol, F7, B1, selection.Left, selection.Top+5+((Rank+1)*2*16));
}
}
}

Link to comment
Share on other sites

Found a bug of my own making!

The final column of symbols was not being drawn when the "Show All" mode was being used. See the top image in my first post, the top row ends with symbol 31+14=45, but the second row starts with symbol 46+1=47. Thus symbol 46 was missing (the missing link).

The *.zip file has been updated to correct this and the source listed above amended. I'm not going to change the images because I'm sure you all get the idea.

I only found this because I actually wanted to use a symbol I knew existed and couldn't find it - you can imagine my frustration as I searched for it!

Link to comment
Share on other sites

Do you mind if I post a bit of a mini tutorial in here explaining how to add new font types and compile in Code Lab? I know that is the first thing I did with your code for all of my Dafont downloaded dingbats.

signature.png

Link to comment
Share on other sites

Do you mind if I post a bit of a mini tutorial in here explaining how to add new font types and compile in Code Lab? I know that is the first thing I did with your code for all of my Dafont downloaded dingbats.

I don't mind at all, but I think a new topic might be in order? You're probably best slotting it into the Effects/API forum.

Link to comment
Share on other sites

Here is my modification of this plugin that supports custom fonts and a (hopefully) simpler dialog. This ZIP only contains the assembley, I will leave the decision to EER over whether to publish the source.

1zg55yu.png

WhichSymbolPlus.zip

KaHuc.png
Link to comment
Share on other sites

Here is my modification of this plugin that supports custom fonts and a (hopefully) simpler dialog. This ZIP only contains the assembley, I will leave the decision to EER over whether to publish the source.

I've already published the codelab source, so these modifications are entirely yours. Please feel free to make the source available as you wish.

Link to comment
Share on other sites

Here is my modification of this plugin that supports custom fonts and a (hopefully) simpler dialog. This ZIP only contains the assembley, I will leave the decision to EER over whether to publish the source.

I've already published the codelab source, so these modifications are entirely yours. Please feel free to make the source available as you wish.

I made few changes to the source, so surely claiming the modifications as mine would be parasitic?

KaHuc.png
Link to comment
Share on other sites

I've already published the codelab source, so these modifications are entirely yours. Please feel free to make the source available as you wish.
I made few changes to the source, so surely claiming the modifications as mine would be parasitic?

Lets call it a joint effort :D

Link to comment
Share on other sites

I've already published the codelab source, so these modifications are entirely yours. Please feel free to make the source available as you wish.
I made few changes to the source, so surely claiming the modifications as mine would be parasitic?

Lets call it a joint effort :D

That would be similar to calling Babya PhotoPro a joint effort between Rick Brewster and aafuss. This plugin is your project and your work, all I did is add a UI and a few classes.

KaHuc.png
Link to comment
Share on other sites

....all I did is add a UI and a few classes.

That's enough for me to call it a joint effort. Seriously.

I have updated the original post to link to your version, and retained the original ( for users would like to follow Mikes' tutorial :http://paintdotnet.forumer.com/viewtopic.php?f=5&t=25502 and fiddle with it in codelab).

Link to comment
Share on other sites

That's enough for me to call it a joint effort. Seriously.

If you believe so I will accept this. One thing, I reccomend attaching the modification to the first post rather than linking to the direct post, as this will allow users to easily select which one they wish to download.

KaHuc.png
Link to comment
Share on other sites

I reccomend attaching the modification to the first post rather than linking to the direct post, as this will allow users to easily select which one they wish to download.

A couple of minor problems with your new version of the plug-in:

1. Spelling error in "Character" :wink:

2. Column numbering uses the selected font, so if the font doesn't have digits, the column offsets are not numerals. See Webdings/wingdings selections. You might want to tickle the font used for the column offsets (top) to the same one as the row offsets (left).

If you want to make these minor changes, I'll then provide the link in my original post.

Link to comment
Share on other sites

"Which Symbol" module

Tried it -

Feedback

It only allows one to select (or type a number) for a character upto 125

Which reminds me of the old ASCII limit of 124

Related?

Anyhoo - as I wanted little arrows and side facing triangles to bung over the top of

screen shots of medical software - I can't use it; which a pity really. I liked the idea.

CjW

Edit by Rick: Sorry, no flashy animations in avatars or signatures.

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.

Guest
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...