Skip to content

Commit

Permalink
update story description max lines
Browse files Browse the repository at this point in the history
  • Loading branch information
zignis committed Apr 13, 2024
1 parent 2b8edd9 commit d3c59e6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 1 deletion.
Binary file added .DS_Store
Binary file not shown.
Binary file added fonts/.DS_Store
Binary file not shown.
Binary file added src/.DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion src/routes/stories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ async fn generate_story_open_graph_image(
let comment_count = abbrev_num(response.comment_count as isize, None).unwrap_or_default();

let mut title_offset = "0";
let mut max_description_lines = 3;

let title = {
let title_lines = wrap_text(&process_text(&response.title), 920, Some(2), |text| {
Expand All @@ -131,6 +132,7 @@ async fn generate_story_open_graph_image(

if title_lines.len() == 1 {
title_offset = "-60";
max_description_lines = 4;
}

title_lines
Expand All @@ -155,7 +157,7 @@ async fn generate_story_open_graph_image(
wrap_text(
&process_text(value.as_str()),
if splash_url.is_some() { 430 } else { 760 },
Some(3),
Some(max_description_lines),
|text| get_text_width(&SATOSHI_REGULAR, 30.0, text) as usize,
)
.iter()
Expand Down

0 comments on commit d3c59e6

Please sign in to comment.