You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

25 lines
920 B

#include "TextRasterizerCache.h"
#include <iostream>
TextRasterizerCache *rasterizerCache=new TextRasterizerCache;
// reduces this:
// Updated DOM in: 6.787870 seconds
// to this:
// Updated DOM in: 6.104453 seconds
std::shared_ptr<TextRasterizer> TextRasterizerCache::loadFont(const unsigned int size, const bool bold) {
if (bold) {
if (fontSizes_bold.find(size) == fontSizes_bold.end()) {
//std::cout << "Making bold font" << std::endl;
fontSizes_bold[size]=std::make_shared<TextRasterizer>("DejaVuSerif.ttf", size, 72, bold);
}
return fontSizes_bold[size];
}
else {
if (fontSizes_notbold.find(size) == fontSizes_notbold.end()) {
//std::cout << "Making font" << std::endl;
fontSizes_notbold[size]=std::make_shared<TextRasterizer>("DejaVuSerif.ttf", size, 72, bold);
}
return fontSizes_notbold[size];
}
}