(renderer)
| 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 |
no test coverage detected