vdr-plugin-tvguide/fontmanager.c

97 lines
4.2 KiB
C
Raw Permalink Normal View History

2019-07-11 11:07:13 +02:00
#include "geometrymanager.h"
#include "config.h"
#include "fontmanager.h"
cFontManager::cFontManager() {
}
cFontManager::~cFontManager() {
DeleteFonts();
}
void cFontManager::SetFonts() {
InitialiseFontType();
//Common Fonts
2019-07-11 11:28:11 +02:00
FontButton = CreateFont(geoManager.footerHeight/3 + 4 + config.FontButtonDelta);
FontDetailView = CreateFont(geoManager.osdHeight/30 + config.FontDetailViewDelta);
FontDetailViewSmall = CreateFont(geoManager.osdHeight/40 + config.FontDetailViewSmallDelta);
FontDetailHeader = CreateFont(geoManager.osdHeight/27 + config.FontDetailHeaderDelta);
FontDetailHeaderLarge = CreateFont(geoManager.osdHeight/20 + config.FontDetailHeaderDelta);
FontMessageBox = CreateFont(geoManager.osdHeight/33 + config.FontMessageBoxDelta);
FontMessageBoxLarge = CreateFont(geoManager.osdHeight/30 + config.FontMessageBoxLargeDelta);
FontStatusHeader = CreateFont(geoManager.statusHeaderHeight/6 - 4 + config.FontStatusHeaderDelta);
FontStatusHeaderLarge = CreateFont(geoManager.statusHeaderHeight/5 + config.FontStatusHeaderLargeDelta);
2019-07-11 11:07:13 +02:00
//Fonts for vertical Display
2019-07-11 11:28:11 +02:00
FontChannelHeader = CreateFont(geoManager.colWidth/10 + config.FontChannelHeaderDelta);
FontChannelGroups = CreateFont(geoManager.colWidth/8 + config.FontChannelGroupsDelta);
FontGrid = CreateFont(geoManager.colWidth/12 + config.FontGridDelta);
FontGridSmall = CreateFont(geoManager.colWidth/12 + config.FontGridSmallDelta);
FontTimeLineWeekday = CreateFont(geoManager.timeLineWidth/3 + config.FontTimeLineWeekdayDelta);
FontTimeLineDate = CreateFont(geoManager.timeLineWidth/4 + config.FontTimeLineDateDelta);
FontTimeLineTime = CreateFont(geoManager.timeLineWidth/4 + config.FontTimeLineTimeDelta);
2019-07-11 11:07:13 +02:00
//Fonts for horizontal Display
2019-07-11 11:28:11 +02:00
FontChannelHeaderHorizontal = CreateFont(geoManager.rowHeight/3 + config.FontChannelHeaderHorizontalDelta);
FontChannelGroupsHorizontal = CreateFont(geoManager.rowHeight/3 + 5 + config.FontChannelGroupsHorizontalDelta);
FontGridHorizontal = CreateFont(geoManager.rowHeight/3 + 5 + config.FontGridHorizontalDelta);
FontGridHorizontalSmall = CreateFont(geoManager.rowHeight/4 + config.FontGridHorizontalSmallDelta);
FontTimeLineDateHorizontal = CreateFont(geoManager.timeLineHeight/2 + 5 + config.FontTimeLineDateHorizontalDelta);
FontTimeLineTimeHorizontal = CreateFont(geoManager.timeLineHeight/2 + config.FontTimeLineTimeHorizontalDelta);
2019-07-11 11:07:13 +02:00
//Fonts for RecMenu
2019-07-11 11:28:11 +02:00
FontRecMenuItem = CreateFont(geoManager.osdHeight/30 + config.FontRecMenuItemDelta);
FontRecMenuItemSmall = CreateFont(geoManager.osdHeight/40 + config.FontRecMenuItemSmallDelta);
FontRecMenuItemLarge = CreateFont(geoManager.osdHeight/25 + config.FontRecMenuItemLargeDelta);
2019-07-11 11:07:13 +02:00
}
void cFontManager::DeleteFonts() {
delete FontButton;
delete FontDetailView;
delete FontDetailViewSmall;
delete FontDetailHeader;
delete FontDetailHeaderLarge;
delete FontMessageBox;
delete FontMessageBoxLarge;
delete FontStatusHeader;
delete FontStatusHeaderLarge;
delete FontChannelHeader;
delete FontChannelGroups;
delete FontGrid;
delete FontGridSmall;
delete FontTimeLineWeekday;
delete FontTimeLineDate;
delete FontTimeLineTime;
delete FontChannelHeaderHorizontal;
delete FontChannelGroupsHorizontal;
delete FontGridHorizontal;
delete FontGridHorizontalSmall;
delete FontTimeLineDateHorizontal;
delete FontTimeLineTimeHorizontal;
delete FontRecMenuItem;
delete FontRecMenuItemSmall;
delete FontRecMenuItemLarge;
}
void cFontManager::InitialiseFontType(void) {
2019-07-11 11:28:11 +02:00
if (config.fontIndex == 0) {
fontName = config.fontNameDefault;
2019-07-11 11:07:13 +02:00
} else {
cStringList availableFonts;
cFont::GetAvailableFontNames(&availableFonts);
2019-07-11 11:28:11 +02:00
if (availableFonts[config.fontIndex-1]) {
fontName = availableFonts[config.fontIndex-1];
2019-07-11 11:07:13 +02:00
} else
2019-07-11 11:28:11 +02:00
fontName = config.fontNameDefault;
2019-07-11 11:07:13 +02:00
}
cFont *test = NULL;
test = cFont::CreateFont(*fontName, 30);
if (!test) {
fontName = DefaultFontSml;
}
delete test;
esyslog("tvguide: Set Font to %s", *fontName);
}
cFont *cFontManager::CreateFont(int size) {
return cFont::CreateFont(*fontName, size);
}