CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Font for GLCD

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ekocakaya



Joined: 13 Aug 2006
Posts: 12

View user's profile Send private message

Font for GLCD
PostPosted: Mon Apr 22, 2013 4:18 am     Reply with quote

Hello friend,

for my 240x128 GLCD,

I need new fonts , big fonts , like 10x15 or 11x13,

anybody have code for it or an example, there is no sample for this font

everybody says use GLCD font creator but it is not suitable for CCS

waiting your helps
temtronic



Joined: 01 Jul 2010
Posts: 9160
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Apr 22, 2013 5:01 am     Reply with quote

you should tell us which GLCD module you're using.

have you googled' your GLCD font creator' or similar query?

hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19326

View user's profile Send private message

PostPosted: Mon Apr 22, 2013 5:12 am     Reply with quote

The data tables it produces can be used with any compiler, with a bit of tweaking.

What _you_ have to do, is create your own output function to support the larger font. The example CCS supplied function (if that is the library you are using), shows exactly what you need to do. Loop through the byte patterns, and set bits if they are set in the data table. Obviously you have to switch to 16bit entries to give detailed fonts at the larger sizes..
You are aware that the standard CCS function allows you to use 2*, 3* etc., character sizes 10*14, 15*21 etc.?.

Best Wishes
ekocakaya



Joined: 13 Aug 2006
Posts: 12

View user's profile Send private message

hello
PostPosted: Wed Apr 24, 2013 4:07 am     Reply with quote

My GLCD is 240x128 Winstar 240128B Model.

Yes I switched to the 16bit try some examples.

With using MikroC GLCD Font Creater program,

I can't figure its table to my CCS, anybody can you give me idea?
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Wed Apr 24, 2013 6:48 am     Reply with quote

Hi,

As Ttelmah says, 'data-is-data', so the GLCD Font Creator program will work fine to generate font data for the CCS compiler. The output format is slightly different, but it's a minor tweak of the output to make it 100% compatible with the compiler.

I did a GLCD clock a while ago, so I used that program to create a large format font in the size of 14 x 21 pixels. I created characters for '0' to '9', a ':', a Space, and a '/'. If you want me to share the font data, just let me know. Of course, you'll also have to create a subroutine to display the new font data, but it's just a (fairly) trivial modification to the existing 5 x 7 routines supplied by CCS.

John
Markdem



Joined: 24 Jun 2005
Posts: 206

View user's profile Send private message Send e-mail

PostPosted: Thu Apr 25, 2013 5:59 am     Reply with quote

You can use my function with the output from the mikroC font creator.
You want to use the “Export for TFT and new GLCD” option.

You will need to remove the colour part out for your LCD. I will let you work that out.

Code:

void glcd_text(unsigned int16 x_origin, unsigned int16 y_origin, char* textptr, unsigned int16 fgcolour, unsigned int16 bgcolour)
{
   unsigned int16 info_offset;
   int chr_width;
   int chr_bytes;
   unsigned int16 chr_hight;
   unsigned int16 chr_offset;

   int i,j,k;
   unsigned int16 x,y;

   chr_hight = font[6];                                             //the hight is always stored in the 6th bit
   
   while(*textptr != '\0')
      {
         if(*textptr == ' ')                                          //found a space, we will just insert a few lines
            {
               x_origin = x_origin + 5;                              //move to the next chr position   
            }
         else
            {
               info_offset = (((unsigned int16)*textptr - 33) * 4) + 8;      //work out how far into the font array is the info about the current chr skipping the fist 8 byts in the table
               chr_width = font[info_offset];                           //the first byte contanes the width information, this is only how wide the chr is without padding
               chr_offset = make16(font[info_offset+2], font[info_offset+1]);    //The next two bytes contane the offset in the table to the bitmap of the chr

                 chr_bytes = chr_width / 8;                                    //work our how many bytes wide the char is
                  if (chr_width  % 8)
                  {
                     chr_bytes++;
                  }
     
               x = x_origin;                                                         //save the start x position
               y = y_origin;                                                         //save the start y position
     
                  for(i=0;i<chr_hight;i++)                                             //loop thought vertical bytes
                     {
                        for(j=0;j<chr_bytes;j++)                                       //loop thought horizontal bytes                             
                           {
                              for(k=0;k<8;k++)                                       //loop though each bit
                                 {
                                    if(bit_test(font[chr_offset],k))         
                                       {
                                          glcd_pixel(x,y,fgcolour);                           //bit is set, make the pixel the text colour
                                       }
                                    else
                                       {
                                          glcd_pixel(x,y,bgcolour);                           //bit is not set, make it the background colour
                                       }
                                    x++;                                          //move to the next vertical line
                                 }
                              chr_offset++;                                          //move to the next byte
                           }     
                        x = x_origin;                                                //move the x origin to start drawing the next horizontal bytes
                        y++;                                                      //move down to the next row
                     }
     
               x_origin = x_origin + chr_width + 1;                           //move to the next chr position                             
            }
         textptr++;                                                      //move to next char in string
      }   
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group