p5 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/accessibility/color_namer.js +4 -4
  2. package/dist/accessibility/index.js +4 -4
  3. package/dist/app.js +5 -5
  4. package/dist/color/color_conversion.js +4 -4
  5. package/dist/color/index.js +1 -1
  6. package/dist/color/setting.js +1 -1
  7. package/dist/{constants-ClrEsgSR.js → constants-Bt1VTUeD.js} +1 -1
  8. package/dist/core/constants.js +1 -1
  9. package/dist/core/environment.js +4 -3
  10. package/dist/core/friendly_errors/fes_core.js +1 -1
  11. package/dist/core/friendly_errors/file_errors.js +1 -1
  12. package/dist/core/friendly_errors/index.js +1 -1
  13. package/dist/core/friendly_errors/param_validator.js +1 -1
  14. package/dist/core/friendly_errors/sketch_verifier.js +1 -1
  15. package/dist/core/helpers.js +1 -1
  16. package/dist/core/init.js +4 -4
  17. package/dist/core/internationalization.js +1 -1
  18. package/dist/core/legacy.js +4 -4
  19. package/dist/core/main.js +4 -4
  20. package/dist/core/p5.Graphics.js +3 -3
  21. package/dist/core/p5.Renderer.js +2 -2
  22. package/dist/core/p5.Renderer2D.js +4 -4
  23. package/dist/core/rendering.js +3 -3
  24. package/dist/dom/dom.js +1 -1
  25. package/dist/dom/index.js +1 -1
  26. package/dist/dom/p5.Element.js +1 -1
  27. package/dist/dom/p5.MediaElement.js +1 -1
  28. package/dist/image/const.js +1 -1
  29. package/dist/image/filterRenderer2D.js +3 -3
  30. package/dist/image/image.js +3 -3
  31. package/dist/image/index.js +3 -3
  32. package/dist/image/loading_displaying.js +3 -3
  33. package/dist/image/p5.Image.js +2 -2
  34. package/dist/io/files.js +3 -3
  35. package/dist/io/index.js +3 -3
  36. package/dist/{ir_builders-CWOp5cp1.js → ir_builders-Cn4s8QTL.js} +13 -5
  37. package/dist/{main-Bnx3mbbg.js → main-IPkchNDB.js} +3 -3
  38. package/dist/math/Matrices/Matrix.js +1 -1
  39. package/dist/math/Matrices/MatrixNumjs.js +1 -1
  40. package/dist/math/index.js +1 -1
  41. package/dist/math/noise.js +16 -0
  42. package/dist/math/p5.Matrix.js +1 -1
  43. package/dist/math/p5.Vector.js +1 -1
  44. package/dist/math/trigonometry.js +1 -1
  45. package/dist/{p5.Renderer-DBmMi2eT.js → p5.Renderer-C-tu2oim.js} +1 -1
  46. package/dist/{rendering-CEHgvKUS.js → rendering-COLWmJqb.js} +17 -4
  47. package/dist/shape/2d_primitives.js +11 -2
  48. package/dist/shape/attributes.js +1 -1
  49. package/dist/shape/custom_shapes.js +106 -10
  50. package/dist/shape/index.js +1 -1
  51. package/dist/strands/ir_builders.js +1 -1
  52. package/dist/strands/ir_dag.js +1 -1
  53. package/dist/strands/p5.strands.js +30 -28
  54. package/dist/strands/strands_api.js +40 -5
  55. package/dist/strands/strands_conditionals.js +1 -1
  56. package/dist/strands/strands_for.js +1 -1
  57. package/dist/strands/strands_glslBackend.js +1 -1
  58. package/dist/strands/strands_node.js +1 -1
  59. package/dist/type/index.js +2 -2
  60. package/dist/type/p5.Font.js +153 -71
  61. package/dist/type/textCore.js +37 -24
  62. package/dist/webgl/3d_primitives.js +3 -3
  63. package/dist/webgl/GeometryBuilder.js +1 -1
  64. package/dist/webgl/ShapeBuilder.js +1 -1
  65. package/dist/webgl/index.js +4 -4
  66. package/dist/webgl/interaction.js +1 -1
  67. package/dist/webgl/light.js +3 -3
  68. package/dist/webgl/loading.js +3 -3
  69. package/dist/webgl/material.js +3 -3
  70. package/dist/webgl/p5.Camera.js +3 -3
  71. package/dist/webgl/p5.Framebuffer.js +3 -3
  72. package/dist/webgl/p5.Geometry.js +1 -1
  73. package/dist/webgl/p5.Quat.js +1 -1
  74. package/dist/webgl/p5.RendererGL.js +3 -3
  75. package/dist/webgl/p5.Shader.js +3 -3
  76. package/dist/webgl/p5.Texture.js +3 -3
  77. package/dist/webgl/text.js +3 -3
  78. package/lib/p5.esm.js +415 -140
  79. package/lib/p5.esm.min.js +1 -1
  80. package/lib/p5.js +415 -140
  81. package/lib/p5.min.js +1 -1
  82. package/package.json +1 -1
  83. package/types/global.d.ts +54 -16
  84. package/types/p5.d.ts +34 -10
