Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

Font class Reference
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Font Class Reference

#include <Ofont.h>

List of all members.

Public Methods

 Font (char *=NULL)
 ~Font ()
void init (char *fontName, int interCharSpace=1, int italicShift=0)
void deinit ()
int height ()
int width ()
void use_std_height ()
void use_max_height ()
int text_width (char *, int=-1, int=0)
int text_height (int=DEFAULT_LINE_SPACE)
int put (int, int, char *, char=0, int=-1)
int put (int x, int y, int value, char clearBack=0, int x2=-1)
void put_char (int, int, unsigned short)
void right_put (int, int, char *)
int d3_put (int, int, char *)
void d3_put (int, int, int, int, char *)
int center_put (int, int, int, int, char *, char clearBack=0)
void put_paragraph (int, int, int, int, char *, int=DEFAULT_LINE_SPACE, int=1, char=1)
char * Font::get_line (int area_width, int line, char *textPtr)
int find_splitter (int, int, char *)
void count_line (int x1, int y1, int x2, int y2, char *text, int lineSpace, int &totalLines, int &dispLines)
int count_line (int area_width, char *textPtr)
void put_char_to_buffer (char *dest, int destPitch, int x1, int y1, unsigned short text)
void put_to_buffer (char *dest, int destPitch, int x1, int y1, char *text)
void center_put_to_buffer (char *dest, int destPitch, int x1, int y1, int x2, int y2, char *text)
void put_char_to_bufferW (short *dest, int destPitch, int x1, int y1, unsigned short text)
void put_to_bufferW (short *dest, int destPitch, int x1, int y1, char *text)
void center_put_to_bufferW (short *dest, int destPitch, int x1, int y1, int x2, int y2, char *text)
short translate_german_char (short textChar)
void put_field (int, int, char *, int, int, int=1)
void update_field (int, int, int, int, int)
void field (int, int, char *, int, int, int, int, int, char *helpCode=NULL)
int disp (int, int, int, int, int)
void put_field (int a, int b, char *c, int d, short e, int f=1)
void update_field (int a, int b, short c, int d, int e)
void field (int a, int b, char *c, int d, short e, int f, int g, int h, char *helpCode=NULL)
int disp (int a, int b, short c, int d, int e)
void put_field (int a, int b, char *c, int d, long e, int f=1)
void update_field (int a, int b, long c, int d, int e)
void field (int a, int b, char *c, int d, long e, int f, int g, int h, char *helpCode=NULL)
int disp (int a, int b, long c, int d, int e)
void put_field (int, int, char *, int, double, int=1)
void update_field (int, int, double, int, int)
void field (int, int, char *, int, double, int, int, int, char *helpCode=NULL)
int disp (int, int, double, int, int)
void put_field (int, int, char *, int, char *)
void update_field (int, int, char *, int)
void field (int, int, char *, int, char *, int, int, char *helpCode=NULL)
int disp (int, int, char *, int)

Public Attributes

char init_flag
char * next_text_ptr
short next_text_y
short line_count
short font_height
short std_font_height
short max_font_height
short max_font_width
short space_width
short inter_char_space
unsigned short first_char
unsigned short last_char
FontInfofont_info_array
char * font_bitmap_buf

Static Public Attributes

short hyper_field_count
HyperField hyper_field_array [MAX_HYPER_FIELD]


Detailed Description

UI class for displaying multiple fonts within the application. A font resource file is composed of three parts : one FontHeader, one FontInfo for each character, Bitmap data.

Definition at line 48 of file Ofont.h.


Constructor & Destructor Documentation

Font::Font char *    = NULL
 

Definition at line 70 of file Ofont.cpp.

References init().

Font::~Font  
 

Definition at line 81 of file Ofont.cpp.

References deinit().


Member Function Documentation

int Font::center_put int    x1,
int    y1,
int    x2,
int    y2,
char *    desStr,
char    clearBack = 0
 

Display the textPtr on the center of the given area

<int> x1,y1 = the coordination of the panel <int> x2,y2 = <char*> desStr = the spinner description [char] clearBack = clear background with back_color or not (default : 0)

Return : <int> lastX, the x coordination of the last pixel of last font

Definition at line 936 of file Ofont.cpp.

References Vga::use_back_buf.

Referenced by UserInterface::create_button_bitmap().

void Font::center_put_to_buffer char *    dest,
int    destPitch,
int    x1,
int    y1,
int    x2,
int    y2,
char *    text
 

Definition at line 1333 of file Ofont.cpp.

References font_height, put_to_buffer(), and text_width().

