ubit
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
ubit::UFontMetrics Class Reference

Public Member Functions

 UFontMetrics (const UFont &, UDisp *)
 
 UFontMetrics (const UFontDesc &, UDisp *)
 Note: the UFontDesc argument must NOT be destroyed while this UFontMetrics is used.
 
 UFontMetrics (UUpdateContext &)
 
void set (const UFont &, UDisp *=null)
 
void set (const UFontDesc &, UDisp *=null)
 
float getAscent () const
 
float getDescent () const
 
float getHeight () const
 
float getWidth (char) const
 
float getWidth (const UStr &) const
 
float getWidth (const UStr &, int from_char, int len=-1) const
 
float getWidth (const char *str, int str_len=-1) const
 
int getCharPos (const char *str, int str_len, float x) const
 converts x pos to char pos.
 
float getXPos (const char *str, int str_len, int char_pos) const
 converts char pos to x pos.
 
bool getSubTextSize (const char *s, int s_len, UDimension &, float available_width, int &s_sublen, int &change_line) const
 returns font metrics of a substring that verifies certain conditions. More...
 

Static Public Member Functions

static bool getClippedText (const UHardFont *, float clip_x, float clip_width, const char *str, int str_len, float x0, float y0, int &charpos_begin, int &charpos_end, float &xpos_begin, float &xpos_end)
 returns the substring that is enclosed in the current clip. More...
 

Protected Attributes

UDispdisp
 
const UFontDescfd
 
bool own_fd
 

Member Function Documentation

§ getClippedText()

bool UFontMetrics::getClippedText ( const UHardFont f,
float  clip_x,
float  clip_width,
const char *  str,
int  str_len,
float  x0,
float  y0,
int &  charpos_begin,
int &  charpos_end,
float &  xpos_begin,
float &  xpos_end 
)
static

returns the substring that is enclosed in the current clip.

utilise par drawString en mode OpenGL pour eviter de dessiner ce qui sort de la zone de clipping

§ getSubTextSize()

bool UFontMetrics::getSubTextSize ( const char *  s,
int  s_len,
UDimension dim,
float  available_width,
int &  s_sublen,
int &  change_line 
) const

returns font metrics of a substring that verifies certain conditions.

Notes:

  • the substring starts from the beginning of 'str' and ends at the 1st
    or 1st " " that is before 'available_width'.
  • it is equal to 'str' otherwise.
  • returns w and h that this substring occupies and its length 'sublen'
  • change_line = 1 si line must be changed because of size and 2 if a
    was found

The documentation for this class was generated from the following files: