vanilladocs
vanillapunch.com
API / core/graphic/textstringtexturecache

core/graphic/textstringtexturecache

Graphic 없이 글 재기. (measureTextMetrics 와 같다, 러스트 판 measure_text_without_graphic 과 같은 이름. 문서가 없으면 null)

Measures text without a Graphic. (same as measureTextMetrics, same name as measure_text_without_graphic in the Rust version. null if there is no document)

예제ExampleGraphic 없이 글 너비 재기Measure text width without Graphic
import { measureTextWithoutGraphic } from "./build/vanilla.js";

const textMetrics = measureTextWithoutGraphic("bold 16px sans-serif", "Hello");
if (textMetrics !== null) {
	console.log(textMetrics.width);
}

함수Functions

함수functionmeasureTextWithoutGraphic(fontString, text)#0.4.0 부터since 0.4.0소스source

Graphic 없이 글 재기. (measureTextMetrics 와 같다, 러스트 판 measure_text_without_graphic 과 같은 이름. 문서가 없으면 null)

Measures text without a Graphic. (same as measureTextMetrics, same name as measure_text_without_graphic in the Rust version. null if there is no document)

fontStringstring
CSS 글꼴 글. (예: "bold 16px sans-serif")CSS font string. (e.g. "bold 16px sans-serif")
textstring
잴 글.Text to measure.

반환ReturnsTextMetrics | null 글의 치수. (캐시가 나눠 쓰므로 고치지 않는다, 문서가 없으면 null)Text metrics. (shared by the cache so do not modify, null if there is no document)

짝Counterpart: vanilla-engine measure_text_without_graphic