vanilladocs
vanillapunch.com
API / ui/uilabel

ui/uilabel

UI 라벨.

UI label.

UILabelextends UIView

짝Counterpart: vanilla-engine UILabel

UI 라벨.

  • 표시 전용. 입력을 받지 않으므로 UIView 를 상속한다.
  • 노드에 부착되면 내부적으로 Text 와 RichText 두 컴포넌트를 모두 부착한다. (RichText 는 Text 를 상속하므로 컴포넌트 추가 순서는 Text → RichText 고정)
  • 기본 모드는 plain text. useRichText(true) 호출 시 RichText 가 활성화되어 <b> / <i> / <u> / <s> / <color=...> / <size=N> 등 마크업이 해석된다.
  • 모든 텍스트 / 폰트 / 스타일 setter 는 Text / RichText 양쪽에 동기화된다. (모드 토글 시 텍스트가 유지되도록)
  • setText 시 호스트 노드의 invalidateIntrinsicContentSize 를 자동 호출.

UI label.

  • Display only. Inherits UIView since it takes no input.
  • When attached to a node, attaches both the Text and RichText components internally. (RichText inherits Text, so the component add order is fixed as Text → RichText)
  • The default mode is plain text. Calling useRichText(true) enables RichText so that markup such as <b> / <i> / <u> / <s> / <color=...> / <size=N> is interpreted.
  • All text / font / style setters are synced to both Text / RichText. (so the text is kept when the mode toggles)
  • On setText, calls the host node's invalidateIntrinsicContentSize automatically.
예제Example외곽선 있는 여러 줄 라벨Multi-line label with an outline
import { Engine, EngineConfiguration, UIScene, UILabel, WorldNode, Pivot, Vector2, Color } from "./build/vanilla.js";

class MainScene extends UIScene {
	constructor() {
		super();
		this.setLoadingMinDurationMs(0);
	}

	initialize(engine) {
		super.initialize(engine);
		const labelNode = new WorldNode();
		labelNode.setPivot(Pivot.topLeft);
		labelNode.setAnchor(Pivot.topLeft);
		labelNode.setLocalPosition(Vector2.create(40, 40));
		labelNode.setContentSize(Vector2.create(280, 120));
		const label = labelNode.addComponent(UILabel);
		label.setFontSize(22);
		label.setTextColor(new Color(1, 0.95, 0.8, 1));
		label.setStrokeColor(new Color(0.1, 0.1, 0.15, 1));
		label.setStrokeWidth(3);
		label.setTextAlign("left");
		label.setWordWrapWidth(280);
		label.setLineSpacing(1.4);
		label.setText("A long line of text wraps inside the label width.");
		const root = this.getRoot();
		root.addChild(labelNode);
		console.log(label.getText(), label.measureText());
	}
}

const engineConfiguration = new EngineConfiguration();
engineConfiguration.canvasId = "mainCanvas";
engineConfiguration.referenceResolutionSize = Vector2.create(640, 360);
engineConfiguration.autoResizeOnWindowResize = true;
const engine = new Engine(engineConfiguration);
engine.run(new MainScene());
생성자constructorconstructor()#0.2.1 부터since 0.2.1소스source

생성.

Constructor.

짝Counterpart: vanilla-engine UILabel.new

메서드methodrequire()#0.2.1 부터since 0.2.1소스source

의존 컴포넌트, Text 가 먼저 부착되어야 RichText 가 별도 인스턴스로 추가된다. (RichText extends Text 라 순서를 뒤집으면 RichText 단일로만 잡힘)

Dependent components; Text must be attached first for RichText to be added as a separate instance. (RichText extends Text, so reversing the order catches only a single RichText)

반환ReturnsFunction[] 먼저 붙일 컴포넌트 목록. ([Text, RichText])Components to attach first. ([Text, RichText])

메서드methodattach(node)#0.2.1 부터since 0.2.1소스source

노드에 붙음. (Text / RichText 컴포넌트 참조 확보 + 활성 상태 적용)

Attached to a node. (acquires Text / RichText component references + applies the active state)

