Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update js/cufon.js #223

Open
wants to merge 2 commits into from

1 participant

@Devolv

Update padding top when Device Ratio is greater than 1, padding is also multiplied by PixelRatio to prevent insufficient padding.

@Devolv

This is in relation to previous issue: #222

With Retina devices - padding within the canvas elements are incorrect. Padding unit used within the Canvas element is pixels, and when using the device-pixel-ratio=2 doubles the padding as well, but this creates too much padding on the Retina devices. Text height alignment is off as well, so vertically centering Cufon text on a header consistently would be impossible for both Retina and Non-Retina devices. Characters such as "g", "j" etc are also being clipped off the edge of the canvas element.

@Devolv

My patch seems to work a lot better, but there is still bottom padding that I could not remove.

@Devolv

Updated again. Above code is incorrect. Not divide, but multiply.
ff28728

So far no strange behavior with the corrected patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 5, 2011
  1. @Devolv

    Update js/cufon.js

    Devolv authored
Commits on Dec 20, 2011
  1. @Devolv

    Update js/cufon.js

    Devolv authored
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  js/cufon.js
View
1  js/cufon.js
@@ -1391,6 +1391,7 @@ Cufon.registerEngine('canvas', (function() {
canvas.width = canvasWidth * pixelRatio;
canvas.height = canvasHeight * pixelRatio;
g.scale(pixelRatio, pixelRatio);
+ cStyle.top = Math.round((size.convert(expandTop - font.ascent)) / pixelRatio) + 'px';
}
// proper horizontal scaling is performed later
Something went wrong with that request. Please try again.