MCPcopy Index your code
hub / github.com/processing/p5.js / text

Function text

src/webgl/text.js:7–835  ·  view source on GitHub ↗
(p5, fn)

Source from the content-addressed store, hash-verified

5import { Font, arrayCommandsToObjects } from '../type/p5.Font';
6
7function text(p5, fn) {
8 Renderer3D.prototype.maxCachedGlyphs = function() {
9 // TODO: use more than vibes to find a good value for this
10 return 200;
11 };
12
13 Font.prototype._getFontInfo = function(axs) {
14 // For WebGL, a cache of font data to use on the GPU.
15 this._fontInfos = this._fontInfos || {};
16
17 const key = JSON.stringify(axs);
18 if (this._fontInfos[key]) {
19 const val = this._fontInfos[key];
20 return val;
21 } else {
22 const val = new FontInfo(this, { axs });
23 this._fontInfos[key] = val;
24 return val;
25 }
26 };
27
28 // rendering constants
29
30 // the number of rows/columns dividing each glyph
31 const charGridWidth = 9;
32 const charGridHeight = charGridWidth;
33
34 // size of the image holding the bezier stroke info
35 const strokeImageWidth = 64;
36 const strokeImageHeight = 64;
37
38 // size of the image holding the stroke indices for each row/col
39 const gridImageWidth = 64;
40 const gridImageHeight = 64;
41
42 // size of the image holding the offset/length of each row/col stripe
43 const cellImageWidth = 64;
44 const cellImageHeight = 64;
45
46 /**
47 * @private
48 * @class ImageInfos
49 * @param {Integer} width
50 * @param {Integer} height
51 *
52 * the ImageInfos class holds a list of ImageDatas of a given size.
53 */
54 class ImageInfos {
55 constructor(width, height) {
56 this.width = width;
57 this.height = height;
58 this.infos = []; // the list of images
59 }
60 /**
61 *
62 * @param {Integer} space
63 * @return {Object} contains the ImageData, and pixel index into that
64 * ImageData where the free space was allocated.

Callers 15

greetFunction · 0.85
drawFunction · 0.85
setupFunction · 0.85
pickLineFunction · 0.85
pickLineFunction · 0.85
setupFunction · 0.85
displayWeatherFunction · 0.85
pickLineFunction · 0.85
drawFunction · 0.85
drawFunction · 0.85
drawFunction · 0.85
drawFunction · 0.85

Calls 15

hasGlyphDataMethod · 0.80
_currentAxesMethod · 0.80
bindShaderMethod · 0.80
setUniformMethod · 0.80
_setGlobalUniformsMethod · 0.80
getGeometryByIDMethod · 0.80
computeNormalsMethod · 0.80
computeFacesMethod · 0.80
ensureCachedMethod · 0.80
_positionGlyphsMethod · 0.80
getGlyphInfoMethod · 0.80
deleteMethod · 0.80

Tested by

no test coverage detected