Jump to content

Mike Ryan

Members
  • Posts

    4,239
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Mike Ryan

  1. Adding Font Types to WhichSymbol

    A Codelab Tutorial for Non Code Lab users

    First of all, before we get started I wanted to say that I am not going to use any coding jargon or make references to the coding language used, C#. However, you must have the plugin Code Lab succesfully installed. For more information about how to install plugins, please visit this thread.

    Alright, so with that aside let us go ahead and get started. First, let's take a look at the original code, graciously provided by Ego Eram Reputo, which can be found here. Because we are not going to even mess around with all of the code, I am not going to post all of it here. Just the nibbles we will be working with ;)

    First part we have to do is edit the 'controls'. These are just some numerical additions and nothing more, take a look:

    #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

    Look at line four of that code: it specifies which font we are going to work with. So, the part that contains '[1,4] specifies the range in fonts. So, the only work there is change the number 4 to the number of font types you wish to add. In my case, I am just adding one.

    Next, we need to specify the font. Which font are you adding? First, find the true name (the name that is in the list of fonts) of the font you wish to add. In my case, I am adding Carbon Black as I often use it for single letter designs. So, take a look next at this part of the code: Webdings Wingdings Wingdings2 Wingdings3. After the word Wingdings3, add the true name of your font. By personal preference, I have spiffed mine up a bit for general purpose of neatness. Take a look: int Amount3 = 5; // [1,5] 1) Webdings, 2) Wingdings, 3) Wingdings2, 4) Wingdings3, 5) Carbon Black

    With that taken care of, it is time to perform the direct code modifications. The first part is we have to add our font to the font lists. Find this part of the code:

          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);
    

    After the fourth line, create a new line and type:

    Font F5 = new Font("TRUE NAME", Amount2);

    Replace the words TRUE NAME with the true name of your added font type. Now, your code should look similar to mine:

          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 F5 = new Font("Carbon Black", Amount2);

    Now we have to reapply the previous steps. Excuse the copy and past ;) Find this part of the code:

          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);
    

    After the fourth line, create a new line and type:

          Font F15 = new Font("TRUE NAME", 16);

    Replace the words TRUE NAME with the true name of your added font type. Now, your code should look similar to mine:

          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);
         Font F15 = new Font("Carbon Black", 16);

    Now that we have added our font, it is time to make just two more revisions (Hurrah!). Find the following code:

            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;
    
               }

    If you looked hard enough, you should have found that there are two sections of code that look just like that, almost. So pay certain attention when finding the code. Alright, after the block that looks like this:

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

    We are going to add a very similar set of lines. Go ahead and create a new line beneath the above code, and type this:

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

    Easy, right? Although, let it be known that if you are adding multiple fonts you must type that in multiple times. Simply change the word case 5: to the next number in the series. Do the same for the word F5

    Now we just have to reapply. Again, I am going to copy and paste the above and modify it as fit. So I apologize ;)

    Find the following code:

            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;
    
               }

    If you looked hard enough, you should have found that there are two sections of code that look just like that, almost. So pay certain attention when finding the code. Alright, after the block that looks like this:

                    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;

    We are going to add a very similar set of lines. Go ahead and create a new line beneath the above code, and type this:

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

    Easy, right? Although, let it be known that if you are adding multiple fonts you must type that in multiple times. Simply change the word case 5: to the next number in the series. Do the same for the word F5

    Alright, you are finished! From here, I am going to presume you know how to build the code. If not, I recommend reading this article. If you need any more assistance, please post it in this thread. Happy modding!

  2. I am not saying roll out every little plugin here. And besides, pyrochild's plugins differ enough to merit multiple roll outs. You wouldn't want to use Smudge and Curves+ in one plugin, yet being able to set the conditions for my custom brushes would be useful. Or if my custom brushes could gradient in color, or mask out the image, or other features like that. If you want to maintain smaller plugins, at least do the power users a favor and bndle it up in one roll out as well.

  3. You know Rick, I would love a color wheel in the prefences to change this background color. This would make it a lot easier for somebody like me that loves to compare my work against multiple color schemes and the like. That to me would be a solid resolution to this problem and would also develop more benefit for image creation.

  4. Actually, I was trying to avoid getting into 3D discussion with that peice, but that is actually me trying to replicated Jake2K's tutorial in a plugin. As well, i was working on some bending to give it a dual appearance. Is it a leaf, or trees? As simple as it may seem, it is a huge test canvas of fun goodies to be looking for ;)

  5. @THS: I don't think anybody would mind, but remember it is against the Pictorium rules to post non Paint.NET created work ;)

    As well, if some of you all may remember I am on a vacation to Colorado. Yesterday I spent around fifteen hours in the car and had some cool Paint.NET creations, but I like this new Anhelo Designs logo I created. It doesn't fit into the perspective of Anhelo and CMD's take on the logo will remain the default, but here it is anyways!

    anhelodesignscarride.png

×
×
  • Create New...