1
0
Fork 0
forked from len0rd/rockbox

Fix FS#12951: The icons could be a pixel to far down.

Since eec89a9 icons have been centered using same calculation as for fonts.
In edge cases this is visually different from before and didn't align
well to the font's baseline. Revert to the old calculation just for centering
icons to fix.

A proper aligorithm would take the baseline into account but this has
worked sufficiently well for us (fix this if needed)

Change-Id: I86593529b16cd28ae4552641e216e73795f2450c
This commit is contained in:
Thomas Martitz 2014-02-28 07:29:32 +01:00
parent 05999ed86d
commit 3ae07d48a2

View file

@ -192,8 +192,12 @@ static void print_line(struct screen *display,
tempbuf_idx = 0;
/* vertically center string on the line
* x/2 - y/2 rounds up compared to (x-y)/2 if one of x and y is odd */
icon_y = y + height/2 - icon_h/2;
y += height/2 - display->getcharheight()/2;
/* For the icon use a differnet calculation which to round down instead.
* This tends to align better with the font's baseline for small heights.
* A proper aligorithm would take the baseline into account but this has
* worked sufficiently well for us (fix this if needed) */
icon_y = y + (height - icon_h)/2;
/* parse format string */
while (xpos < max_width)