void Font::center_put_to_bufferW short *    dest,
int    destPitch,
int    x1,
int    y1,
int    x2,
int    y2,
char *    text
 

Definition at line 1380 of file Ofont.cpp.

References font_height, put_to_bufferW(), and text_width().

int Font::count_line int    area_width,
char *    textPtr
 

int area_width = area width of the textPtr

Definition at line 828 of file Ofont.cpp.

References String::str_buf.

void Font::count_line int    x1,
int    y1,
int    x2,
int    y2,
char *    textPtr,
int    lineSpace,
int &    dispLines,
int &    totalLines
 

Count the no. of lines of textPtr can be displayed on the given area.

int x1,y1,x2,y2 = area of the textPtr char* textPtr = the textPtr to be put on screen

<int lineSpace> = no. of pixel space between lines ( default : 0 )

<int& dispLines> = no. of lines can be displayed in the textPtr area <int& totalLines> = total no. of lines of the textPtr

Definition at line 859 of file Ofont.cpp.

void Font::d3_put int    x1,
int    y1,
int    x2,
int    y2,
char *    desStr
 

Display field description and field value. It will display the description on the center of the panel

<int> x1,y1 = the coordination of the panel <int> x2,y2 = <char*> desStr = the spinner description

Definition at line 910 of file Ofont.cpp.

int Font::d3_put int    x1,
int    y1,
char *    desStr
 

Display field description and field value

<int> x1,y1 = the coordination of the spinner description <char*> desStr = the spinner description

Return : <int> lastX, the x coordination of the last pixel of last font

Definition at line 887 of file Ofont.cpp.

void Font::deinit  
 

Definition at line 178 of file Ofont.cpp.

References font_bitmap_buf, font_info_array, init_flag, mem_del, and NULL.

Referenced by ~Font().

int Font::disp int    x1,
int    y1,
char *    textPtr,
int    x2
 

Display a value and clear the background

<int> x1,y1 = the coordination of the field variable <char*> textPtr = pointer to the textPtr <int> x2 = the x2 (right border) of the field

Return : <int> lastX, the x coordination of the last pixel of last font

Definition at line 1275 of file Ofont.cpp.

int Font::disp int    x1,
int    y1,
double    value,
int    format,
int    x2
 

Display a value and clear the background

<int> x1,y1 = the coordination of the field variable <double> value = value

<int> format = 1 - 1,000,000 normal, with thousand separator 2 - $1,000,000 add dollar sign, with thousand separator 3 - 100% percentage (default : 1 )

<int> x2 = the x2 (right border) of the field

Return : <int> lastX, the x coordination of the last pixel of last font

Definition at line 1254 of file Ofont.cpp.

int Font::disp int    a,
int    b,
long    c,
int    d,
int    e
[inline]
 

Definition at line 152 of file Ofont.h.

References disp().

int Font::disp int    a,
int    b,
short    c,
int    d,
int    e
[inline]
 

Definition at line 138 of file Ofont.h.

References disp().

int Font::disp int    x1,
int    y1,
int    value,
int    format,
int    x2
 

Display a value and clear the background

<int> x1,y1 = the coordination of the field variable <int> value = value

<int> format = 1 - 1,000,000 normal, with thousand separator 2 - $1,000,000 add dollar sign, with thousand separator 3 - 100% percentage (default : 1 )

<int> x2 = the x2 (right border) of the field

Return : <int> lastX, the x coordination of the last pixel of last font

Definition at line 1227 of file Ofont.cpp.

Referenced by disp().

void Font::field int    xDes,
int    y1,
char *    desStr,
int    xValue,
char *    value,
int    xEnd,
int    refreshFlag,
char *    helpCode = NULL
 

Combine the function of put_field() and update_field() depending on the refreshFlag passed

format - "Field : 999999" e.g. "List price : $92,232"

<int> x1,y1 = the coordination of the spinner description <char*> desStr = the spinner description <int> x2 = the coordination of the spinner variable <char*> value = value

<int> x3 = the x3 (right border) of the field <int> refreshFlag = refresh flag, either INFO_REPAINT or INFO_UPDATE [char*] helpCode = help code

Definition at line 1188 of file Ofont.cpp.

References INFO_REPAINT.

void Font::field int    xDes,
int    y1,
char *    desStr,
int    xValue,
double    value,
int    format,
int    xEnd,
int    refreshFlag,
char *    helpCode = NULL
 

Combine the function of put_field() and update_field() depending on the refreshFlag passed

format - "Field : 999999" e.g. "List price : $92,232"

