Example #1
0
		font fallback_font(font aFont) const
		{
			if (!use_fallback())
				return aFont;
			else
			{
				font fallbackFont = aFont.fallback();
				for (uint8_t i = 0; i < iFallbackIndex; ++i)
					fallbackFont = fallbackFont.fallback();
				return fallbackFont;
			}
		}
Example #2
0
		static neogfx::size extents(const font& aFont, const_iterator aBegin, const_iterator aEnd)
		{
			neogfx::size result;
			bool usingNormal = false;
			bool usingFallback = false;
			for (glyph_text::const_iterator i = aBegin; i != aEnd; ++i)
			{
				result.cx += i->advance().cx;
				if (!i->use_fallback())
					usingNormal = true;
				else
					usingFallback = true;
			}
			if (usingNormal || !usingFallback)
				result.cy = aFont.height();
			if (usingFallback)
				result.cy = std::max(result.cy, aFont.fallback().height());
			return neogfx::size(std::ceil(result.cx), std::ceil(result.cy));
		}