nodeComponentNode
붙을 노드.Node to attach to.
메서드methoddetach(node)#0.2.1 부터since 0.2.1소스source

노드에서 떨어짐.

Detached from a node.

nodeComponentNode
떨어질 노드.Node being detached from.
메서드methodinvalidateIntrinsicContentSize()#0.2.1 부터since 0.2.1소스source

호스트 노드에 invalidateIntrinsicContentSize 가 있으면 호출.

Calls invalidateIntrinsicContentSize if the host node has it.

메서드methodapplyActiveComponent()#0.2.1 부터since 0.2.1소스source

활성 컴포넌트 적용. (현재 모드에 맞춰 Text / RichText 의 setEnable 을 토글)

Applies the active component. (toggles setEnable of Text / RichText according to the current mode)

메서드methoduseRichText(useRichText)#0.2.1 부터since 0.2.1소스source

리치텍스트 모드 설정. true 면 RichText 컴포넌트가 활성화되어 마크업을 해석.

Sets rich text mode. If true, the RichText component is enabled and interprets markup.

useRichTextboolean
참이면 리치텍스트 모드. (true 일 때만 켠다)Rich text mode if true. (turned on only for true)

짝Counterpart: vanilla-engine UILabel.use_rich_text

예제Example마크업으로 일부만 꾸미기Style only part of the text with markup
import { Engine, EngineConfiguration, UIScene, UILabel, WorldNode, Pivot, Vector2 } from "./build/vanilla.js";

class MainScene extends UIScene {
	constructor() {
		super();
		this.setLoadingMinDurationMs(0);
	}

	initialize(engine) {
		super.initialize(engine);
		const labelNode = new WorldNode();
		labelNode.setPivot(Pivot.topLeft);
		labelNode.setAnchor(Pivot.topLeft);
		labelNode.setLocalPosition(Vector2.create(40, 40));
		labelNode.setContentSize(Vector2.create(320, 40));
		const label = labelNode.addComponent(UILabel);
		label.setFontSize(24);
		label.useRichText(true);
		label.setText("Gold <b>120</b> <color=yellow>+30</color> <size=16>bonus</size>");
		const root = this.getRoot();
		root.addChild(labelNode);
		console.log(label.isUsingRichText(), label.getText());
	}
}

const engineConfiguration = new EngineConfiguration();
engineConfiguration.canvasId = "mainCanvas";
engineConfiguration.referenceResolutionSize = Vector2.create(640, 360);
engineConfiguration.autoResizeOnWindowResize = true;
const engine = new Engine(engineConfiguration);
engine.run(new MainScene());
메서드methodisUsingRichText()#0.2.1 부터since 0.2.1소스source

리치텍스트 모드 여부 반환.

Returns whether in rich text mode.

반환Returnsboolean 리치텍스트 모드면 참.True in rich text mode.

짝Counterpart: vanilla-engine UILabel.is_using_rich_text

메서드methodsetText(text)#0.2.1 부터since 0.2.1소스source

텍스트 설정. Text 와 RichText 양쪽에 동기화 (모드 토글 시 보존).

Sets the text. Synced to both Text and RichText (preserved on mode toggle).

textstring
보일 글. (리치텍스트 모드에서는 마크업으로 읽는다)Text to show. (read as markup in rich text mode)

짝Counterpart: vanilla-engine UILabel.set_text

메서드methodgetText()#0.2.1 부터since 0.2.1소스source

텍스트 반환. (활성 컴포넌트의 plain 텍스트)

Returns the text. (plain text of the active component)

반환Returnsstring 지금 모드의 글. (노드에 붙기 전이면 빈 글)Text of the current mode. (empty before being attached to a node)

짝Counterpart: vanilla-engine UILabel.get_text

메서드methodappendSegment(text, attributes)#0.2.1 부터since 0.2.1소스source

리치텍스트 segment 1 개 추가. (RichText 컴포넌트에 직접 적용)

  • useRichText(true) 가 켜져있어야 화면에 반영된다.

Adds 1 rich text segment. (applied directly to the RichText component)

  • useRichText(true) must be on for it to show on screen.
