MCPcopy Create free account
hub / github.com/PerroEngine/Perro / svg_text_lines

Function svg_text_lines

perro_website/src/main.rs:260–281  ·  view source on GitHub ↗
(
    lines: &[String],
    x: i32,
    y: i32,
    size: i32,
    line_height: i32,
    class_name: &str,
)

Source from the content-addressed store, hash-verified

258 let mut current = String::new();
259 for word in text.split_whitespace() {
260 if !current.is_empty() && current.len() + word.len() + 1 > max_chars {
261 lines.push(current);
262 current = String::new();
263 if lines.len() == max_lines {
264 break;
265 }
266 }
267 if !current.is_empty() {
268 current.push(' ');
269 }
270 current.push_str(word);
271 }
272 if !current.is_empty() && lines.len() < max_lines {
273 lines.push(current);
274 }
275 lines
276}
277
278#[cfg(feature = "ssr")]
279fn svg_text_lines(
280 lines: &[String],
281 x: i32,
282 y: i32,
283 size: i32,
284 line_height: i32,

Callers 1

social_svgFunction · 0.85

Calls 2

joinMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected