Example #1
0
 unsigned int BitmapFont::get_text_width(const char *text) const
 {
     unsigned int width = 0;
     while (*text)
     {
         char c = *text++;
         if (c == ' ')
         {
             width += get_line_height() * 0.25f;
         }
         else
         {
             BitmapFontCharacter glyph = get_character(c);
             width += glyph.advance_x;
         }
     }
     return width;
 }
Example #2
0
/**
 * Compute absolute line-height
 *
 * \param style      Style to process
 * \param ex_size    Ex size, in ems
 * \return CSS_OK on success
 */
css_error compute_absolute_line_height(css_computed_style *style,
		const css_hint_length *ex_size)
{
	css_fixed length = 0;
	css_unit unit = CSS_UNIT_PX;
	uint8_t type;
	css_error error;

	type = get_line_height(style, &length, &unit);

	if (type == CSS_LINE_HEIGHT_DIMENSION) {
		if (unit == CSS_UNIT_EX) {
			length = FMUL(length, ex_size->value);
			unit = ex_size->unit;
		}

		error = set_line_height(style, type, length, unit);
		if (error != CSS_OK)
			return error;
	}

	return CSS_OK;
}
Example #3
0
static float
get_value_font_size()
{
  return get_line_height() * darktable.bauhaus->value_font_size;
}
Example #4
0
static float
get_label_font_size()
{
  return get_line_height() * darktable.bauhaus->label_font_size;
}