From 89ad638a1d54854badd2c2d790d4757021984179 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 1 Jul 2011 21:53:10 -0700 Subject: [PATCH] When the unit is in pixels, round down in the leader and up in the trailer. --- .../compass/typography/_vertical_rhythm.scss | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss b/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss index 96895145..548d1323 100644 --- a/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +++ b/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss @@ -104,26 +104,38 @@ $base-half-leader: $base-leader / 2; // Apply leading whitespace @mixin leader($lines: 1, $font-size: $base-font-size, $property: margin) { - #{$property}-top: rhythm($lines, $font-size); + $leader: rhythm($lines, $font-size); + @if unit($leader) == px { + $leader: floor($leader) + } + #{$property}-top: $leader; } +// Apply leading whitespace as padding @mixin padding-leader($lines: 1, $font-size: $base-font-size) { @include leader($lines, $font-size, padding); } +// Apply leading whitespace as margin @mixin margin-leader($lines: 1, $font-size: $base-font-size) { @include leader($lines, $font-size, margin); } // Apply trailing whitespace @mixin trailer($lines: 1, $font-size: $base-font-size, $property: margin) { - #{$property}-bottom: rhythm($lines, $font-size); + $leader: rhythm($lines, $font-size); + @if unit($leader) == px { + $leader: ceil($leader) + } + #{$property}-bottom: $leader; } +// Apply trailing whitespace as padding @mixin padding-trailer($lines: 1, $font-size: $base-font-size) { @include trailer($lines, $font-size, padding); } +// Apply trailing whitespace as margin @mixin margin-trailer($lines: 1, $font-size: $base-font-size) { @include trailer($lines, $font-size, margin); }