<int> x1,y1 = the coordination of the spinner description <char*> desStr = the spinner description <int> x2 = the coordination of the spinner variable <double> value = value

<int> format = 1 - 1,000,000 normal, with thousand separator 2 - $1,000,000 add dollar sign, with thousand separator 3 - 100% percentage

<int> x2 = the x2 (right border) of the field <int> refreshFlag = refresh flag, either INFO_REPAINT or INFO_UPDATE [char*] helpCode = help code

Definition at line 1111 of file Ofont.cpp.

References INFO_REPAINT.

void Font::field int    a,
int    b,
char *    c,
int    d,
long    e,
int    f,
int    g,
int    h,
char *    helpCode = NULL
[inline]
 

Definition at line 149 of file Ofont.h.

References field(), and NULL.

void Font::field int    a,
int    b,
char *    c,
int    d,
short    e,
int    f,
int    g,
int    h,
char *    helpCode = NULL
[inline]
 

Definition at line 135 of file Ofont.h.

References field(), and NULL.

void Font::field int    xDes,
int    y1,
char *    desStr,
int    xValue,
int    value,
int    format,
int    xEnd,
int    refreshFlag,
char *    helpCode = NULL
 

Combine the function of put_field() and update_field() depending on the refreshFlag passed

format - "Field : 999999" e.g. "List price : $92,232"

<int> x1,y1 = the coordination of the spinner description <char*> desStr = the spinner description <int> x2 = the coordination of the spinner variable <int> value = value

<int> format = 1 - 1,000,000 normal, with thousand separator 2 - $1,000,000 add dollar sign, with thousand separator 3 - 100% percentage

<int> x2 = the x2 (right border) of the field <int> refreshFlag = refresh flag, either INFO_REPAINT or INFO_UPDATE [char*] helpCode = help code

Definition at line 1020 of file Ofont.cpp.

References INFO_REPAINT.

Referenced by field().

int Font::find_splitter int    area_width,
int    start_char,
char *    textPtr
 

int area_width = area width of the textPtr int start_char

Definition at line 777 of file Ofont.cpp.

References NULL.

char* Font::Font::get_line int    area_width,
int    line,
char *    textPtr
 

int Font::height   [inline]
 

Definition at line 82 of file Ofont.h.

References font_height.

Referenced by Get::field(), Text::paint(), LargeText::paint(), and GetA::paint().

void Font::init char *    fontName,
int    interCharSpace = 1,
int    italicShift = 0
 

<char*> fontName = name of the font type. (e.g. "STD" will load "FNT_STD.RES" )

[int] interCharSpace = inter-character space (default:1)

[int] italicShift = horzontal back shifting for italic font (default:0)

Return : 1 - succeed; 0 - reading palette file error

Definition at line 101 of file Ofont.cpp.

References DIR_RES.

Referenced by Font().

int Font::put int    x,
int    y,
int    value,
char    clearBack = 0,
int    x2 = -1
[inline]
 

Definition at line 93 of file Ofont.h.

References put().

int Font::put int   ,
int   ,
char *   ,
char    = 0,
int    = -1
 

Definition at line 207 of file Ofont.cpp.

References Vga::active_buf, FontInfo::bitmap_offset, err_when, first_char, font_bitmap_buf, font_height, font_info_array, init_flag, inter_char_space, last_char, max_font_height, max_font_width, FontInfo::offset_y, VgaBuf::put_bitmap_trans_fast(), space_width, Vga::use_back_buf, VGA_WIDTH, and FontInfo::width.

Referenced by put(), Text::refresh(), LargeText::refresh(), and right_put().

void Font::put_char int   ,
int   ,
unsigned    short
 

Definition at line 339 of file Ofont.cpp.

References Vga::active_buf, FontInfo::bitmap_offset, first_char, font_bitmap_buf, font_info_array, last_char, FontInfo::offset_y, and VgaBuf::put_bitmap_trans().

void Font::put_char_to_buffer char *    dest,
int    destPitch,
int    x1,
int    y1,
unsigned short    text
 

Definition at line 1287 of file Ofont.cpp.

References FontInfo::bitmap_offset, err_here, first_char, font_bitmap_buf, font_info_array, and last_char.

Referenced by put_to_buffer().

void Font::put_char_to_bufferW short *    dest,
int    destPitch,
int    x1,
int    y1,
unsigned short    text
 

Definition at line 1346 of file Ofont.cpp.

References FontInfo::bitmap_offset, first_char, font_bitmap_buf, font_info_array, IMGbltTransRemap(), last_char, and FontInfo::offset_y.

Referenced by put_to_bufferW().

