void DGFont::setResource(const char* fromFileName, unsigned int heightOfFont) { _height = (float)heightOfFont; if (FT_New_Face(*_library, config->path(DGPathRes, fromFileName, DGObjectFont), 0, &_face)) { log->error(DGModFont, "%s: %s", DGMsg260003, fromFileName); return; } _loadFont(); _isLoaded = true; }
void Font::setDefault(unsigned int heightOfFont) { FT_Face face; if (FT_New_Memory_Face(*_library, kFontData, kSizeOfFontData, 0, &face)) { log.error(kModFont, "%s", kString15005); return; } _height = heightOfFont; _loadFont(face); FT_Done_Face(face); }
void DGFont::setDefault(unsigned int heightOfFont) { _height = (float)heightOfFont; // WARNING: That 49052 size may not be exact... Careful! if (FT_New_Memory_Face(*_library, DGDefFontBinary, 49052, 0, &_face)) { log->error(DGModFont, "%s", DGMsg260004); return; } _loadFont(); _isLoaded = true; }
void Font::setResource(const std::string &fromFileName, unsigned int heightOfFont) { FT_Face face; if (FT_New_Face(*_library, config.path(kPathResources, fromFileName, kObjectFont).c_str(), 0, &face)) { log.error(kModFont, "%s: %s", kString15004, fromFileName.c_str()); return; } _height = heightOfFont; _loadFont(face); FT_Done_Face(face); }
void SFMLRenderer::_initializeHeader() { _loadFont(); if (!imageH.loadFromFile("data/header.png")) { std::cout << "Error loading header.png" << std::endl; exit(1); } textureH.loadFromImage(imageH); _header.setTexture(textureH); _header.setPosition(249, 0); _headerText.setString("TETRIS"); _headerText.Bold; _headerText.setFont(_font); _headerText.setCharacterSize(50); _headerText.setColor(sf::Color::White); _headerText.setOrigin(_headerText.getLocalBounds().width / 2, _headerText.getLocalBounds().height / 2); _headerTextPos.x = WINDOW_WIDTH / 2; _headerTextPos.y = _boardPos.y * 0.125 + -_headerText.getLocalBounds().height / 2; _headerText.setPosition(_headerTextPos); }