Skip to content

Commit 1cd4be1

Browse files
authored
Merge branch 'dev-2.0' into improve-documentation
2 parents ed529f1 + a587220 commit 1cd4be1

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/shape/2d_primitives.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,10 @@ function primitives(p5, fn){
760760
* createCanvas(100, 100);
761761
*
762762
* background(200);
763-
*
763+
*
764+
* // Making point to 5 pixels
765+
* strokeWeight(5);
766+
*
764767
* // Top-left.
765768
* point(30, 20);
766769
*
@@ -786,6 +789,9 @@ function primitives(p5, fn){
786789
* createCanvas(100, 100);
787790
*
788791
* background(200);
792+
*
793+
* // Making point to 5 pixels.
794+
* strokeWeight(5);
789795
*
790796
* // Top-left.
791797
* point(30, 20);
@@ -816,6 +822,9 @@ function primitives(p5, fn){
816822
* createCanvas(100, 100);
817823
*
818824
* background(200);
825+
*
826+
* // Making point to 5 pixels.
827+
* strokeWeight(5);
819828
*
820829
* // Top-left.
821830
* let a = createVector(30, 20);

src/type/p5.Font.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,8 @@ function font(p5, fn) {
14511451
* <code>
14521452
* // Some other forms of loading fonts:
14531453
* loadFont("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap");
1454-
* loadFont(`@font-face { font-family: "Bricolage Grotesque", serif; font-optical-sizing: auto; font-weight: 400; font-style: normal; font-variation-settings: "wdth" 100; }`);
1454+
*
1455+
* loadFont('@font-face { font-family: "Bricolage Grotesque", serif; font-optical-sizing: auto; font-weight: 400; font-style: normal; font-variation-settings: "wdth" 100; }');
14551456
* </code>
14561457
* </div>
14571458
*/
@@ -1480,7 +1481,15 @@ function font(p5, fn) {
14801481
let isCSS = path.includes('@font-face');
14811482

14821483
if (!isCSS) {
1483-
const info = await fetch(path, { method: 'HEAD' });
1484+
let info;
1485+
try {
1486+
info = await fetch(path, { method: 'HEAD' });
1487+
} catch (e) {
1488+
// Sometimes files fail when requested with HEAD. Fallback to a
1489+
// regular GET. It loads more data, but at least then it's cached
1490+
// for the likely case when we have to fetch the whole thing.
1491+
info = await fetch(path);
1492+
}
14841493
const isCSSFile = info.headers.get('content-type')?.startsWith('text/css');
14851494
if (isCSSFile) {
14861495
isCSS = true;

0 commit comments

Comments
 (0)