Commit 1612bd59 authored by Julie Blanc's avatar Julie Blanc

comments unnecessary parts of the script

parent 02fcbc3c
......@@ -119,24 +119,24 @@ return /******/ (function(modules) { // webpackBootstrap
context.fillText(text, canvas.width / 2, padding, canvas.width);
};
var computeLineHeight = function computeLineHeight() {
var letter = 'A';
setAlignment('bottom');
var gutter = canvas.height - measureBottom(letter);
setAlignment('top');
return measureBottom(letter) + gutter;
};
// var computeLineHeight = function computeLineHeight() {
// var letter = 'A';
// setAlignment('bottom');
// var gutter = canvas.height - measureBottom(letter);
// setAlignment('top');
// return measureBottom(letter) + gutter;
// };
var getPixels = function getPixels(text) {
updateText(text);
return context.getImageData(0, 0, canvas.width, canvas.height).data;
};
var getFirstIndex = function getFirstIndex(pixels) {
for (var i = 3, n = pixels.length; i < n; i += 4) {
if (pixels[i] > 0) return (i - 3) / 4;
}return pixels.length;
};
// var getFirstIndex = function getFirstIndex(pixels) {
// for (var i = 3, n = pixels.length; i < n; i += 4) {
// if (pixels[i] > 0) return (i - 3) / 4;
// }return pixels.length;
// };
var getLastIndex = function getLastIndex(pixels) {
for (var i = pixels.length - 1; i >= 3; i -= 4) {
......@@ -153,9 +153,9 @@ return /******/ (function(modules) { // webpackBootstrap
return result;
};
var measureTop = function measureTop(text) {
return Math.round(getFirstIndex(getPixels(text)) / canvas.width) - padding;
};
// var measureTop = function measureTop(text) {
// return Math.round(getFirstIndex(getPixels(text)) / canvas.width) - padding;
// };
var measureBottom = function measureBottom(text) {
return Math.round(getLastIndex(getPixels(text)) / canvas.width) - padding;
......@@ -164,13 +164,13 @@ return /******/ (function(modules) { // webpackBootstrap
var getMetrics = function getMetrics() {
var chars = arguments.length <= 0 || arguments[0] === undefined ? settings.chars : arguments[0];
return {
capHeight: measureTop(chars.capHeight),
// capHeight: measureTop(chars.capHeight),
baseline: measureBottom(chars.baseline),
xHeight: measureTop(chars.xHeight),
descent: measureBottom(chars.descent),
bottom: computeLineHeight(),
ascent: measureTop(chars.ascent),
tittle: measureTop(chars.tittle),
// xHeight: measureTop(chars.xHeight),
// descent: measureBottom(chars.descent),
// bottom: computeLineHeight(),
// ascent: measureTop(chars.ascent),
// tittle: measureTop(chars.tittle),
top: 0
};
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment