FontTTF::FontTTF( Material *mat, const std::string &filename, int size, TextureManager *manager) : Font(mat) { TTF_Font *font = TTF_OpenFont(filename.c_str(), size); if (!font) { THROW(InternalError, "Could not open " << filename << " : " << TTF_GetError()); } loadMetrics(font); // Make sure the size is included in the glyph name, else we'll hit collisions when we // try to load different sized fonts. std::string basename; std::ostringstream nameStream; FileSystem::ExtractFilename(filename, basename); nameStream << basename << " " << size << " Glyph"; createGlyph(font, nameStream.str(), manager); TTF_CloseFont(font); }
void HostHealthMonitor::start() { if (!Enabled || !m_stopped) return; loadMetrics(); m_monitor_func = folly::make_unique<AsyncFunc<HostHealthMonitor>>( this, &HostHealthMonitor::monitor ); m_monitor_func->start(); }
OpenTypeVerticalData::OpenTypeVerticalData(const FontPlatformData& platformData) : m_defaultVertOriginY(0) { loadMetrics(platformData); }