Tiny graphics library for STM32F746G-DISCO board

Dependents:   RadarDemo 3DDemo RadarDemoT

GrFont.cpp

Committer:
karpent
Date:
2016-11-11
Revision:
3:1ddc4aa1e5cb
Parent:
2:02b7b78e8510

File content as of revision 3:1ddc4aa1e5cb:

//
// GrFont.cpp - System font wrapper class
//

#include "GrFont.h"
#include "stm32746g_discovery_lcd.h"

/*******************************************************************************
 * Definition of fonts provided by stm32746g_discovery_lcd driver
 ******************************************************************************/
const sFONT * GrFont::_fontType[FontsNumber] = { &Font8, &Font12, &Font16, &Font20, &Font24 };

GrFont::GrFont()
{
    SetFontType(Courier12);
}


GrFont::GrFont(GrFontType fontType)
{
    SetFontType(fontType);
}


uint16_t GrFont::Width()
{
    return _fontType[_fontTypeSelected]->Width;
}

uint16_t GrFont::Height()
{
    return _fontType[_fontTypeSelected] -> Height;
}


void GrFont::SetFontType(GrFontType fontType)
{
    if(fontType < FontsNumber) {
        _fontTypeSelected = fontType;
    }
}


sFONT *GrFont::GetSystemFont()
{
    return (sFONT *)_fontType[_fontTypeSelected];
}