Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes invalid website inconsolata reference #5381

Merged
merged 2 commits into from
Nov 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/utilities/string_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ p5.prototype.matchAll = function(str, reg) {
/**
* Utility function for formatting numbers into strings. There are two
* versions: one for formatting floats, and one for formatting ints.
*
* The values for the digits, left, and right parameters should always
* be positive integers.
*
* (NOTE): Be cautious when using left and right parameters as it prepends numbers of 0's if the parameter
* if greater than the current length of the number.
*
* For example if number is 123.2 and left parameter passed is 4 which is greater than length of 123
* (integer part) i.e 3 than result will be 0123.2. Same case for right parameter i.e. if right is 3 than
* the result will be 123.200.
Expand All @@ -149,19 +152,14 @@ p5.prototype.matchAll = function(str, reg) {
* @example
* <div>
* <code>
* let myFont;
* function preload() {
* myFont = loadFont('assets/fonts/inconsolata.ttf');
* }
* function setup() {
* background(200);
* let num1 = 321;
* let num2 = -1321;
*
* noStroke();
* fill(0);
* textFont(myFont);
* textSize(22);
* textSize(16);
*
* text(nf(num1, 4, 2), 10, 30);
* text(nf(num2, 4, 2), 10, 80);
Expand Down Expand Up @@ -376,13 +374,18 @@ function addNfp(num) {
* Utility function for formatting numbers into strings. Similar to <a href="#/p5/nf">nf()</a> but
* puts an additional "_" (space) in front of positive numbers just in case to align it with negative
* numbers which includes "-" (minus) sign.
*
* The main usecase of nfs() can be seen when one wants to align the digits (place values) of a non-negative
* number with some negative number (See the example to get a clear picture).
* There are two versions: one for formatting float, and one for formatting int.
*
* The values for the digits, left, and right parameters should always be positive integers.
*
* (IMP): The result on the canvas basically the expected alignment can vary based on the typeface you are using.
*
* (NOTE): Be cautious when using left and right parameters as it prepends numbers of 0's if the parameter
* if greater than the current length of the number.
*
* For example if number is 123.2 and left parameter passed is 4 which is greater than length of 123
* (integer part) i.e 3 than result will be 0123.2. Same case for right parameter i.e. if right is 3 than
* the result will be 123.200.
Expand All @@ -398,19 +401,14 @@ function addNfp(num) {
* @example
* <div>
* <code>
* let myFont;
* function preload() {
* myFont = loadFont('assets/fonts/inconsolata.ttf');
* }
* function setup() {
* background(200);
* let num1 = 321;
* let num2 = -1321;
*
* noStroke();
* fill(0);
* textFont(myFont);
* textSize(22);
* textSize(16);
*
* // nfs() aligns num1 (positive number) with num2 (negative number) by
* // adding a blank space in front of the num1 (positive number)
Expand Down