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

Method _currentAxes

src/type/p5.Font.js:748–774  ·  view source on GitHub ↗
(renderer)

Source from the content-addressed store, hash-verified

746 }
747
748 _currentAxes(renderer) {
749 let axs;
750 if ((this.data?.fvar?.length ?? 0) > 0) {
751 const fontAxes = this.data.fvar[0];
752 axs = fontAxes.map(([tag, minVal, defaultVal, maxVal, flags, name]) => {
753 if (!renderer) return defaultVal;
754 if (tag === 'wght') {
755 return renderer.states.fontWeight;
756 } else if (tag === 'wdth') {
757 // TODO: map from keywords (normal, ultra-condensed, etc) to values
758 // return renderer.states.fontStretch
759 return 100;
760 } else if (renderer.textCanvas().style.fontVariationSettings) {
761 const match = new RegExp(`\\b${tag}\s+(\d+)`)
762 .exec(renderer.textCanvas().style.fontVariationSettings);
763 if (match) {
764 return parseInt(match[1]);
765 } else {
766 return defaultVal;
767 }
768 } else {
769 return defaultVal;
770 }
771 });
772 }
773 return axs;
774 }
775
776 _textToPathPoints(str, x, y, width, height, options) {
777

Callers 3

_lineateAndPathifyMethod · 0.95
_positionGlyphsMethod · 0.95
textFunction · 0.80

Calls 1

textCanvasMethod · 0.45

Tested by

no test coverage detected