Skip to content

Commit 5541d3b

Browse files
author
Michael Johnston
committed
Merge pull request Flipboard#65 from Flipboard/cying-font-pixels-fix
Fix for canvas font using points instead of pixels
2 parents 128fb6e + b4a300c commit 5541d3b

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

examples/css-layout/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ var App = React.createClass({
7474
getTitleStyle: function () {
7575
return {
7676
fontFace: FontFace('Georgia'),
77-
fontSize: 18,
77+
fontSize: 22,
7878
lineHeight: 28,
7979
height: 28,
8080
marginBottom: 10,
@@ -86,7 +86,7 @@ var App = React.createClass({
8686
getExcerptStyle: function () {
8787
return {
8888
fontFace: FontFace('Georgia'),
89-
fontSize: 12,
89+
fontSize: 17,
9090
lineHeight: 25,
9191
marginTop: 15,
9292
flex: 1,

examples/timeline/components/Page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ var Page = React.createClass({
9191
top: this.getImageHeight() + CONTENT_INSET,
9292
left: CONTENT_INSET,
9393
width: this.props.width - 2 * CONTENT_INSET,
94-
fontSize: 20,
94+
fontSize: 22,
9595
lineHeight: 30,
9696
fontFace: FontFace('Avenir Next Condensed, Helvetica, sans-serif', null, {weight: 500})
9797
};
@@ -102,7 +102,7 @@ var Page = React.createClass({
102102
left: CONTENT_INSET,
103103
width: this.props.width - 2 * CONTENT_INSET,
104104
fontFace: FontFace('Georgia, serif'),
105-
fontSize: 12,
105+
fontSize: 15,
106106
lineHeight: 23
107107
};
108108
},

lib/CanvasUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function drawText (ctx, text, x, y, width, height, fontFace, options) {
136136
}
137137

138138
ctx.fillStyle = options.color;
139-
ctx.font = fontFace.attributes.style + ' normal ' + fontFace.attributes.weight + ' ' + options.fontSize + 'pt ' + fontFace.family;
139+
ctx.font = fontFace.attributes.style + ' ' + fontFace.attributes.weight + ' ' + options.fontSize + 'px ' + fontFace.family;
140140

141141
textMetrics.lines.forEach(function (line, index) {
142142
currText = line.text;

lib/measureText.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module.exports = function measureText (text, width, fontFace, fontSize, lineHeig
5050
var tryLine;
5151
var currentLine;
5252

53-
ctx.font = fontFace.attributes.style + ' normal ' + fontFace.attributes.weight + ' ' + fontSize + 'pt ' + fontFace.family;
53+
ctx.font = fontFace.attributes.style + ' ' + fontFace.attributes.weight + ' ' + fontSize + 'px ' + fontFace.family;
5454
textMetrics = ctx.measureText(text);
5555

5656
measuredSize.width = textMetrics.width;

0 commit comments

Comments
 (0)