textstring
덧붙일 글.Text to append.
attributesobject
그 조각의 서식. ({ fontFace, fontSize, textColor, strokeColor, strokeWidth, bold, italic, underline, strikethrough }, 색은 Color, 빠진 것은 라벨의 값)Format of that segment. ({ fontFace, fontSize, textColor, strokeColor, strokeWidth, bold, italic, underline, strikethrough }, colors are Color, missing ones use the label's values)

반환ReturnsUILabel 이 라벨. (이어 부를 수 있다)This label. (calls can be chained)

짝Counterpart: vanilla-engine UILabel.append_segment

예제Example서식이 다른 조각을 이어 붙이기Append segments with different formats
import { Engine, EngineConfiguration, UIScene, UILabel, WorldNode, Pivot, Vector2, Color } from "./build/vanilla.js";

class MainScene extends UIScene {
	constructor() {
		super();
		this.setLoadingMinDurationMs(0);
	}

	initialize(engine) {
		super.initialize(engine);
		const labelNode = new WorldNode();
		labelNode.setPivot(Pivot.topLeft);
		labelNode.setAnchor(Pivot.topLeft);
		labelNode.setLocalPosition(Vector2.create(40, 40));
		labelNode.setContentSize(Vector2.create(320, 40));
		const label = labelNode.addComponent(UILabel);
		label.setFontSize(22);
		label.useRichText(true);
		label.clearSegments();
		label.appendSegment("HP ", { bold: true });
		label.appendSegment("80", { textColor: new Color(1, 0.3, 0.3, 1), fontSize: 28 });
		label.appendSegment(" / 100");
		const root = this.getRoot();
		root.addChild(labelNode);
	}
}

const engineConfiguration = new EngineConfiguration();
engineConfiguration.canvasId = "mainCanvas";
engineConfiguration.referenceResolutionSize = Vector2.create(640, 360);
engineConfiguration.autoResizeOnWindowResize = true;
const engine = new Engine(engineConfiguration);
engine.run(new MainScene());
메서드methodclearSegments()#0.2.1 부터since 0.2.1소스source

리치텍스트 segment 모두 제거.

Removes all rich text segments.

짝Counterpart: vanilla-engine UILabel.clear_segments

메서드methodsetFontSize(fontSize)#0.2.1 부터since 0.2.1소스source

폰트 크기 설정.

Sets the font size.

fontSizenumber
글자 크기. (내용 크기 단위, 처음은 32)Font size. (content size units, initially 32)

짝Counterpart: vanilla-engine UILabel.set_font_size

메서드methodsetFitWidth(width, minimumRatio = 0.55)#0.4.0 부터since 0.4.0소스source

한 줄 글을 너비에 맞추기 설정. (넘치면 처음 크기에서 최소 비율까지 줄여 그린다, Text.setFitWidth)

  • 리치텍스트 모드는 맞추지 않는다. width 가 0 이하면 맞추지 않는다.

Sets fitting single-line text to a width. (if it overflows, draws it shrunk from the initial size down to the minimum ratio, Text.setFitWidth)

  • Rich text mode is not fitted. No fitting if width is 0 or less.
widthnumber
맞출 너비. (내용 크기 단위, 0 이하면 맞추지 않는다)Width to fit. (content size units, no fitting if 0 or less)
minimumRationumber
0 ~ 1, 기본 0.55.0 ~ 1, default 0.55.

짝Counterpart: vanilla-engine UILabel.set_fit_width

예제Example긴 글을 칸 너비에 맞춰 줄이기Shrink long text to fit the box width
import { Engine, EngineConfiguration, UIScene, UILabel, WorldNode, Pivot, Vector2 } from "./build/vanilla.js";

class MainScene extends UIScene {
	constructor() {
		super();
		this.setLoadingMinDurationMs(0);
	}

	initialize(engine) {
		super.initialize(engine);
		const labelNode = new WorldNode();
		labelNode.setPivot(Pivot.topLeft);
		labelNode.setAnchor(Pivot.topLeft);
		labelNode.setLocalPosition(Vector2.create(40, 40));
		labelNode.setContentSize(Vector2.create(160, 40));
		const label = labelNode.addComponent(UILabel);
		label.setFontSize(24);
		label.setText("Continue the adventure");
		label.setFitWidth(160, 0.5);
		const root = this.getRoot();
		root.addChild(labelNode);
		console.log(label.getFontSize(), label.calculateFittedFontSize());
	}
}

const engineConfiguration = new EngineConfiguration();
engineConfiguration.canvasId = "mainCanvas";
engineConfiguration.referenceResolutionSize = Vector2.create(640, 360);
engineConfiguration.autoResizeOnWindowResize = true;
const engine = new Engine(engineConfiguration);
engine.run(new MainScene());
메서드methodgetFitWidth()#0.4.0 부터since 0.4.0소스source

맞출 너비 반환. (0 이면 맞추지 않는다)

Returns the width to fit. (no fitting if 0)

반환Returnsnumber 맞출 너비. (0 이면 맞추지 않는다, 노드에 붙기 전이면 0)Width to fit. (0 means no fitting, 0 before being attached to a node)

짝Counterpart: vanilla-engine UILabel.get_fit_width

메서드methodgetFittedFontSize()#0.4.0 부터since 0.4.0소스source

그릴 때의 크기 반환. (맞춰 줄였으면 줄인 크기)

Returns the draw size. (the shrunk size if shrunk to fit)

반환Returnsnumber 그릴 때의 글자 크기. (노드에 붙기 전이면 0)Font size when drawn. (0 before being attached to a node)

짝Counterpart: vanilla-engine UILabel.get_fitted_font_size

메서드methodcalculateFittedFontSize()#0.4.0 부터since 0.4.0소스source

그릴 때의 크기를 그 자리에서 재어 반환. (Text.calculateFittedFontSize)

Measures and returns the draw size on the spot. (Text.calculateFittedFontSize)

반환Returnsnumber 지금 잰 그릴 때의 글자 크기. (노드에 붙기 전이면 0)Font size when drawn, measured now. (0 before being attached to a node)

짝Counterpart: vanilla-engine UILabel.calculate_fitted_font_size

메서드methodmeasureText(text = this.getText(), fontSize = this.getFontSize())#0.4.0 부터since 0.4.0소스source

글의 너비 재기. (이 라벨의 글꼴, 굵게, 기울임으로, 주지 않으면 지금 글과 정한 크기로, Text.measureText)

Measures the width of text. (with this label's font, bold and italic; if not given, the current text and the set size, Text.measureText)

textstring
잴 글. (주지 않으면 지금 글)Text to measure. (the current text if omitted)
fontSizenumber
글자 크기. (주지 않으면 정한 크기)Font size. (the set size if omitted)

반환Returnsnumber 글 너비. (내용 크기 단위, 글이 비었거나 노드에 붙기 전이거나 문서가 없으면 0)Text width. (content size units, 0 if the text is empty, before being attached to a node or if there is no document)

짝Counterpart: vanilla-engine UILabel.measure_text

메서드methodisDrawnInsideContent()#0.4.0 부터since 0.4.0소스source

내용 영역 안에서만 그리는지. (라벨 자신은 내용 영역에 바탕만 칠한다, 글은 Text 가 따로 알린다)

Whether it draws only inside the content area. (the label itself only fills the background in the content area; the text is reported separately by Text)

반환Returnsboolean 늘 참.Always true.

메서드methodgetFontSize()#0.2.1 부터since 0.2.1소스source

폰트 크기 반환.

Returns the font size.

반환Returnsnumber 정한 글자 크기. (노드에 붙기 전이면 0)The set font size. (0 before being attached to a node)

짝Counterpart: vanilla-engine UILabel.get_font_size

메서드methodsetWordWrapWidth(wordWrapWidth)#0.3.0 부터since 0.3.0소스source

자동 줄바꿈 폭 설정. (일반 텍스트 모드 전용, 0 이면 한 줄)

Sets the automatic word wrap width. (plain text mode only, single line if 0)

wordWrapWidthnumber
자동 줄바꿈 폭. (내용 크기 단위, 음수는 0, 0 이면 한 줄)Automatic wrap width. (content size units, negative becomes 0, a single line if 0)

짝Counterpart: vanilla-engine UILabel.set_word_wrap_width

메서드methodsetWrapMode(wrapMode)#0.3.0 부터since 0.3.0소스source

줄바꿈 방식 설정. ("word" | "char")

Sets the wrap mode. ("word" | "char")

wrapModestring
word 면 공백 단위(넘치는 단어는 글자 단위), char 면 글자 단위.word wraps at spaces (overflowing words by character), char wraps by character.

짝Counterpart: vanilla-engine UILabel.set_wrap_mode

메서드methodgetWrapMode()#0.4.0 부터since 0.4.0소스source

줄바꿈 방식 반환. ("word" | "char", 글이 없으면 "word")

Returns the wrap mode. ("word" | "char", "word" if there is no text)

반환Returnsstring 줄바꿈 방식. (word 나 char)Wrap mode. (word or char)

짝Counterpart: vanilla-engine UILabel.get_wrap_mode

메서드methodsetLineSpacing(lineSpacing)#0.3.0 부터since 0.3.0소스source

줄 간격 배율 설정.

Sets the line spacing multiplier.

lineSpacingnumber
줄 간격 배율. (글자 크기에 곱한다, 0.1 보다 작으면 0.1, 처음은 1.25)Line spacing scale. (multiplied by the font size, 0.1 if less than 0.1, initially 1.25)

짝Counterpart: vanilla-engine UILabel.set_line_spacing

메서드methodsetLetterSpacing(letterSpacing)#0.4.0 부터since 0.4.0소스source

글자 간격 설정. (Text 에 맡긴다)

Sets the letter spacing. (delegated to Text)

letterSpacingnumber
글자 묶음마다 뒤에 더하는 간격. (픽셀, 음수는 좁힘, 처음은 0)Spacing added after each grapheme cluster. (pixels, negative narrows, initially 0)

짝Counterpart: vanilla-engine UILabel.set_letter_spacing

메서드methodgetLetterSpacing()#0.4.0 부터since 0.4.0소스source

글자 간격 반환.

Returns the letter spacing.

반환Returnsnumber 글자 간격. (픽셀, 처음은 0)Letter spacing. (pixels, initially 0)

짝Counterpart: vanilla-engine UILabel.get_letter_spacing

메서드methodsetVisibleCharacterCount(visibleCharacterCount)#0.3.0 부터since 0.3.0소스source

표시 글자 수 설정. (-1 이면 전체, 타자기 연출용, 일반 텍스트 모드 전용. 글자 묶음 단위)

Sets the display character count. (-1 for all, for typewriter effects, plain text mode only. In grapheme clusters)

visibleCharacterCountnumber
표시 글자 수. (글자 묶음 단위, 내림, -1 이면 전체)Visible character count. (in grapheme clusters, floored, -1 means all)

짝Counterpart: vanilla-engine UILabel.set_visible_character_count

예제Example타자기처럼 한 글자씩 보이기Reveal one character at a time like a typewriter
import { Engine, EngineConfiguration, UIScene, UILabel, WorldNode, Pivot, Vector2 } from "./build/vanilla.js";

class MainScene extends UIScene {
	constructor() {
		super();
		this.setLoadingMinDurationMs(0);
		this.label = null;
		this.elapsedSeconds = 0;
	}

	initialize(engine) {
		super.initialize(engine);
		const labelNode = new WorldNode();
		labelNode.setPivot(Pivot.topLeft);
		labelNode.setAnchor(Pivot.topLeft);
		labelNode.setLocalPosition(Vector2.create(40, 40));
		labelNode.setContentSize(Vector2.create(400, 40));
		const label = labelNode.addComponent(UILabel);
		label.setFontSize(22);
		label.setTextAlign("left");
		label.setText("Welcome to the village.");
		label.setVisibleCharacterCount(0);
		this.label = label;
		const root = this.getRoot();
		root.addChild(labelNode);
	}

	tick(timeDelta) {
		super.tick(timeDelta);
		if (this.label !== null) {
			this.elapsedSeconds += timeDelta;
			const characterCount = Math.floor(this.elapsedSeconds * 20);
			this.label.setVisibleCharacterCount(characterCount);
		}
	}
}

const engineConfiguration = new EngineConfiguration();
engineConfiguration.canvasId = "mainCanvas";
engineConfiguration.referenceResolutionSize = Vector2.create(640, 360);
engineConfiguration.autoResizeOnWindowResize = true;
const engine = new Engine(engineConfiguration);
engine.run(new MainScene());
메서드methodgetVisibleCharacterCount()#0.4.0 부터since 0.4.0소스source

표시 글자 수 반환. (-1 이면 전체, 붙기 전이면 -1)

Returns the display character count. (-1 for all, -1 if not yet attached)

반환Returnsnumber 표시 글자 수. (-1 이면 전체)Visible character count. (everything if -1)

짝Counterpart: vanilla-engine UILabel.get_visible_character_count

메서드methodsetFont(font)#0.2.1 부터since 0.2.1소스source

폰트 설정.

Sets the font.

fontFontFace | FontAsset | null
글꼴. (FontAsset 이면 그 fontFace, null 이면 시스템 글꼴, 그 밖의 꼴은 무시한다)Font. (for a FontAsset its fontFace, the system font if null, other types are ignored)
메서드methodsetTextColor(color)#0.2.1 부터since 0.2.1소스source

텍스트 색 설정.

Sets the text color.

colorColor | string
글 색. (Color 나 "#rrggbb(aa)", "rgb(a)(...)" 글, null 이나 undefined 면 투명, 처음은 흰색)Text color. (a Color or a "#rrggbb(aa)", "rgb(a)(...)" string, transparent if null or undefined, initially white)

짝Counterpart: vanilla-engine UILabel.set_text_color

메서드methodgetTextColor()#0.2.1 부터since 0.2.1소스source

텍스트 색 반환.

Returns the text color.

반환ReturnsColor | null 글 색. (노드에 붙기 전이면 null)Text color. (null before being attached to a node)

짝Counterpart: vanilla-engine UILabel.get_text_color

메서드methodsetStrokeColor(color)#0.2.1 부터since 0.2.1소스source

텍스트 외곽선 색 설정.

Sets the text outline color.

colorColor | string
외곽선 색. (Color 나 "#rrggbb(aa)", "rgb(a)(...)" 글, null 이나 undefined 면 투명)Outline color. (a Color or a "#rrggbb(aa)", "rgb(a)(...)" string, transparent if null or undefined)

짝Counterpart: vanilla-engine UILabel.set_stroke_color

메서드methodsetStrokeWidth(width)#0.2.1 부터since 0.2.1소스source

텍스트 외곽선 두께 설정.

Sets the text outline thickness.

widthnumber
외곽선 두께. (내용 크기 단위, 0 이하면 외곽선을 그리지 않는다)Stroke width. (content size units, no stroke if 0 or less)

짝Counterpart: vanilla-engine UILabel.set_stroke_width

메서드methodsetBold(bold)#0.2.1 부터since 0.2.1소스source

볼드 설정.

Sets bold.

boldboolean
굵게 할지. (true 일 때만 굵게)Whether bold. (bold only when true)

짝Counterpart: vanilla-engine UILabel.set_bold

메서드methodisBold()#0.2.1 부터since 0.2.1소스source

볼드 반환.

Returns bold.

반환Returnsboolean 굵게면 참.True if bold.

짝Counterpart: vanilla-engine UILabel.is_bold

메서드methodsetItalic(italic)#0.2.1 부터since 0.2.1소스source

이탤릭 설정.

Sets italic.

italicboolean
기울일지. (true 일 때만 기울인다)Whether italic. (italic only when true)

짝Counterpart: vanilla-engine UILabel.set_italic

메서드methodisItalic()#0.2.1 부터since 0.2.1소스source

이탤릭 반환.

Returns italic.

반환Returnsboolean 기울임이면 참.True if italic.

짝Counterpart: vanilla-engine UILabel.is_italic

메서드methodsetUnderline(underline)#0.2.1 부터since 0.2.1소스source

밑줄 설정.

Sets underline.

underlineboolean
밑줄을 그을지. (true 일 때만 긋는다)Whether to underline. (only when true)

짝Counterpart: vanilla-engine UILabel.set_underline

메서드methodisUnderline()#0.2.1 부터since 0.2.1소스source

밑줄 반환.

Returns underline.

반환Returnsboolean 밑줄이면 참.True if underlined.

짝Counterpart: vanilla-engine UILabel.is_underline

메서드methodsetStrikethrough(strikethrough)#0.2.1 부터since 0.2.1소스source

취소선 설정.

Sets strikethrough.

strikethroughboolean
취소선을 그을지. (true 일 때만 긋는다)Whether to strike through. (only when true)

짝Counterpart: vanilla-engine UILabel.set_strikethrough

메서드methodisStrikethrough()#0.2.1 부터since 0.2.1소스source

취소선 반환.

Returns strikethrough.

반환Returnsboolean 취소선이면 참.True if struck through.

짝Counterpart: vanilla-engine UILabel.is_strikethrough

메서드methodsetTextAlign(align)#0.2.1 부터since 0.2.1소스source

가로 정렬 설정.

Sets the horizontal alignment.

align"left" | "center" | "right" | "start" | "end"
가로 정렬. ("start", "end" 는 글 방향을 따른다, 처음은 "center")Horizontal alignment. ("start" and "end" follow the text direction, initially "center")

짝Counterpart: vanilla-engine UILabel.set_text_align

메서드methodsetTextDirection(textDirection)#0.3.2 부터since 0.3.2소스source

글자 방향 설정. ("inherit" | "ltr" | "rtl" | "auto", Text.setTextDirection 과 같다)

  • 서식 조각(segment)으로 그리는 리치 텍스트는 방향과 상관없이 왼쪽에서 오른쪽으로 잇는다.

Sets the text direction. ("inherit" | "ltr" | "rtl" | "auto", same as Text.setTextDirection)

  • Rich text drawn with format pieces (segment) is joined left to right regardless of direction.
textDirection"inherit" | "ltr" | "rtl" | "auto"
글자 방향. (처음은 "inherit")Text direction. (initially "inherit")

짝Counterpart: vanilla-engine UILabel.set_text_direction

메서드methodgetTextDirection()#0.3.2 부터since 0.3.2소스source

글자 방향 반환.

Returns the text direction.

반환Returnsstring 글자 방향. (노드에 붙기 전이면 "inherit")Text direction. ("inherit" before being attached to a node)

짝Counterpart: vanilla-engine UILabel.get_text_direction

메서드methodsetTextBaseline(baseline)#0.2.1 부터since 0.2.1소스source

세로 정렬 설정.

Sets the vertical alignment.

baseline"top" | "middle" | "bottom" | "alphabetic" | "hanging" | "ideographic"
세로 정렬. (여러 줄 글은 줄 묶음의 세로 자리로 쓴다, 처음은 "middle")Vertical alignment. (for multi-line text, used as the vertical position of the line block, initially "middle")

짝Counterpart: vanilla-engine UILabel.set_text_baseline

메서드methodgetTextAlign()#0.3.0 부터since 0.3.0소스source

가로 정렬 반환.

Returns the horizontal alignment.

반환Returnsstring 가로 정렬. (노드에 붙기 전이면 "center")Horizontal alignment. ("center" before being attached to a node)

짝Counterpart: vanilla-engine UILabel.get_text_align

메서드methodgetTextBaseline()#0.3.0 부터since 0.3.0소스source

세로 정렬 반환.

Returns the vertical alignment.

반환Returnsstring 세로 정렬. (노드에 붙기 전이면 "middle")Vertical alignment. ("middle" before being attached to a node)

짝Counterpart: vanilla-engine UILabel.get_text_baseline