void Font::put_field int    x1,
int    y1,
char *    desStr,
int    x2,
char *    value
 

Display field description and field value

format - "Field : 999999" e.g. "List price : $92,232"

<int> x1,y1 = the coordination of the spinner description <char*> desStr = the spinner description <int> x2 = the coordination of the spinner variable <char*> value = value

Definition at line 1145 of file Ofont.cpp.

void Font::put_field int    x1,
int    y1,
char *    desStr,
int    x2,
double    value,
int    format = 1
 

Display field description and field value

format - "Field : 999999" e.g. "List price : $92,232"

<int> x1,y1 = the coordination of the spinner description <char*> desStr = the spinner description <int> x2 = the coordination of the spinner variable <double> value = value

[int] format = 1 - 1,000,000 normal, with thousand separator 2 - $1,000,000 add dollar sign, with thousand separator 3 - 100% percentage (default : 1 )

Definition at line 1058 of file Ofont.cpp.

void Font::put_field int    a,
int    b,
char *    c,
int    d,
long    e,
int    f = 1
[inline]
 

Definition at line 143 of file Ofont.h.

References put_field().

void Font::put_field int    a,
int    b,
char *    c,
int    d,
short    e,
int    f = 1
[inline]
 

Definition at line 129 of file Ofont.h.

References put_field().

void Font::put_field int    x1,
int    y1,
char *    desStr,
int    x2,
int    value,
int    format = 1
 

Display field description and field value

format - "Field : 999999" e.g. "List price : $92,232"

<int> x1,y1 = the coordination of the spinner description <char*> desStr = the spinner description <int> x2 = the coordination of the spinner variable <int> value = value

[int] format = 1 - 1,000,000 normal, with thousand separator 2 - $1,000,000 add dollar sign, with thousand separator 3 - 100% percentage (default : 1 )

Definition at line 967 of file Ofont.cpp.

Referenced by put_field().

void Font::put_paragraph int    x1,
int    y1,
int    x2,
int    y2,
char *    textPtr,
int    lineSpace = DEFAULT_LINE_SPACE,
int    startLine = 1,
char    dispFlag = 1
 

Put a paragraph of textPtr on screen Given the area of the paragraph Automatical word wrap is available

If the background color of the font is set, the area of the paragraph will be filled with the background color first.

int x1,y1,x2,y2 = area of the textPtr

char* textPtr = the textPtr to be put on screen

[int lineSpace] = no. of pixel space between lines ( default : 2 )

[int] startLine = start display at which line ( default : 1, first line)

[float wordPause] = time pause between words ( default : 0 )

[char dispFlag] = display the textPtr or not, if called by count_line(), this would be 0. ( default : 1 )

-------------------------------------------------------//

It will store resulting paramteres :

<char*> next_text_ptr = point to the textPtr just after this paragraph which has been put to the screen.

<int> next_textPtr_y = the endding y position of the paragraph and which is the y position which next paragraph can be put

<int> line_count = the no. of lines has been displayed in current put_paragraph() session.

<HyperField> hyper_field_array[] = an array of hyper-textPtred field

-------------------------------------------------------//

Definition at line 518 of file Ofont.cpp.

References Vga::active_buf, VgaBuf::bar_fast(), FontInfo::bitmap_offset, err_when, first_char, font_bitmap_buf, font_height, font_info_array, hyper_field_array, HYPER_FIELD_COLOR, hyper_field_count, init_flag, inter_char_space, last_char, line_count, MAX_HYPER_FIELD, next_text_ptr, next_text_y, NULL, FontInfo::offset_y, VgaBuf::put_bitmap_trans_fast(), space_width, HyperField::text_len, HyperField::text_ptr, Vga::use_back_buf, VGA_HEIGHT, VGA_WIDTH, FontInfo::width, HyperField::x1, HyperField::x2, HyperField::y1, and HyperField::y2.

void Font::put_to_buffer char *    dest,
int    destPitch,
int    x1,
int    y1,
char *    text
 

Definition at line 1300 of file Ofont.cpp.

References first_char, font_info_array, put_char_to_buffer(), and space_width.

Referenced by center_put_to_buffer().

void Font::put_to_bufferW short *    dest,
int    destPitch,
int    x1,
int    y1,
char *    text
 

Definition at line 1358 of file Ofont.cpp.

References first_char, font_info_array, put_char_to_bufferW(), and space_width.

Referenced by center_put_to_bufferW(), and GetA::paint().

void Font::right_put int   ,
int   ,
char *   
 

Definition at line 356 of file Ofont.cpp.

References put(), and text_width().

