Skip to content

Commit b0ef057

Browse files
committed
Move usage examples into norender example
1 parent 3c688ca commit b0ef057

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

src/type/p5.Font.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -833,22 +833,7 @@ function font(p5, fn) {
833833
* In 2D mode, `path` can take on a few other forms. It could be a path to a CSS file,
834834
* such as one from <a href="https://fonts.google.com/">Google Fonts.</a> It could also
835835
* be a string with a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face">CSS `@font-face` declaration.</a> It can also be an object containing key-value pairs with
836-
* properties that you would find in an `@font-face` block:
837-
*
838-
* ```js
839-
* loadFont("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap");
840-
* loadFont(`@font-face { font-family: "Bricolage Grotesque", serif; font-optical-sizing: auto; font-weight: 400; font-style: normal; font-variation-settings: "wdth" 100; }`);
841-
* loadFont({
842-
* fontFamily: '"Bricolage Grotesque", serif',
843-
* fontOpticalSizing: 'auto',
844-
* fontWeight: 400,
845-
* fontStyle: 'normal',
846-
* fontVariationSettings: '"wdth" 100',
847-
* });
848-
* loadFont("https://fonts.gstatic.com/s/inter/v18/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfMZhrib2Bg-4.ttf");
849-
* loadFont("path/to/localFont.ttf");
850-
* loadFont("system-font-name");
851-
* ```
836+
* properties that you would find in an `@font-face` block.
852837
*
853838
* The second parameter, `successCallback`, is optional. If a function is
854839
* passed, it will be called once the font has loaded. The callback function
@@ -947,6 +932,23 @@ function font(p5, fn) {
947932
* }
948933
* </code>
949934
* </div>
935+
*
936+
* @example
937+
* <div class="norender">
938+
* <code>
939+
* // Some other forms of loading fonts:
940+
* loadFont("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap");
941+
* loadFont(`@font-face { font-family: "Bricolage Grotesque", serif; font-optical-sizing: auto; font-weight: 400; font-style: normal; font-variation-settings: "wdth" 100; }`);
942+
* loadFont({
943+
* fontFamily: '"Bricolage Grotesque", serif',
944+
* fontOpticalSizing: 'auto',
945+
* fontWeight: 400,
946+
* fontStyle: 'normal',
947+
* fontVariationSettings: '"wdth" 100',
948+
* });
949+
* ```
950+
* </code>
951+
* </div>
950952
*/
951953
/**
952954
* @method loadFont

0 commit comments

Comments
 (0)