MCPcopy
hub / github.com/midrender/revideo / characterSize

Method characterSize

packages/2d/src/lib/components/CodeBlock.ts:154–164  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

152
153 @computed()
154 protected characterSize() {
155 this.requestFontUpdate();
156 const context = this.cacheCanvas();
157 context.save();
158 this.applyStyle(context);
159 context.font = this.styles.font;
160 const width = context.measureText('X').width;
161 context.restore();
162
163 return new Vector2(width, parseFloat(this.styles.lineHeight));
164 }
165
166 protected override desiredSize(): SerializedVector2<DesiredLength> {
167 const custom = super.desiredSize();

Callers 1

getTokensSizeMethod · 0.95

Calls 4

cacheCanvasMethod · 0.80
restoreMethod · 0.80
saveMethod · 0.65
requestFontUpdateMethod · 0.45

Tested by

no test coverage detected