2020-02-01 00:04:11 +00:00
|
|
|
#include "PageSettingsProvider.h"
|
2020-02-02 21:13:42 +00:00
|
|
|
#include "epaper/EPD.h"
|
|
|
|
#include "epaper/EPDspi.h" // TODO: remove after display config is extracted
|
2020-02-01 00:04:11 +00:00
|
|
|
|
|
|
|
int PageSettingsProvider::getWidth()
|
|
|
|
{
|
|
|
|
return EPD_DISPLAY_WIDTH;
|
|
|
|
}
|
|
|
|
|
|
|
|
int PageSettingsProvider::getHeight()
|
|
|
|
{
|
|
|
|
return EPD_DISPLAY_HEIGHT;
|
|
|
|
}
|
|
|
|
|
|
|
|
int PageSettingsProvider::getCharWidth(char c)
|
|
|
|
{
|
|
|
|
char txt[2] = { c, 0x00 };
|
|
|
|
return this->getStringWidth(txt);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern int pageFont;
|
|
|
|
void activatePageFont()
|
|
|
|
{
|
|
|
|
EPD_setFont(pageFont, NULL); // TODO: hack to get the same font as the printer
|
|
|
|
}
|
|
|
|
|
|
|
|
int PageSettingsProvider::getStringWidth(char* string)
|
|
|
|
{
|
|
|
|
activatePageFont();
|
|
|
|
int ret = EPD_getStringWidth(string);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
int PageSettingsProvider::getCharSpace()
|
|
|
|
{
|
|
|
|
return font_x_space;
|
|
|
|
}
|
|
|
|
|
|
|
|
int PageSettingsProvider::getLineHeight()
|
|
|
|
{
|
|
|
|
activatePageFont();
|
|
|
|
return EPD_getfontheight();
|
|
|
|
}
|
|
|
|
|
|
|
|
int PageSettingsProvider::getLineSpace()
|
|
|
|
{
|
|
|
|
return font_line_space;
|
|
|
|
}
|