/** Set the face dpi which is resolution-dependent. * Normal text will range from 0.8, in 640x* resolutions (won't scale below * that) to 1.0, in 1024x* resolutions, and linearly up. * Bold text will range from 0.2, in 640x* resolutions (won't scale below * that) to 0.4, in 1024x* resolutions, and linearly up. */ void FontWithFace::setDPI() { const int screen_width = irr_driver->getFrameSize().Width; const int screen_height = irr_driver->getFrameSize().Height; float scale = std::max(0, screen_width - 640) / 564.0f; // attempt to compensate for small screens if (screen_width < 1200) scale = std::max(0, screen_width - 640) / 750.0f; if (screen_width < 900 || screen_height < 700) scale = std::min(scale, 0.05f); m_face_dpi = unsigned((getScalingFactorOne() + 0.2f * scale) * getScalingFactorTwo()); } // setDPI
// ---------------------------------------------------------------------------- void FontWithFace::setDPI() { // Get face dpi: // Font size is resolution-dependent. // Normal text will range from 0.8, in 640x* resolutions (won't scale // below that) to 1.0, in 1024x* resolutions, and linearly up // Bold text will range from 0.2, in 640x* resolutions (won't scale // below that) to 0.4, in 1024x* resolutions, and linearly up const int screen_width = irr_driver->getFrameSize().Width; const int screen_height = irr_driver->getFrameSize().Height; float scale = std::max(0, screen_width - 640) / 564.0f; // attempt to compensate for small screens if (screen_width < 1200) scale = std::max(0, screen_width - 640) / 750.0f; if (screen_width < 900 || screen_height < 700) scale = std::min(scale, 0.05f); m_face_dpi = unsigned((getScalingFactorOne() + 0.2f * scale) * getScalingFactorTwo()); } // setDPI