diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 599ca53e..ef8d5ff3 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -327,14 +327,18 @@ static iRect documentBounds_DocumentWidget_(const iDocumentWidget *d) { rect.pos.x = mid_Rect(bounds).x - rect.size.x / 2; rect.pos.y = top_Rect(bounds); rect.size.y = height_Rect(bounds) - margin; - if (!hasSiteBanner_GmDocument(d->doc)) { + const iGmRun *banner = siteBanner_GmDocument(d->doc); + if (!banner) { rect.pos.y += margin; rect.size.y -= margin; } const iInt2 docSize = size_GmDocument(d->doc); if (docSize.y < rect.size.y) { - /* Center vertically if short. */ - int offset = (rect.size.y - docSize.y) / 2; + /* Center vertically if short. There is one empty paragraph line's worth of margin + between the banner and the page contents. */ + const int bannerHeight = banner ? height_Rect(banner->visBounds) : 0; + int offset = iMax(0, (rect.size.y + margin - docSize.y - bannerHeight - + lineHeight_Text(paragraph_FontId)) / 2); rect.pos.y += offset; rect.size.y = docSize.y; }