Home Index classes Index static functions Index enumerations Index structure types

{Font2D|_tool}


CLASS {Font2D|_tool} , UNTESTED :



A class to control a font used while drawing with {OpenGL}.


IMPORT : {Font} , {AL4_font} , {OpenGL} , {Bitmap_direct} , {Bitmap} , {Geometry} , {Canvas} .


BASE CLASS {Font} .



------------------------------------------------------------ 'construction'

 

FUN New_font_2D ( STR F|ace_name , REAL S|ize_font ) ==> {Font2D} , NEW



------------------------------------------------------------------- 'style'

 

OVERRIDE Set_style (
     
{Font}.{font_attr} A|ttribute_to_set ,
     
BOOL Set|_or_clear )



----------------------------------------------------------------- 'charset'

 

OVERRIDE Set_charset ( INT C|harset_value )



------------------------------------------------------------- 'text colour'

INT Color|_of_text , READ


 

METHOD Set_color ( INT C|olor_value )



----------------------------------------------------------------- 'kerning'

INT Kerning|_between_letters_in_pixels_can_be_negative , READ


 

METHOD Set_kerning|_additional_to_system_defined ( INT K|erning_value )



--------------------- 'all characters which can be printed using this font'

STR Chars|_in_font , READ


  

METHOD Add|_chars_from_string ( STR S|tring_containing_chars_to_add )



METHOD Clear|_chars_collection_and_reset_font_texture



---------------------------------------- 'preferred texture size in pixels'

 

METHOD Set_texture_size|_desired (
     
INT Bitmap_w|idth ,
     
INT Bitmap_h|eight ) , IF Bitmap_w IS CONST , THEN Bitmap_w IN [128, 256, 512, 1024, 2048, 4096], IF Bitmap_h IS CONST , THEN Bitmap_h IN [128, 256, 512, 1024, 2048, 4096] :



------------------------------------------------------ 'use mipmaps or not'

BOOL Mipmaps|_use_to_build_font_default_TRUE , READ


 

METHOD Set_mipmaps|_use ( BOOL Use|_mipmaps )



--------------------------------- 'some values calculated while preparing:'

INT Maximal_width|_of_characters , READ


REAL Average_width|_of_character , READ


INT Height_char|acters_same_for_all_characters , READ


INT Space_width|_if_not_set_average_width_will_be_used



--------------------------------------------------------- 'prepare texture'

   

METHOD Prepare|_texture ==> INT


CONSTANT REAL :

          FIX_WIDTH_CHAR = 0.4 .



METHOD Load|_texture_build_lists (
     
{Bitmap_direct} B|itmap_chars_drawn ) ==> INT



----------------------------------------------- 'text painting on {OpenGL}'

  

METHOD Draw_at|_XY_string (
     
STR S|tring_to_draw ,
     
REAL X|_offset ,
     
REAL Y|_offset ) ==> REAL



METHOD Draw|_string_return_width_drawn (
     
STR S|tring_to_draw ) ==> REAL


END