Merge branch 'fixuncrustify' into 'main'

label-freetype: Fix Uncrustify

See merge request plymouth/plymouth!239
This commit is contained in:
Ray Strode 2023-06-17 16:05:14 +00:00
commit b1d5aa9d2a

View file

@ -156,21 +156,23 @@ static FT_Int
width_of_line (ply_label_plugin_control_t *label,
const char *text)
{
FT_Error error;
FT_Int width = 0;
FT_Int left_bearing = 0;
while (*text != '\0' && *text != '\n') {
if(FT_Load_Char (label->face, *text, FT_LOAD_RENDER | FT_LOAD_TARGET_LIGHT))
continue;
error = FT_Load_Char (label->face, *text, FT_LOAD_RENDER | FT_LOAD_TARGET_LIGHT);
width += label->face->glyph->advance.x >> 6;
left_bearing = label->face->glyph->bitmap_left;
/* We don't "go back" when drawing, so when left bearing is
* negative (like for 'j'), we simply add to the width. */
if (left_bearing < 0)
width += -left_bearing;
if (!error) {
width += label->face->glyph->advance.x >> 6;
left_bearing = label->face->glyph->bitmap_left;
/* We don't "go back" when drawing, so when left bearing is
* negative (like for 'j'), we simply add to the width. */
if (left_bearing < 0)
width += -left_bearing;
++text;
++text;
}
}
return width;