Referenced by Text::refresh(), and LargeText::refresh().

int Font::text_height int    lineSpace = DEFAULT_LINE_SPACE
 

text_width() must first be called, this function use the result from text_width() to calc the textPtr height.

[int] lineSpace = space between lines ( default : DEFAULT_LINE_SPACE )

Return : <int> the screen height of the textPtr display using this font

Definition at line 468 of file Ofont.cpp.

int Font::text_width char *    textPtr,
int    textPtrLen = -1,
int    maxDispWidth = 0
 

Given the textPtr string, then calculate the width (unit:pixel).

char* textPtr = the textPtr to be put on screen [int] textPtrLen = the length of the textPtr to be put (default : -1, until NULL character) [int] maxDispWidth = the maximum width can be displayed the textPtr width cannot > maxDispWidth

Note : static var text_line_count is used to pass value to text_height()

Return : <int> the screen width of the textPtr display using this font

Definition at line 378 of file Ofont.cpp.

Referenced by center_put_to_buffer(), center_put_to_bufferW(), GetA::cursor_x(), Text::paint(), LargeText::paint(), GetA::paint(), and right_put().

short Font::translate_german_char short    textChar
 

void Font::update_field int    x1,
int    y1,
char *    value,
int    x2
 

Update the value of the field which is previously displayed by Font::put_field()

<int> x1,y1 = the coordination of the field variable <char*> value = value <int> x2 = the x2 (right border) of the field

Definition at line 1163 of file Ofont.cpp.

void Font::update_field int    x1,
int    y1,
double    value,
int    format,
int    x2
 

Update the value of the field which is previously displayed by Font::put_field()

<int> x1,y1 = the coordination of the field variable <double> value = value

<int> format = 1 - 1,000,000 normal, with thousand separator 2 - $1,000,000 add dollar sign, with thousand separator 3 - 100% percentage (default : 1 )

<int> x2 = the x2 (right border) of the field

Definition at line 1082 of file Ofont.cpp.

void Font::update_field int    a,
int    b,
long    c,
int    d,
int    e
[inline]
 

Definition at line 146 of file Ofont.h.

References update_field().

void Font::update_field int    a,
int    b,
short    c,
int    d,
int    e
[inline]
 

Definition at line 132 of file Ofont.h.

References update_field().

void Font::update_field int    x1,
int    y1,
int    value,
int    format,
int    x2
 

Update the value of the field which is previously displayed by Font::put_field()

<int> x1,y1 = the coordination of the field variable <int> value = value

<int> format = 1 - 1,000,000 normal, with thousand separator 2 - $1,000,000 add dollar sign, with thousand separator 3 - 100% percentage (default : 1 )

<int> x2 = the x2 (right border) of the field

Definition at line 991 of file Ofont.cpp.

Referenced by update_field().

void Font::use_max_height   [inline]
 

Definition at line 86 of file Ofont.h.

References font_height, and max_font_height.

void Font::use_std_height   [inline]
 

Definition at line 85 of file Ofont.h.

References font_height, and std_font_height.

int Font::width   [inline]
 

Definition at line 83 of file Ofont.h.

References space_width.


Member Data Documentation

unsigned short Font::first_char
 

Definition at line 63 of file Ofont.h.

Referenced by put(), put_char(), put_char_to_buffer(), put_char_to_bufferW(), put_paragraph(), put_to_buffer(), and put_to_bufferW().

char* Font::font_bitmap_buf
 

Definition at line 67 of file Ofont.h.

Referenced by deinit(), put(), put_char(), put_char_to_buffer(), put_char_to_bufferW(), and put_paragraph().

short Font::font_height
 

Definition at line 56 of file Ofont.h.

Referenced by center_put_to_buffer(), center_put_to_bufferW(), height(), Bar::init(), put(), put_paragraph(), use_max_height(), and use_std_height().

FontInfo* Font::font_info_array
 

Definition at line 66 of file Ofont.h.

Referenced by deinit(), put(), put_char(), put_char_to_buffer(), put_char_to_bufferW(), put_paragraph(), put_to_buffer(), and put_to_bufferW().

HyperField Font::hyper_field_array [static]
 

Definition at line 64 of file Ofont.cpp.

Referenced by put_paragraph().

short Font::hyper_field_count [static]
 

Definition at line 63 of file Ofont.cpp.

Referenced by put_paragraph().

char Font::init_flag
 

Definition at line 50 of file Ofont.h.

Referenced by deinit(), put(), and put_paragraph().

short Font::inter_char_space
 

Definition at line 61 of file Ofont.h.

Referenced by put(), and put_paragraph().