From 5198f7202f736ff4d2966e7e6051165bb25f72bb Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 9 Aug 2014 00:28:12 -0400 Subject: [PATCH] Finished the previous commit. --- redo/container_windows.go | 2 +- redo/label_windows.go | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/redo/container_windows.go b/redo/container_windows.go index 68cb59f..41d7aad 100644 --- a/redo/container_windows.go +++ b/redo/container_windows.go @@ -22,7 +22,7 @@ type sizing struct { // for size calculations baseX C.int baseY C.int - internalLeading C.LONG + internalLeading C.LONG // for Label; see Label.commitResize() for details // for the actual resizing // possibly the HDWP diff --git a/redo/label_windows.go b/redo/label_windows.go index 561247c..d87f02e 100644 --- a/redo/label_windows.go +++ b/redo/label_windows.go @@ -68,7 +68,6 @@ const ( // via http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing labelHeight = 8 labelYOffset = 3 - // TODO the label is offset slightly by default... ) func (l *label) preferredSize(d *sizing) (width, height int) { @@ -80,9 +79,13 @@ func (l *label) commitResize(c *allocation, d *sizing) { yoff := fromdlgunitsY(labelYOffset, d) c.y += yoff c.height -= yoff + // by default, labels are drawn offset by the internal leading (the space reserved for accents on uppercase letters) + // the above calculation assumes otherwise, so account for the difference + // there will be enough space left over for the internal leading anyway (at least on the standard fonts) + // don't do this to standalone labels, otherwise those accents get cut off! + c.y -= int(d.internalLeading) + c.height += int(d.internalLeading) } - c.y -= int(d.internalLeading) - c.height += int(d.internalLeading) basecommitResize(l, c, d) }