GetFontOrientation Macro

Microchip Graphics Library

Microchip Graphics Library
GetFontOrientation Macro
C
#define GetFontOrientation _fontOrientation
Overview

Returns font orientation.

Returns

Return the current font orientation.

  • 1 when font orientation is vertical
  • 0 when font orientation is horizontal

Preconditions

none

Example
void PlaceText(SHORT x, SHORT y, WORD space, XCHAR *pString)
{
    SHORT width;
    
    SetColor(BRIGHTRED);                // set color
    SetFont(pMyFont);                   // set to use global font 
    
    // get string width
    width = GetTextWidth(pString, pMyFont);

    // check if it fits
    if (space < width)
    {
        if (GetFontOrientation() == 0)
            // reset the orientation to vertical 
            SetFontOrientation(1);
    }
    else
    {
        if (GetFontOrientation() == 1)
            // reset the orientation to horizontal
            SetFontOrientation(0);
    }
    // place string in the middle of the screen
    OutTextXY(x, y, pString);
}
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved