@@ -360,25 +360,25 @@ class Font {
360
360
return cmdContours . map ( ( commands ) => pathToPoints ( commands , options , this ) ) ;
361
361
}
362
362
/**
363
- *
363
+ *
364
364
* Converts text into a 3D model that can be rendered in WebGL mode.
365
- *
366
- * This method transforms flat text into extruded 3D geometry, allowing
365
+ *
366
+ * This method transforms flat text into extruded 3D geometry, allowing
367
367
* for dynamic effects like depth, warping, and custom shading.
368
- *
369
- * It works by taking the outlines (contours) of each character in the
368
+ *
369
+ * It works by taking the outlines (contours) of each character in the
370
370
* provided text string and constructing a 3D shape from them.
371
- *
372
- * Once your 3D text is ready, you can rotate it in 3D space using <a href="#/p5/orbitControl">orbitControl()</a>
371
+ *
372
+ * Once your 3D text is ready, you can rotate it in 3D space using <a href="#/p5/orbitControl">orbitControl()</a>
373
373
* — just click and drag with your mouse to see it from all angles!
374
- *
375
- * Use the extrude slider to give your letters depth: slide it up, and your
374
+ *
375
+ * Use the extrude slider to give your letters depth: slide it up, and your
376
376
* flat text turns into a solid, multi-dimensional object.
377
- *
378
- * You can also choose from various fonts such as "Anton", "Montserrat", or "Source Serif",
377
+ *
378
+ * You can also choose from various fonts such as "Anton", "Montserrat", or "Source Serif",
379
379
* much like selecting fancy fonts in a word processor,
380
- *
381
- * The generated model (a Geometry object) can be manipulated further—rotated, scaled,
380
+ *
381
+ * The generated model (a Geometry object) can be manipulated further—rotated, scaled,
382
382
* or styled with shaders—to create engaging, interactive visual art.
383
383
*
384
384
* @param {String } str The text string to convert into a 3D model.
@@ -387,7 +387,7 @@ class Font {
387
387
* @param {Number } width Maximum width of the text block (wraps text if exceeded).
388
388
* @param {Number } height Maximum height of the text block.
389
389
* @param {Object } [options] Configuration options for the 3D text:
390
- * @param {Number } [options.extrude=0] The depth to extrude the text. A value of 0 produces
390
+ * @param {Number } [options.extrude=0] The depth to extrude the text. A value of 0 produces
391
391
* flat text; higher values create thicker, 3D models.
392
392
* @param {Number } [options.sampleFactor=1] A factor controlling the level of detail for the text contours.
393
393
* Higher values result in smoother curves.
@@ -419,7 +419,7 @@ class Font {
419
419
* }
420
420
* </code>
421
421
* </div>
422
- *
422
+ *
423
423
* @example
424
424
* <div modernizr='webgl'>
425
425
* <code>
@@ -428,15 +428,15 @@ class Font {
428
428
*
429
429
* async function setup() {
430
430
* createCanvas(200, 200, WEBGL);
431
- *
431
+ *
432
432
* // Alternative fonts:
433
433
* // Anton: 'https://fonts.gstatic.com/s/anton/v25/1Ptgg87LROyAm0K08i4gS7lu.ttf'
434
434
* // Montserrat: 'https://fonts.gstatic.com/s/montserrat/v29/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew-Y3tcoqK5.ttf'
435
435
* // Source Serif: 'https://fonts.gstatic.com/s/sourceserif4/v8/vEFy2_tTDB4M7-auWDN0ahZJW3IX2ih5nk3AucvUHf6OAVIJmeUDygwjihdqrhxXD-wGvjU.ttf'
436
- *
436
+ *
437
437
* // Using Source Serif for this example:
438
438
* font = await loadFont('https://fonts.gstatic.com/s/sourceserif4/v8/vEFy2_tTDB4M7-auWDN0ahZJW3IX2ih5nk3AucvUHf6OAVIJmeUDygwjihdqrhxXD-wGvjU.ttf');
439
- *
439
+ *
440
440
* geom = font.textToModel("Hello", 50, 0, { sampleFactor: 2, extrude: 5 });
441
441
* geom.clearColors();
442
442
* geom.normalize();
@@ -453,7 +453,7 @@ class Font {
453
453
* }
454
454
* </code>
455
455
* </div>
456
- *
456
+ *
457
457
* @example
458
458
* <div modernizr='webgl'>
459
459
* <code>
@@ -472,7 +472,7 @@ class Font {
472
472
* createCanvas(200, 200, WEBGL);
473
473
*
474
474
* // Using Anton as the default font for this example:
475
- *
475
+ *
476
476
* // Alternative fonts:
477
477
* // Anton: 'https://fonts.gstatic.com/s/anton/v25/1Ptgg87LROyAm0K08i4gS7lu.ttf'
478
478
* // Montserrat: 'https://fonts.gstatic.com/s/montserrat/v29/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew-Y3tcoqK5.ttf'
@@ -507,7 +507,7 @@ class Font {
507
507
* return vec4(c, 1.);
508
508
* }`
509
509
* });
510
- *
510
+ *
511
511
* lineShader = baseStrokeShader().modify({
512
512
* uniforms: {
513
513
* 'float time': () => millis(),
@@ -925,7 +925,7 @@ function createFontFace(name, path, descriptors, rawFont) {
925
925
926
926
if ( name . includes ( ' ' ) ) name = "'" + name + "'" ; // NOTE: must be single-quotes
927
927
928
- let fontArg = rawFont ?. _data ;
928
+ let fontArg = rawFont ?. _compressedData ?? rawFont ?. _data ;
929
929
if ( ! fontArg ) {
930
930
if ( ! validFontTypesRe . test ( path ) ) {
931
931
throw Error ( invalidFontError ) ;
0 commit comments