@@ -1,15 +1,15 @@
1
1
  import { textCoreConstants } from './textCore.js';
2
- import { C as CENTER, R as RIGHT, a as RADIUS } from '../constants-ClrEsgSR.js';
2
+ import { C as CENTER, R as RIGHT, a as RADIUS } from '../constants-Bt1VTUeD.js';
3
3
  import { UnicodeRange } from '@japont/unicode-range';
4
4
  import { unicodeRanges } from './unicodeRanges.js';
5
+ import { Vector } from '../math/p5.Vector.js';
5
6
  import Typr from './lib/Typr.js';
6
7
  import { createFromCommands } from '@davepagurek/bezier-path';
7
- import '../p5.Renderer-DBmMi2eT.js';
8
+ import '../p5.Renderer-C-tu2oim.js';
8
9
  import '../creating_reading-p2iQtNm5.js';
9
10
  import 'colorjs.io/fn';
10
11
  import '../color/color_spaces/hsb.js';
11
12
  import '../image/filters.js';
12
- import '../math/p5.Vector.js';
13
13
  import '../shape/custom_shapes.js';
14
14
  import '../core/States.js';
15
15
  import '../io/utilities.js';
@@ -520,63 +520,148 @@ class Font {
520
520
  textToModel(str, x, y, width, height, options) {
521
521
  ({ width, height, options } = this._parseArgs(width, height, options));
522
522
  const extrude = options?.extrude || 0;
523
- const contours = this.textToContours(str, x, y, width, height, options);
524
523
 
524
+ let contours = this.textToContours(str, x, y, width, height, options);
525
+ // Step 2: build base flat geometry - single shape
525
526
  const geom = this._pInst.buildGeometry(() => {
526
- if (extrude === 0) {
527
- const prevValidateFaces = this._pInst._renderer._validateFaces;
528
- this._pInst._renderer._validateFaces = true;
529
- this._pInst.beginShape();
530
- this._pInst.normal(0, 0, 1);
531
- for (const contour of contours) {
532
- this._pInst.beginContour();
533
- for (const { x, y } of contour) {
534
- this._pInst.vertex(x, y);
535
- }
536
- this._pInst.endContour(this._pInst.CLOSE);
537
- }
538
- this._pInst.endShape();
539
- this._pInst._renderer._validateFaces = prevValidateFaces;
540
- } else {
541
- const prevValidateFaces = this._pInst._renderer._validateFaces;
542
- this._pInst._renderer._validateFaces = true;
543
-
544
- // Draw front faces
545
- for (const side of [1, -1]) {
546
- this._pInst.beginShape();
547
- for (const contour of contours) {
548
- this._pInst.beginContour();
549
- for (const { x, y } of contour) {
550
- this._pInst.vertex(x, y, side * extrude * 0.5);
551
- }
552
- this._pInst.endContour(this._pInst.CLOSE);
553
- }
554
- this._pInst.endShape();
555
- }
556
- this._pInst._renderer._validateFaces = prevValidateFaces;
557
-
558
- // Draw sides
559
- for (const contour of contours) {
560
- this._pInst.beginShape(this._pInst.QUAD_STRIP);
561
- for (const v of contour) {
562
- for (const side of [-1, 1]) {
563
- this._pInst.vertex(v.x, v.y, side * extrude * 0.5);
564
- }
565
- }
566
- this._pInst.endShape();
527
+ const prevValidateFaces = this._pInst._renderer._validateFaces;
528
+ this._pInst._renderer._validateFaces = true;
529
+
530
+ this._pInst.beginShape();
531
+ for (const contour of contours) {
532
+ this._pInst.beginContour();
533
+ for (const pt of contour) {
534
+ this._pInst.vertex(pt.x, pt.y, 0);
567
535
  }
536
+ this._pInst.endContour(this._pInst.CLOSE);
568
537
  }
538
+
539
+ this._pInst.endShape(this._pInst.CLOSE);
540
+
541
+ this._pInst._renderer._validateFaces = prevValidateFaces;
569
542
  });
570
- if (extrude !== 0) {
571
- geom.computeNormals();
572
- for (const face of geom.faces) {
573
- if (face.every(idx => geom.vertices[idx].z <= -extrude * 0.5 + 0.1)) {
574
- for (const idx of face) geom.vertexNormals[idx].set(0, 0, -1);
575
- face.reverse();
576
- }
543
+
544
+ if (extrude === 0) {
545
+ return geom;
546
+ }
547
+
548
+ // The tessellation process creates separate vertices for each triangle,
549
+ // even when they share the same position. We need to deduplicate them
550
+ // to find which faces are actually connected, so we can identify the
551
+ // outer edges for extrusion.
552
+
553
+ const vertexIndices = {};
554
+ const vertexId = v => `${v.x.toFixed(6)}-${v.y.toFixed(6)}-${v.z.toFixed(6)}`;
555
+ const newVertices = [];
556
+ const newVertexIndex = [];
557
+
558
+ for (const v of geom.vertices) {
559
+ const id = vertexId(v);
560
+ if (!(id in vertexIndices)) {
561
+ const index = newVertices.length;
562
+ vertexIndices[id] = index;
563
+ newVertices.push(v.copy());
564
+ }
565
+ newVertexIndex.push(vertexIndices[id]);
566
+ }
567
+
568
+ // Remap faces to use deduplicated vertices
569
+ const newFaces = geom.faces.map(f => f.map(i => newVertexIndex[i]));
570
+
571
+ //Find outer edges (edges that appear in only one face)
572
+ const seen = {};
573
+ for (const face of newFaces) {
574
+ for (let off = 0; off < face.length; off++) {
575
+ const a = face[off];
576
+ const b = face[(off + 1) % face.length];
577
+ const id = `${Math.min(a, b)}-${Math.max(a, b)}`;
578
+ if (!seen[id]) seen[id] = [];
579
+ seen[id].push([a, b]);
580
+ }
581
+ }
582
+ const validEdges = [];
583
+ for (const key in seen) {
584
+ if (seen[key].length === 1) {
585
+ validEdges.push(seen[key][0]);
586
+ }
587
+ }
588
+
589
+ // Step 5: Create extruded geometry
590
+ const extruded = this._pInst.buildGeometry(() => {});
591
+ const half = extrude * 0.5;
592
+ extruded.vertices = [];
593
+ extruded.faces = [];
594
+ extruded.edges = []; // INITIALIZE EDGES ARRAY
595
+
596
+ // Add side face vertices (separate for each edge for flat shading)
597
+ for (const [a, b] of validEdges) {
598
+ const vA = newVertices[a];
599
+ const vB = newVertices[b];
600
+
601
+ // Skip if vertices are too close (degenerate edge)
602
+ // We only need to check the perimeter edge length since the other edge
603
+ // is the extrude direction, which is always > 0 for extruded geometry
604
+
605
+ const edgeVector = new Vector(vB.x - vA.x, vB.y - vA.y, vB.z - vA.z);
606
+ const extrudeVector = new Vector(0, 0, extrude);
607
+ const crossProduct = Vector.cross(edgeVector, extrudeVector);
608
+ const dist = edgeVector.mag();
609
+ if (crossProduct.mag() < 0.0001 || dist < 0.0001) continue;
610
+ // Front face vertices
611
+ const frontA = extruded.vertices.length;
612
+ extruded.vertices.push(new Vector(vA.x, vA.y, vA.z + half));
613
+ const frontB = extruded.vertices.length;
614
+ extruded.vertices.push(new Vector(vB.x, vB.y, vB.z + half));
615
+ const backA = extruded.vertices.length;
616
+ extruded.vertices.push(new Vector(vA.x, vA.y, vA.z - half));
617
+ const backB = extruded.vertices.length;
618
+ extruded.vertices.push(new Vector(vB.x, vB.y, vB.z - half));
619
+
620
+ extruded.faces.push([frontA, backA, backB]);
621
+ extruded.faces.push([frontA, backB, frontB]);
622
+ extruded.edges.push([frontA, frontB]);
623
+ extruded.edges.push([backA, backB]);
624
+ extruded.edges.push([frontA, backA]);
625
+ extruded.edges.push([frontB, backB]);
626
+ }
627
+
628
+ // Add front face (with unshared vertices for flat shading)
629
+ const frontVertexOffset = extruded.vertices.length;
630
+ for (const v of newVertices) {
631
+ extruded.vertices.push(new Vector(v.x, v.y, v.z + half));
632
+ }
633
+ for (const face of newFaces) {
634
+ if (face.length < 3) continue;
635
+ const mappedFace = face.map(i => i + frontVertexOffset);
636
+ extruded.faces.push(mappedFace);
637
+
638
+ // ADD EDGES FOR FRONT FACE
639
+ for (let i = 0; i < mappedFace.length; i++) {
640
+ const nextIndex = (i + 1) % mappedFace.length;
641
+ extruded.edges.push([mappedFace[i], mappedFace[nextIndex]]);
642
+ }
643
+ }
644
+
645
+ // Add back face (reversed winding order)
646
+ const backVertexOffset = extruded.vertices.length;
647
+ for (const v of newVertices) {
648
+ extruded.vertices.push(new Vector(v.x, v.y, v.z - half));
649
+ }
650
+
651
+ for (const face of newFaces) {
652
+ if (face.length < 3) continue;
653
+ const mappedFace = [...face].reverse().map(i => i + backVertexOffset);
654
+ extruded.faces.push(mappedFace);
655
+
656
+ // ADD EDGES FOR BACK FACE
657
+ for (let i = 0; i < mappedFace.length; i++) {
658
+ const nextIndex = (i + 1) % mappedFace.length;
659
+ extruded.edges.push([mappedFace[i], mappedFace[nextIndex]]);
577
660
  }
578
661
  }
579
- return geom;
662
+
663
+ extruded.computeNormals();
664
+ return extruded;
580
665
  }
581
666
 
582
667
  variations() {
@@ -629,25 +714,14 @@ class Font {
629
714
 
630
715
  /////////////////////////////// HELPERS ////////////////////////////////
631
716
 
632
- _verticalAlign(size) {
633
- const { sCapHeight } = this.data?.['OS/2'] || {};
634
- const { unitsPerEm = 1000 } = this.data?.head || {};
635
- const { ascender = 0, descender = 0 } = this.data?.hhea || {};
636
- const current = ascender / 2;
637
- const target = (sCapHeight || (ascender + descender)) / 2;
638
- const offset = target - current;
639
- return offset * size / unitsPerEm;
640
- }
641
-
642
717
  /*
643
718
  Returns an array of line objects, each containing { text, x, y, glyphs: [ {g, path} ] }
644
719
  */
645
720
  _lineateAndPathify(str, x, y, width, height, options = {}) {
646
721
 
647
722
  let renderer = options?.graphics?._renderer || this._pInst._renderer;
648
-
649
- // save the baseline
650
- let setBaseline = renderer.drawingContext.textBaseline;
723
+ renderer.push();
724
+ renderer.textFont(this);
651
725
 
652
726
  // lineate and compute bounds for the text
653
727
  let { lines, bounds } = renderer._computeBounds
@@ -664,8 +738,7 @@ class Font {
664
738
  const axs = this._currentAxes(renderer);
665
739
  let pathsForLine = lines.map(l => this._lineToGlyphs(l, { scale, axs }));
666
740
 
667
- // restore the baseline
668
- renderer.drawingContext.textBaseline = setBaseline;
741
+ renderer.pop();
669
742
 
670
743
  return pathsForLine;
671
744
  }
@@ -749,7 +822,7 @@ class Font {
749
822
 
750
823
  _position(renderer, lines, bounds, width, height) {
751
824
 
752
- let { textAlign, textLeading } = renderer.states;
825
+ let { textAlign, textLeading, textSize } = renderer.states;
753
826
  let metrics = this._measureTextDefault(renderer, 'X');
754
827
  let ascent = metrics.fontBoundingBoxAscent;
755
828
 
@@ -1342,7 +1415,8 @@ function font(p5, fn) {
1342
1415
  * <code>
1343
1416
  * // Some other forms of loading fonts:
1344
1417
  * loadFont("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap");
1345
- * loadFont(`@font-face { font-family: "Bricolage Grotesque", serif; font-optical-sizing: auto; font-weight: 400; font-style: normal; font-variation-settings: "wdth" 100; }`);
1418
+ *
1419
+ * loadFont('@font-face { font-family: "Bricolage Grotesque", serif; font-optical-sizing: auto; font-weight: 400; font-style: normal; font-variation-settings: "wdth" 100; }');
1346
1420
  * </code>
1347
1421
  * </div>
1348
1422
  */
@@ -1371,7 +1445,15 @@ function font(p5, fn) {
1371
1445
  let isCSS = path.includes('@font-face');
1372
1446
 
1373
1447
  if (!isCSS) {
1374
- const info = await fetch(path, { method: 'HEAD' });
1448
+ let info;
1449
+ try {
1450
+ info = await fetch(path, { method: 'HEAD' });
1451
+ } catch (e) {
1452
+ // Sometimes files fail when requested with HEAD. Fallback to a
1453
+ // regular GET. It loads more data, but at least then it's cached
1454
+ // for the likely case when we have to fetch the whole thing.
1455
+ info = await fetch(path);
1456
+ }
1375
1457
  const isCSSFile = info.headers.get('content-type')?.startsWith('text/css');
1376
1458
  if (isCSSFile) {
1377
1459
  isCSS = true;
@@ -1,8 +1,8 @@
1
- import { R as Renderer } from '../p5.Renderer-DBmMi2eT.js';
1
+ import { R as Renderer } from '../p5.Renderer-C-tu2oim.js';
2
2
  import '../creating_reading-p2iQtNm5.js';
3
3
  import 'colorjs.io/fn';
4
4
  import '../color/color_spaces/hsb.js';
5
- import '../constants-ClrEsgSR.js';
5
+ import '../constants-Bt1VTUeD.js';
6
6
  import '../image/filters.js';
7
7
  import '../math/p5.Vector.js';
8
8
  import '../shape/custom_shapes.js';
@@ -1916,23 +1916,15 @@ function textCore(p5, fn) {
1916
1916
  let boxes = lines.map((line, i) => this[type].bind(this)
1917
1917
  (line, x, y + i * textLeading));
1918
1918
 
1919
- // adjust the bounding boxes based on horiz. text alignment
1920
- if (lines.length > 1) {
1921
- // When width is not provided (e.g., fontBounds path), fall back to the widest line.
1922
- const maxWidth = boxes.reduce((m, b) => Math.max(m, b.w || 0), 0);
1923
-
1924
- boxes.forEach((bb) => {
1925
- const w = (width ?? maxWidth);
1926
- bb.x += p5.Renderer2D.prototype._xAlignOffset.call(this, textAlign, w);
1927
- });
1919
+ if (lines.length > 1 && typeof width !== 'undefined') { // fix for #7984
1920
+ // adjust the bounding boxes for horizontal text alignment in 2d
1921
+ // the WebGL mode version does additional alignment adjustments
1922
+ boxes.forEach(bb => bb.x += p5.Renderer2D.prototype._xAlignOffset.call(this, textAlign, width));
1928
1923
  }
1929
1924
 
1930
- // adjust the bounding boxes based on vert. text alignment
1931
- if (typeof height !== 'undefined') {
1932
- // Call the 2D mode version: the WebGL mode version does additional
1933
- // alignment adjustments to account for how WebGL renders text.
1934
- p5.Renderer2D.prototype._yAlignOffset.call(this, boxes, height);
1935
- }
1925
+ // adjust the bounding boxes for vertical text alignment in 2d
1926
+ // the WebGL mode version does additional alignment adjustments
1927
+ p5.Renderer2D.prototype._yAlignOffset.call(this, boxes, height || 0); // fix for #7984
1936
1928
 
1937
1929
  // get the bounds for the text block
1938
1930
  let bounds = boxes[0];
@@ -2502,6 +2494,21 @@ function textCore(p5, fn) {
2502
2494
  return this._pInst;
2503
2495
  };
2504
2496
 
2497
+ Renderer.prototype._middleAlignOffset = function() {
2498
+ const { textFont, textSize } = this.states;
2499
+ const font = textFont?.font;
2500
+ const ctx = this.textDrawingContext();
2501
+ const metrics = ctx.measureText('X');
2502
+ let sCapHeight = (font?.data || {})['OS/2']?.sCapHeight;
2503
+ if (sCapHeight) {
2504
+ const unitsPerEm = font.data.head.unitsPerEm;
2505
+ sCapHeight *= textSize / unitsPerEm;
2506
+ } else {
2507
+ sCapHeight = metrics.fontBoundingBoxAscent;
2508
+ }
2509
+ return metrics.alphabeticBaseline + sCapHeight / 2;
2510
+ };
2511
+
2505
2512
  if (p5.Renderer2D) {
2506
2513
  p5.Renderer2D.prototype.textCanvas = function () {
2507
2514
  return this.canvas;
@@ -2591,7 +2598,7 @@ function textCore(p5, fn) {
2591
2598
  case fn.BASELINE:
2592
2599
  break;
2593
2600
  case textCoreConstants._CTX_MIDDLE:
2594
- yOff = ydiff / 2;
2601
+ yOff = ydiff / 2 + this._middleAlignOffset();
2595
2602
  break;
2596
2603
  case fn.BOTTOM:
2597
2604
  yOff = ydiff;
@@ -2609,7 +2616,7 @@ function textCore(p5, fn) {
2609
2616
  }
2610
2617
 
2611
2618
  if (p5.RendererGL) {
2612
- p5.RendererGL.prototype.textCanvas = function() {
2619
+ p5.RendererGL.prototype.textCanvas = function () {
2613
2620
  if (!this._textCanvas) {
2614
2621
  this._textCanvas = document.createElement('canvas');
2615
2622
  this._textCanvas.width = 1;
@@ -2620,7 +2627,7 @@ function textCore(p5, fn) {
2620
2627
  }
2621
2628
  return this._textCanvas;
2622
2629
  };
2623
- p5.RendererGL.prototype.textDrawingContext = function() {
2630
+ p5.RendererGL.prototype.textDrawingContext = function () {
2624
2631
  if (!this._textDrawingContext) {
2625
2632
  const textCanvas = this.textCanvas();
2626
2633
  this._textDrawingContext = textCanvas.getContext('2d');
@@ -2628,7 +2635,7 @@ function textCore(p5, fn) {
2628
2635
  return this._textDrawingContext;
2629
2636
  };
2630
2637
  const oldRemove = p5.RendererGL.prototype.remove;
2631
- p5.RendererGL.prototype.remove = function() {
2638
+ p5.RendererGL.prototype.remove = function () {
2632
2639
  if (this._textCanvas) {
2633
2640
  this._textCanvas.parentElement.removeChild(this._textCanvas);
2634
2641
  }
@@ -2672,6 +2679,13 @@ function textCore(p5, fn) {
2672
2679
  return this._yAlignOffset(lineData, adjustedH);
2673
2680
  };
2674
2681
 
2682
+ p5.RendererGL.prototype._verticalAlignFont = function() {
2683
+ const ctx = this.textDrawingContext();
2684
+ const metrics = ctx.measureText('X');
2685
+ return -metrics.alphabeticBaseline ||
2686
+ (-metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent);
2687
+ };
2688
+
2675
2689
  p5.RendererGL.prototype._yAlignOffset = function (dataArr, height) {
2676
2690
 
2677
2691
  if (typeof height === 'undefined') {
@@ -2684,12 +2698,12 @@ function textCore(p5, fn) {
2684
2698
  ((textLeading - textSize) * (numLines - 1));
2685
2699
  switch (textBaseline) { // drawingContext ?
2686
2700
  case fn.TOP:
2687
- yOff = textSize;
2701
+ yOff = this._verticalAlignFont();
2688
2702
  break;
2689
2703
  case fn.BASELINE:
2690
2704
  break;
2691
2705
  case textCoreConstants._CTX_MIDDLE:
2692
- yOff = -totalHeight / 2 + textSize + (height || 0) / 2;
2706
+ yOff = (-totalHeight + textSize + (height || 0)) / 2 + this._verticalAlignFont() + this._middleAlignOffset();
2693
2707
  break;
2694
2708
  case fn.BOTTOM:
2695
2709
  yOff = -(totalHeight - textSize) + (height || 0);
@@ -2698,7 +2712,6 @@ function textCore(p5, fn) {
2698
2712
  console.warn(`${textBaseline} is not supported in WebGL mode.`); // FES?
2699
2713
  break;
2700
2714
  }
2701
- yOff += this.states.textFont.font?._verticalAlign(textSize) || 0; // Does this function exist?
2702
2715
  dataArr.forEach(ele => ele.y += yOff);
2703
2716
  return dataArr;
2704
2717
  };
@@ -1,5 +1,5 @@
1
- import '../constants-ClrEsgSR.js';
2
- export { p as default } from '../rendering-CEHgvKUS.js';
1
+ import '../constants-Bt1VTUeD.js';
2
+ export { p as default } from '../rendering-COLWmJqb.js';
3
3
  import '../math/p5.Vector.js';
4
4
  import './p5.Geometry.js';
5
5
  import '../math/p5.Matrix.js';
@@ -10,7 +10,7 @@ import '../color/color_spaces/hsb.js';
10
10
  import '../dom/p5.Element.js';
11
11
  import '../dom/p5.File.js';
12
12
  import '../io/p5.XML.js';
13
- import '../p5.Renderer-DBmMi2eT.js';
13
+ import '../p5.Renderer-C-tu2oim.js';
14
14
  import '../image/filters.js';
15
15
  import '../shape/custom_shapes.js';
16
16
  import '../core/States.js';
@@ -1,4 +1,4 @@
1
- import { r as TRIANGLE_STRIP, s as QUAD_STRIP, q as TRIANGLE_FAN, p as TRIANGLES } from '../constants-ClrEsgSR.js';
1
+ import { r as TRIANGLE_STRIP, s as QUAD_STRIP, q as TRIANGLE_FAN, p as TRIANGLES } from '../constants-Bt1VTUeD.js';
2
2
  import '../math/p5.Matrix.js';
3
3
  import { Geometry } from './p5.Geometry.js';
4
4
  import { Matrix } from '../math/Matrices/Matrix.js';
@@ -1,4 +1,4 @@
1
- import { m as PATH, Q as QUADS, s as QUAD_STRIP, r as TRIANGLE_STRIP, p as TRIANGLES, a1 as IMAGE, L as LINES, q as TRIANGLE_FAN } from '../constants-ClrEsgSR.js';
1
+ import { m as PATH, Q as QUADS, s as QUAD_STRIP, r as TRIANGLE_STRIP, p as TRIANGLES, a1 as IMAGE, L as LINES, q as TRIANGLE_FAN } from '../constants-Bt1VTUeD.js';
2
2
  import { Geometry } from './p5.Geometry.js';
3
3
  import libtess from 'libtess';
4
4
  import { Vector } from '../math/p5.Vector.js';
@@ -1,4 +1,4 @@
1
- import { r as rendererGL, p as primitives3D, l as light, m as material, c as camera, f as framebuffer, s as shader, t as texture } from '../rendering-CEHgvKUS.js';
1
+ import { r as rendererGL, p as primitives3D, l as light, m as material, c as camera, f as framebuffer, s as shader, t as texture } from '../rendering-COLWmJqb.js';
2
2
  import interaction from './interaction.js';
3
3
  import loading from './loading.js';
4
4
  import text from './text.js';
@@ -8,14 +8,14 @@ import matrix from '../math/p5.Matrix.js';
8
8
  import geometry from './p5.Geometry.js';
9
9
  import dataArray from './p5.DataArray.js';
10
10
  import strands from '../strands/p5.strands.js';
11
- import '../constants-ClrEsgSR.js';
11
+ import '../constants-Bt1VTUeD.js';
12
12
  import '../creating_reading-p2iQtNm5.js';
13
13
  import 'colorjs.io/fn';
14
14
  import '../color/color_spaces/hsb.js';
15
15
  import '../dom/p5.Element.js';
16
16
  import '../dom/p5.File.js';
17
17
  import '../io/p5.XML.js';
18
- import '../p5.Renderer-DBmMi2eT.js';
18
+ import '../p5.Renderer-C-tu2oim.js';
19
19
  import '../image/filters.js';
20
20
  import '../math/p5.Vector.js';
21
21
  import '../shape/custom_shapes.js';
@@ -60,7 +60,7 @@ import 'escodegen';
60
60
  import '../strands/ir_cfg.js';
61
61
  import '../strands/strands_codegen.js';
62
62
  import '../strands/strands_api.js';
63
- import '../ir_builders-CWOp5cp1.js';
63
+ import '../ir_builders-Cn4s8QTL.js';
64
64
  import '../strands/strands_builtins.js';
65
65
  import '../strands/strands_conditionals.js';
66
66
  import '../strands/strands_phi_utils.js';
@@ -1,4 +1,4 @@
1
- import { G as GRID, A as AXES } from '../constants-ClrEsgSR.js';
1
+ import { G as GRID, A as AXES } from '../constants-Bt1VTUeD.js';
2
2
  import { Vector } from '../math/p5.Vector.js';
3
3
 
4
4
  /**
@@ -1,13 +1,13 @@
1
- export { l as default } from '../rendering-CEHgvKUS.js';
1
+ export { l as default } from '../rendering-COLWmJqb.js';
2
2
  import '../math/p5.Vector.js';
3
3
  import '../creating_reading-p2iQtNm5.js';
4
- import '../constants-ClrEsgSR.js';
4
+ import '../constants-Bt1VTUeD.js';
5
5
  import '../dom/p5.Element.js';
6
6
  import '../dom/p5.File.js';
7
7
  import '../io/p5.XML.js';
8
8
  import 'colorjs.io/fn';
9
9
  import '../color/color_spaces/hsb.js';
10
- import '../p5.Renderer-DBmMi2eT.js';
10
+ import '../p5.Renderer-C-tu2oim.js';
11
11
  import '../image/filters.js';
12
12
  import '../shape/custom_shapes.js';
13
13
  import '../core/States.js';
@@ -1,7 +1,7 @@
1
1
  import { Geometry } from './p5.Geometry.js';
2
2
  import { Vector } from '../math/p5.Vector.js';
3
- import { a as request } from '../rendering-CEHgvKUS.js';
4
- import '../constants-ClrEsgSR.js';
3
+ import { a as request } from '../rendering-COLWmJqb.js';
4
+ import '../constants-Bt1VTUeD.js';
5
5
  import './p5.DataArray.js';
6
6
  import '../io/utilities.js';
7
7
  import 'file-saver';
@@ -11,7 +11,7 @@ import '../color/color_spaces/hsb.js';
11
11
  import '../dom/p5.Element.js';
12
12
  import '../dom/p5.File.js';
13
13
  import '../io/p5.XML.js';
14
- import '../p5.Renderer-DBmMi2eT.js';
14
+ import '../p5.Renderer-C-tu2oim.js';
15
15
  import '../image/filters.js';
16
16
  import '../shape/custom_shapes.js';
17
17
  import '../core/States.js';
@@ -1,12 +1,12 @@
1
- import '../constants-ClrEsgSR.js';
2
- export { m as default } from '../rendering-CEHgvKUS.js';
1
+ import '../constants-Bt1VTUeD.js';
2
+ export { m as default } from '../rendering-COLWmJqb.js';
3
3
  import '../creating_reading-p2iQtNm5.js';
4
4
  import '../dom/p5.Element.js';
5
5
  import '../dom/p5.File.js';
6
6
  import '../io/p5.XML.js';
7
7
  import 'colorjs.io/fn';
8
8
  import '../color/color_spaces/hsb.js';
9
- import '../p5.Renderer-DBmMi2eT.js';
9
+ import '../p5.Renderer-C-tu2oim.js';
10
10
  import '../image/filters.js';
11
11
  import '../math/p5.Vector.js';
12
12
  import '../shape/custom_shapes.js';
@@ -1,9 +1,9 @@
1
1
  import '../math/p5.Matrix.js';
2
2
  import '../math/p5.Vector.js';
3
3
  import './p5.Quat.js';
4
- export { C as Camera, c as default } from '../rendering-CEHgvKUS.js';
4
+ export { C as Camera, c as default } from '../rendering-COLWmJqb.js';
5
5
  import '../math/Matrices/Matrix.js';
6
- import '../constants-ClrEsgSR.js';
6
+ import '../constants-Bt1VTUeD.js';
7
7
  import '../math/Matrices/MatrixInterface.js';
8
8
  import '../creating_reading-p2iQtNm5.js';
9
9
  import 'colorjs.io/fn';
@@ -11,7 +11,7 @@ import '../color/color_spaces/hsb.js';
11
11
  import '../dom/p5.Element.js';
12
12
  import '../dom/p5.File.js';
13
13
  import '../io/p5.XML.js';
14
- import '../p5.Renderer-DBmMi2eT.js';
14
+ import '../p5.Renderer-C-tu2oim.js';
15
15
  import '../image/filters.js';
16
16
  import '../shape/custom_shapes.js';
17
17
  import '../core/States.js';
@@ -1,7 +1,7 @@
1
- import '../constants-ClrEsgSR.js';
1
+ import '../constants-Bt1VTUeD.js';
2
2
  import '../creating_reading-p2iQtNm5.js';
3
- export { H as Framebuffer, E as FramebufferCamera, F as FramebufferTexture, f as default } from '../rendering-CEHgvKUS.js';
4
- import '../p5.Renderer-DBmMi2eT.js';
3
+ export { H as Framebuffer, E as FramebufferCamera, F as FramebufferTexture, f as default } from '../rendering-COLWmJqb.js';
4
+ import '../p5.Renderer-C-tu2oim.js';
5
5
  import 'colorjs.io/fn';
6
6
  import '../color/color_spaces/hsb.js';
7
7
  import '../dom/p5.Element.js';
@@ -1,4 +1,4 @@
1
- import { F as FLAT, y as SMOOTH } from '../constants-ClrEsgSR.js';
1
+ import { F as FLAT, y as SMOOTH } from '../constants-Bt1VTUeD.js';
2
2
  import { DataArray } from './p5.DataArray.js';
3
3
  import { Vector } from '../math/p5.Vector.js';
4
4
  import { downloadFile } from '../io/utilities.js';
@@ -1,5 +1,5 @@
1
1
  import { Vector } from '../math/p5.Vector.js';
2
- import '../constants-ClrEsgSR.js';
2
+ import '../constants-Bt1VTUeD.js';
3
3
 
4
4
  /**
5
5
  * @module Math
@@ -1,8 +1,8 @@
1
- import '../constants-ClrEsgSR.js';
1
+ import '../constants-Bt1VTUeD.js';
2
2
  import './GeometryBuilder.js';
3
- import '../p5.Renderer-DBmMi2eT.js';
3
+ import '../p5.Renderer-C-tu2oim.js';
4
4
  import '../math/p5.Matrix.js';
5
- export { R as RendererGL, r as default, B as readPixelWebGL, A as readPixelsWebGL } from '../rendering-CEHgvKUS.js';
5
+ export { R as RendererGL, r as default, B as readPixelWebGL, A as readPixelsWebGL } from '../rendering-COLWmJqb.js';
6
6
  import '../math/p5.Vector.js';
7
7
  import './p5.RenderBuffer.js';
8
8
  import './p5.DataArray.js';
@@ -1,12 +1,12 @@
1
- export { S as Shader, s as default } from '../rendering-CEHgvKUS.js';
2
- import '../constants-ClrEsgSR.js';
1
+ export { S as Shader, s as default } from '../rendering-COLWmJqb.js';
2
+ import '../constants-Bt1VTUeD.js';
3
3
  import '../creating_reading-p2iQtNm5.js';
4
4
  import 'colorjs.io/fn';
5
5
  import '../color/color_spaces/hsb.js';
6
6
  import '../dom/p5.Element.js';
7
7
  import '../dom/p5.File.js';
8
8
  import '../io/p5.XML.js';
9
- import '../p5.Renderer-DBmMi2eT.js';
9
+ import '../p5.Renderer-C-tu2oim.js';
10
10
  import '../image/filters.js';
11
11
  import '../math/p5.Vector.js';
12
12
  import '../shape/custom_shapes.js';
@@ -1,8 +1,8 @@
1
- import '../constants-ClrEsgSR.js';
1
+ import '../constants-Bt1VTUeD.js';
2
2
  import '../dom/p5.Element.js';
3
- import '../p5.Renderer-DBmMi2eT.js';
3
+ import '../p5.Renderer-C-tu2oim.js';
4
4
  import '../dom/p5.MediaElement.js';
5
- export { M as MipmapTexture, T as Texture, D as checkWebGLCapabilities, t as default } from '../rendering-CEHgvKUS.js';
5
+ export { M as MipmapTexture, T as Texture, D as checkWebGLCapabilities, t as default } from '../rendering-COLWmJqb.js';
6
6
  import '../dom/p5.File.js';
7
7
  import '../io/p5.XML.js';
8
8
  import '../creating_reading-p2iQtNm5.js';