Code Search for Developers
 
 
  

gfxfontext.c from The Open2x Project at Krugle


Show gfxfontext.c syntax highlighted

/*
 *  - godori <ghcstop>, www.aesop-embedded.org
 *
 *    => Created. Jan, 2001
 *
 */
#include "gfxdev.h"

inline int gfx_htext_width(PSD psd, char *text)
{
   int i, text_length_pixel=0;
   uint8 data1;

   for(i=0; i<(int)strlen(text); i++)
   {
      data1 = *(text+i);
      if( data1 >= 0xA1 )
      {
         i++;
         #ifdef OUTLINE_BITMAP
         text_length_pixel += (psd->hfont->width+2);
         #else
         text_length_pixel += psd->hfont->width;
         #endif
      }
   }

   return text_length_pixel;
}

inline int gfx_hchar_width(PSD psd, char *text)
{
    #ifdef OUTLINE_BITMAP
    return (psd->hfont->width+2);
    #else
    return psd->hfont->width;
    #endif
}


inline int gfx_echar_width(PSD psd, char ch)
{
   int char_position =  ch - psd->efont->startchar;

   if( char_position < 0 ) return -1;

   #ifdef OUTLINE_BITMAP
   return (psd->efont->widths[char_position]+2);
   #else
   return psd->efont->widths[char_position];
   #endif
}


inline int gfx_etext_width(PSD psd, char *text)
{
   int j;
   int char_position, text_length_pixel = 0;

   for(j=0; j<(int)strlen(text); j++)
   {
      char_position = text[j]-psd->efont->startchar;
      #ifdef OUTLINE_BITMAP
      text_length_pixel += (psd->efont->widths[char_position]+2);
      #else
      text_length_pixel += psd->efont->widths[char_position];
      #endif
   }
   return text_length_pixel;
}

inline int gfx_mtext_width(PSD psd, char *text)
{
   int i, text_length_pixel=0;
   uint8 data1;
   int char_position;


   for(i=0; i<(int)strlen(text); i++)
   {
      data1 = *(text+i);
      if( data1 >= 0xA1 )
      {
         i++;
         #ifdef OUTLINE_BITMAP
         text_length_pixel += (psd->hfont->width+2);
         #else
         text_length_pixel += psd->hfont->width;
         #endif
      }
      else
      {
         char_position = text[i]-psd->efont->startchar;
         #ifdef OUTLINE_BITMAP
         text_length_pixel += (psd->efont->widths[char_position]+2);
         #else
         text_length_pixel += psd->efont->widths[char_position];
         #endif
      }
   }

   return text_length_pixel;
}


inline int gfx_han_height(PSD psd)
{
    #ifdef OUTLINE_BITMAP
    return (psd->hfont->height+2);
    #else
    return psd->hfont->height;
    #endif
}

inline int gfx_eng_height(PSD psd)
{
    #ifdef OUTLINE_BITMAP
    return (psd->efont->height+2);
    #else
    return psd->efont->height;
    #endif
}




See more files for this project here

The Open2x Project

The Open2x project exists to provide an open source resource for the GP2X handheld console based on the MagicEyes MMSP2 processing platform and MP2520F SoC. The project hosts Linux kernel source for the GP2X, boot loader (U-Boot) source and more.

Project homepage: http://www.distant-earth.com/open2x
Programming language(s): Assembly,C,C++
License: other

  Makefile
  fblin16.c
  fblin24.c
  fblin32.c
  fbs.h
  fontdisp.h
  fontout.c
  gfxdev.h
  gfxfontext.c
  gfxfontload.c
  gfxfontout.c
  gfxtype.h
  gulim_96_10_eng.c
  gulim_96_10_han.c
  main.c
  scr_fb.c