package gui

import "core:fmt"

fit_text_for_width :: proc(text: string, width_px, px_per_char: int) -> string {
	if px_per_char <= 0 {
		return text
	}
	max_chars := width_px / px_per_char
	if max_chars < 4 {
		max_chars = 4
	}
	if len(text) <= max_chars {
		return text
	}
	return fmt.tprintf("%s…", text[:max_chars-1])
}