var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
var verticalSpacing = 25;
var charLineLimit = 60;
var arrayTest =[0, 1, 2, 3, 4, 5, 6, 7]
var crossOut = "e";
ctx.fillStyle = "#000000";
ctx.font = "20px Courier"; //the width of the letter will be 3/5 of this.
var ascent = [15, 10] //gives ascent of an upper- and lower-case figure, respectively
var letterWidth = 12;
var text = "He said he was not there yesterday; however, many people saw him there. This book is sure to liquefy your brain. Going from child, to childish, to childlike is only a matter of time. She found his complete dullness interesting. Nobody questions who built the pyramids in Mexico. Her daily goal was to improve on yesterday."
//identifies all "lonely e's" in a string of text. Returns an array with these indices
function findLonelyEs(textStr){
var indices = [];
textStr = textStr.toLowerCase(); //when finding e's, converting everythign to lower case
//checking the first two indices separately
if(textStr[0] === crossOut && !isVowel(textStr[1]) && !isVowel(textStr[2])){
indices.push(0);
}
if(textStr[1] === crossOut && !isVowel(textStr[0]) && !isVowel(textStr[2]) && !isVowel(textStr[3])){
indices.push(1);
}
//Looping through the string, recording any "lonely e's"
for(var i = 2; i < textStr.length - 2; i++){
//testing if character is a "lonely e"
if(textStr[i] === "e" && !isVowel(textStr[i-2]) && !isVowel(textStr[i-1]) && !isVowel(textStr[i+1]) && !isVowel(textStr[i+2])){
indices.push(i);
}
}
//checking the last two indices separately
var lastIdx = textStr.length - 1
if(textStr[lastIdx - 1] === crossOut && !isVowel(textStr[lastIdx - 3]) && !isVowel(textStr[lastIdx - 2]) && !isVowel(textStr[lastIdx])){
indices.push(lastIdx - 1);
}
if(textStr[lastIdx] === crossOut && !isVowel(textStr[lastIdx - 2]) && !isVowel(textStr[lastIdx - 1])){
indices.push(lastIdx);
}
return...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.