Top | ![]() |
![]() |
![]() |
![]() |
void chafa_calc_canvas_geometry (gint src_width
,gint src_height
,gint *dest_width_inout
,gint *dest_height_inout
,gfloat font_ratio
,gboolean zoom
,gboolean stretch
);
Calculates an optimal geometry for a ChafaCanvas given the width and height of an input image, maximum width and height of the canvas, font ratio, zoom and stretch preferences.
src_width
and src_height
must both be zero or greater.
dest_width_inout
and dest_height_inout
must point to integers
containing the maximum dimensions of the canvas in character cells.
These will be replaced by the calculated values, which may be zero if
one of the input dimensions is zero. If one or both of the input
parameters is negative, they will be treated as unspecified and
calculated based on the remaining parameters and aspect ratio.
font_ratio
is the font's width divided by its height. 0.5 is a typical
value.