Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
al_get_glyph_dimensions(3)  Library Functions Manual  al_get_glyph_dimensions(3)

NAME
     al_get_glyph_dimensions - Allegro 5 API

SYNOPSIS
	    #include <allegro5/allegro_font.h>

	    bool al_get_glyph_dimensions(const ALLEGRO_FONT *f,
	       int codepoint, int *bbx, int *bby, int *bbw, int *bbh)

DESCRIPTION
     Sometimes,  the  al_get_glyph_width(3) or al_get_glyph_advance(3) functions
     are not enough for exact glyph placement, so this function returns some ad-
     ditional information, particularly if you want to draw the font vertically.

     The function itself returns true if the character was present in  font  and
     false if the character was not present in font.

     Returned variables (all in pixel):

     * bbx, bby - Offset to upper left corner of bounding box.

     * bbw, bbh - Dimensions of bounding box.

     These  values  are the same as al_get_text_dimensions(3) would return for a
     string of a single character equal to the glyph passed  to  this  function.
     Note  that  glyphs may go to the left and upwards of the X, in which case x
     and y will have negative values.

     If you want to draw a string verticallly, for Japanese or as a game effect,
     then you should leave bby + bbh space between the glyphs in the y direction
     for a regular placement.

     If you want to draw a string horizontally in an extra compact way,
     then you should leave bbx + bbw space between the glyphs in the x direction
     for a compact placement.

     In the figure below is an example of what bbx and bby may be like for  a  2
     glyph,  and  a  g	glyph  of  the	same  font  compared  to  the  result of
     al_get_glyph_width().

	       al_get_glyph_width()	al_get_glyph_width()
		      __|___		       __|__
		     /	    \		      /     \
		 bbx	bbw		    bbx   bbw
		<-->+<------>+		 <-->+<----->+	 X baseline
		^   |	     |		 ^   |	     |
	    bby |   |	     |	     bby |   |	     |
		v   |	     |		 |   |	     |
		+---+--------+		 |   |	     |
		^   | *****  |		 |   |	     |
		|   |*	  ** |		 v   |	     |
	    bbh |   |	 **  |	     bbh +---+-------+
		|   |  **    |		 ^   | ***** |
		v   |********|		 |   |*     *|
		+---+--------+		 |   | ***** |
					 |   |	    *|
					 |   | *    *|
					 v   |	**** |
					 +---+-------+

SINCE
     5.1.12

SEE ALSO
     al_draw_glyph(3), al_get_glyph_width(3), al_get_glyph_advance(3).

Allegro reference manual			      al_get_glyph_dimensions(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=al_get_glyph_dimensions&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help