fix: width should not be linked to width

This commit is contained in:
KyleUltimate 2025-04-29 20:56:10 +08:00
parent 8f40a8295b
commit 14d2edfeb5

View File

@ -172,14 +172,6 @@ impl ExportRenderer {
let width = (self.dimensions.columns as f64 * FONT_SIZE as f64 * FONT_SIZE_WIDTH).ceil(); let width = (self.dimensions.columns as f64 * FONT_SIZE as f64 * FONT_SIZE_WIDTH).ceil();
let height = self.dimensions.rows * LINE_HEIGHT; let height = self.dimensions.rows * LINE_HEIGHT;
let background_color = self.background_color.unwrap_or_else(|| "black".into()); let background_color = self.background_color.unwrap_or_else(|| "black".into());
let css_container_width = match self.output_format {
OutputFormat::Pdf => format!("{width}px"),
OutputFormat::Html => "100vw".to_string(),
};
let css_container_height = match self.output_format {
OutputFormat::Pdf => format!("{height}px"),
OutputFormat::Html => "100vh".to_string(),
};
let css = format!( let css = format!(
r" r"
pre {{ pre {{
@ -195,10 +187,9 @@ impl ExportRenderer {
margin: 0; margin: 0;
font-size: {FONT_SIZE}px; font-size: {FONT_SIZE}px;
line-height: {LINE_HEIGHT}px; line-height: {LINE_HEIGHT}px;
width: {css_container_width}; width: {width}px;
height: {css_container_height}; height: {height}px;
overflow: hidden; transform-origin: top left;
transform-origin: top center;
background-color: {background_color}; background-color: {background_color};
}} }}