Improve readable text surfaces

This commit is contained in:
2026-06-20 16:59:26 +09:00
parent c5ee403fef
commit 11242cded7
5 changed files with 182 additions and 71 deletions

View File

@@ -705,8 +705,8 @@ func _check_text_fit_contract(scene, failures: Array[String]) -> void:
var dialogue_area: Vector2 = scene.dialogue_text_label.custom_minimum_size
if dialogue_area.x <= 0.0 or dialogue_area.y <= 0.0:
dialogue_area = Vector2(666.0, 144.0)
var short_dialogue_size := int(scene._fit_font_size_for_text("군령을 전하라.", 17, 14, dialogue_area))
if short_dialogue_size != 17:
var short_dialogue_size := int(scene._fit_font_size_for_text("군령을 전하라.", scene.DIALOGUE_TEXT_FONT_SIZE, scene.DIALOGUE_TEXT_MIN_FONT_SIZE, dialogue_area))
if short_dialogue_size != scene.DIALOGUE_TEXT_FONT_SIZE:
failures.append("short dialogue text should keep the base font size, got %d" % short_dialogue_size)
var long_dialogue := "" \
+ "서영의 매복은 아직 끝나지 않았다. 숲 뒤 봉쇄병이 동쪽 길목을 닫기 전에 전열을 유지하고, 부상병을 마을로 물려 회복시킨 뒤 다시 밀어붙여라. " \
@@ -714,8 +714,8 @@ func _check_text_fit_contract(scene, failures: Array[String]) -> void:
+ "마지막 봉쇄병이 모습을 드러내면 조급히 흩어지지 말고, 마을과 성채의 회복지를 번갈아 쓰며 전열을 앞으로 밀어라. " \
+ "적이 다시 숲을 흔들어도 군령은 하나다. 길목을 열고 남은 병력을 정리한 뒤 추격로를 확보하라. " \
+ "북쪽 비탈과 남쪽 수풀을 동시에 살피고, 어느 한 장수가 고립되지 않도록 서로의 이동 거리를 맞추어라.」"
var fitted_dialogue_size := int(scene._fit_font_size_for_text(long_dialogue, 17, 14, dialogue_area))
if fitted_dialogue_size < 14 or fitted_dialogue_size > 17:
var fitted_dialogue_size := int(scene._fit_font_size_for_text(long_dialogue, scene.DIALOGUE_TEXT_FONT_SIZE, scene.DIALOGUE_TEXT_MIN_FONT_SIZE, dialogue_area))
if fitted_dialogue_size < scene.DIALOGUE_TEXT_MIN_FONT_SIZE or fitted_dialogue_size > scene.DIALOGUE_TEXT_FONT_SIZE:
failures.append("long dialogue font fit should stay inside its configured bounds")
var fitted_dialogue_height := float(scene._estimated_wrapped_text_height(long_dialogue, dialogue_area.x, fitted_dialogue_size))
if fitted_dialogue_height > dialogue_area.y:
@@ -723,8 +723,8 @@ func _check_text_fit_contract(scene, failures: Array[String]) -> void:
var objective_area := Vector2(500.0, 104.0)
var long_objective := "승리: 서영의 후군을 꺾었다. 동쪽 길목을 장악하고 뒤따르는 봉쇄병까지 정리하라.\n패배: 조조가 퇴각하거나 제17턴이 시작되면 패한다.\n보상: 군자금 700냥, 콩, 술, 철검"
var fitted_objective_size := int(scene._fit_font_size_for_text(long_objective, 15, 12, objective_area))
if fitted_objective_size < 12 or fitted_objective_size > 15:
var fitted_objective_size := int(scene._fit_font_size_for_text(long_objective, scene.BRIEFING_OBJECTIVE_FONT_SIZE, scene.BRIEFING_OBJECTIVE_MIN_FONT_SIZE, objective_area))
if fitted_objective_size < scene.BRIEFING_OBJECTIVE_MIN_FONT_SIZE or fitted_objective_size > scene.BRIEFING_OBJECTIVE_FONT_SIZE:
failures.append("briefing objective font fit should stay inside its configured bounds")
var fitted_objective_height := float(scene._estimated_wrapped_text_height(long_objective, objective_area.x, fitted_objective_size))
if fitted_objective_height > objective_area.y: