Skip to content

Commit

Permalink
1.0.1 api textZoom (defaults to 0.89 which fixes firefox font drawing…
Browse files Browse the repository at this point in the history
… issues)
  • Loading branch information
nakednous committed Jan 18, 2023
1 parent 56e90f8 commit 519675a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/glyphs/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function setup() {

function draw() {
background('#060621');
drawQuadrille(quadrille, { col: x, row: y, cellLength: LENGTH, outlineWeight: 2, outline: 'green' });
drawQuadrille(quadrille, { col: x, row: y, cellLength: LENGTH, outlineWeight: 2, outline: 'green', textZoom: 0.6 });
drawQuadrille(I, { col: 2, row: 12, cellLength: LENGTH, outline: 'blue' });
}

Expand Down
8 changes: 5 additions & 3 deletions p5.quadrille.js
Original file line number Diff line number Diff line change
Expand Up @@ -880,14 +880,15 @@ class Quadrille {
graphics,
cell = '?',
textColor = this.TEXT_COLOR,
textZoom = this.TEXT_ZOOM,
outline = this.OUTLINE,
outlineWeight = this.OUTLINE_WEIGHT,
cellLength = this.CELL_LENGTH
} = {}) {
graphics.push();
graphics.noStroke();
graphics.fill(textColor);
graphics.textSize(cellLength * this.TEXT_ZOOM / cell.length);
graphics.textSize(cellLength * textZoom / cell.length);
graphics.textAlign(CENTER, CENTER);
graphics.text(cell, 0, 0, cellLength, cellLength);
graphics.pop();
Expand Down Expand Up @@ -958,7 +959,7 @@ class Quadrille {
const INFO =
{
LIBRARY: 'p5.quadrille.js',
VERSION: '1.0.0',
VERSION: '1.0.1',
HOMEPAGE: 'https://github.com/objetos/p5.quadrille.js'
};

Expand All @@ -981,6 +982,7 @@ class Quadrille {
outlineWeight = Quadrille.OUTLINE_WEIGHT,
outline = Quadrille.OUTLINE,
textColor = Quadrille.TEXT_COLOR,
textZoom = Quadrille.TEXT_ZOOM,
board = false,
numberColor = Quadrille.NUMBER_COLOR,
min = 0,
Expand All @@ -1006,7 +1008,7 @@ class Quadrille {
Quadrille.IMAGE({ graphics: graphics, cell: cell, outline: outline, outlineWeight: outlineWeight, cellLength: cellLength });
}
else if (typeof cell === 'string') {
Quadrille.STRING({ graphics: graphics, cell: cell, textColor: textColor, outline: outline, outlineWeight: outlineWeight, cellLength: cellLength });
Quadrille.STRING({ graphics: graphics, cell: cell, textColor: textColor, textZoom: textZoom, outline: outline, outlineWeight: outlineWeight, cellLength: cellLength });
}
else if (typeof cell === 'number') {
Quadrille.NUMBER({ graphics: graphics, cell: cell, outline: outline, outlineWeight: outlineWeight, numberColor: numberColor, min: min, max: max, cellLength: cellLength });
Expand Down

0 comments on commit 519675a

Please sign in to comment.