Handle wrap around when using negative values for adjust cell sizes
This commit is contained in:
parent
1a3fdac4e4
commit
c19cbaad24
@ -393,11 +393,15 @@ calc_cell_metrics(FontGroup *fg) {
|
|||||||
cell_metrics(fg->fonts[fg->medium_font_idx].face, &cell_width, &cell_height, &baseline, &underline_position, &underline_thickness);
|
cell_metrics(fg->fonts[fg->medium_font_idx].face, &cell_width, &cell_height, &baseline, &underline_position, &underline_thickness);
|
||||||
if (!cell_width) fatal("Failed to calculate cell width for the specified font");
|
if (!cell_width) fatal("Failed to calculate cell width for the specified font");
|
||||||
unsigned int before_cell_height = cell_height;
|
unsigned int before_cell_height = cell_height;
|
||||||
if (OPT(adjust_line_height_px) != 0) cell_height += OPT(adjust_line_height_px);
|
int cw = cell_width, ch = cell_height;
|
||||||
if (OPT(adjust_line_height_frac) != 0.f) cell_height *= OPT(adjust_line_height_frac);
|
if (OPT(adjust_line_height_px) != 0) ch += OPT(adjust_line_height_px);
|
||||||
if (OPT(adjust_column_width_px != 0)) cell_width += OPT(adjust_column_width_px);
|
if (OPT(adjust_line_height_frac) != 0.f) ch *= OPT(adjust_line_height_frac);
|
||||||
if (OPT(adjust_column_width_frac) != 0.f) cell_width *= OPT(adjust_column_width_frac);
|
if (OPT(adjust_column_width_px != 0)) cw += OPT(adjust_column_width_px);
|
||||||
cell_width = MAX(2, cell_width);
|
if (OPT(adjust_column_width_frac) != 0.f) cw *= OPT(adjust_column_width_frac);
|
||||||
|
if (cw >= 2 && cw < 1000) cell_width = cw;
|
||||||
|
else log_error("Cell width invalid after adjustment, ignoring adjust_column_width");
|
||||||
|
if (ch >= 4 && ch < 1000) cell_height = ch;
|
||||||
|
else log_error("Cell height invalid after adjustment, ignoring adjust_line_height");
|
||||||
int line_height_adjustment = cell_height - before_cell_height;
|
int line_height_adjustment = cell_height - before_cell_height;
|
||||||
if (cell_height < 4) fatal("Line height too small after adjustment");
|
if (cell_height < 4) fatal("Line height too small after adjustment");
|
||||||
if (cell_height > 1000) fatal("Line height too large after adjustment");
|
if (cell_height > 1000) fatal("Line height too large after adjustment");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user