[A] Added top and bottom margin

This commit is contained in:
seleznevae
2018-03-25 11:11:08 +03:00
parent 8fd57267e9
commit 52c100bdf9
16 changed files with 340 additions and 157 deletions

View File

@@ -47,13 +47,13 @@ int hint_width_cell(const fort_cell_t *cell, const context_t *context)
assert(cell);
assert(context);
int cell_padding_left = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_LEFT_PADDING);
int cell_padding_right = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_RIGHT_PADDING);
int cell_padding_left = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_LEFT_PADDING);
int cell_padding_right = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_RIGHT_PADDING);
int result = cell_padding_left + cell_padding_right;
if (cell->str_buffer && cell->str_buffer->str.data) {
result += buffer_text_width(cell->str_buffer);
}
result = MAX(result, get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_MIN_WIDTH));
result = MAX(result, get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_MIN_WIDTH));
return result;
}
@@ -61,9 +61,9 @@ int hint_height_cell(const fort_cell_t *cell, const context_t *context)
{
assert(cell);
assert(context);
int cell_padding_top = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_TOP_PADDING);
int cell_padding_bottom = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_BOTTOM_PADDING);
int cell_empty_string_height = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_EMPTY_STR_HEIGHT);
int cell_padding_top = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_TOP_PADDING);
int cell_padding_bottom = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_BOTTOM_PADDING);
int cell_empty_string_height = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_EMPTY_STR_HEIGHT);
int result = cell_padding_top + cell_padding_bottom;
if (cell->str_buffer && cell->str_buffer->str.data) {
size_t text_height = buffer_text_height(cell->str_buffer);
@@ -107,9 +107,9 @@ int cell_printf(fort_cell_t *cell, size_t row, size_t column, char *buf, size_t
return -1;
}
int cell_padding_top = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_TOP_PADDING);
int cell_padding_left = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_LEFT_PADDING);
int cell_padding_right = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_RIGHT_PADDING);
int cell_padding_top = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_TOP_PADDING);
int cell_padding_left = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_LEFT_PADDING);
int cell_padding_right = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_RIGHT_PADDING);
if (row >= hint_height_cell(cell, context)
|| row < cell_padding_top
@@ -145,9 +145,9 @@ int cell_wprintf(fort_cell_t *cell, size_t row, size_t column, wchar_t *buf, siz
return -1;
}
int cell_padding_top = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_TOP_PADDING);
int cell_padding_left = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_LEFT_PADDING);
int cell_padding_right = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_RIGHT_PADDING);
int cell_padding_top = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_TOP_PADDING);
int cell_padding_left = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_LEFT_PADDING);
int cell_padding_right = get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_RIGHT_PADDING);
if (row >= hint_height_cell(cell, context)
|| row < cell_padding_top

View File

@@ -441,6 +441,8 @@ const char* ft_to_string(const FTABLE *FT_RESTRICT table)
typedef char char_type;
const char_type *empty_string = "";
const enum str_buf_type buf_type = CharBuf;
char space_char = ' ';
char new_line_char = '\n';
#define cur_F_STRDUP F_STRDUP
int (*snprintf_row_)(const fort_row_t *, char *, size_t, size_t *, size_t, size_t, const context_t *) = snprintf_row;
int (*print_row_separator_)(char *, size_t ,
@@ -448,6 +450,7 @@ const char* ft_to_string(const FTABLE *FT_RESTRICT table)
const fort_row_t *, const fort_row_t *,
enum HorSeparatorPos , const separator_t *,
const context_t *) = print_row_separator;
int (*snprint_n_chars_)(char *, size_t , size_t , char) = snprint_n_chars;
assert(table);
/* Determing size of table string representation */
@@ -487,13 +490,20 @@ const char* ft_to_string(const FTABLE *FT_RESTRICT table)
int dev = 0;
int k = 0;
size_t i = 0;
context_t context;
context.table_options = (table->options ? table->options : &g_table_options);
fort_row_t *prev_row = NULL;
fort_row_t *cur_row = NULL;
separator_t *cur_sep = NULL;
size_t sep_size = vector_size(table->separators);
size_t i = 0;
/* Print top margin */
for (i = 0; i < context.table_options->entire_table_options.top_margin; ++i) {
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, sz - dev, width - 1/* minus new_line*/, space_char));
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, sz - dev, 1, new_line_char));
}
for (i = 0; i < rows; ++i) {
cur_sep = (i < sep_size) ? (*(separator_t **)vector_at(table->separators, i)) : NULL;
cur_row = *(fort_row_t**)vector_at(table->rows, i);
@@ -507,6 +517,12 @@ const char* ft_to_string(const FTABLE *FT_RESTRICT table)
cur_sep = (i < sep_size) ? (*(separator_t **)vector_at(table->separators, i)) : NULL;
CHECK_RESULT_AND_MOVE_DEV(print_row_separator_(buffer + dev, sz - dev, col_width_arr, cols, prev_row, cur_row, BottomSeparator, cur_sep, &context));
/* Print bottom margin */
for (i = 0; i < context.table_options->entire_table_options.bottom_margin; ++i) {
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, sz - dev, width - 1/* minus new_line*/, space_char));
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, sz - dev, 1, new_line_char));
}
F_FREE(col_width_arr);
F_FREE(row_height_arr);
@@ -535,6 +551,8 @@ const wchar_t* ft_to_wstring(const FTABLE *FT_RESTRICT table)
typedef wchar_t char_type;
const char_type *empty_string = L"";
const enum str_buf_type buf_type = WCharBuf;
wchar_t space_char = L' ';
wchar_t new_line_char = L'\n';
#define cur_F_STRDUP F_WCSDUP
int (*snprintf_row_)(const fort_row_t *, wchar_t *, size_t, size_t *, size_t, size_t, const context_t *) = wsnprintf_row;
int (*print_row_separator_)(wchar_t *, size_t ,
@@ -542,6 +560,8 @@ const wchar_t* ft_to_wstring(const FTABLE *FT_RESTRICT table)
const fort_row_t *, const fort_row_t *,
enum HorSeparatorPos , const separator_t *,
const context_t *) = wprint_row_separator;
int (*snprint_n_chars_)(wchar_t *, size_t , size_t , wchar_t) = wsnprint_n_chars;
assert(table);
/* Determing size of table string representation */
@@ -581,13 +601,20 @@ const wchar_t* ft_to_wstring(const FTABLE *FT_RESTRICT table)
int dev = 0;
int k = 0;
size_t i = 0;
context_t context;
context.table_options = (table->options ? table->options : &g_table_options);
fort_row_t *prev_row = NULL;
fort_row_t *cur_row = NULL;
separator_t *cur_sep = NULL;
size_t sep_size = vector_size(table->separators);
size_t i = 0;
/* Print top margin */
for (i = 0; i < context.table_options->entire_table_options.top_margin; ++i) {
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, sz - dev, width - 1/* minus new_line*/, space_char));
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, sz - dev, 1, new_line_char));
}
for (i = 0; i < rows; ++i) {
cur_sep = (i < sep_size) ? (*(separator_t **)vector_at(table->separators, i)) : NULL;
cur_row = *(fort_row_t**)vector_at(table->rows, i);
@@ -601,6 +628,11 @@ const wchar_t* ft_to_wstring(const FTABLE *FT_RESTRICT table)
cur_sep = (i < sep_size) ? (*(separator_t **)vector_at(table->separators, i)) : NULL;
CHECK_RESULT_AND_MOVE_DEV(print_row_separator_(buffer + dev, sz - dev, col_width_arr, cols, prev_row, cur_row, BottomSeparator, cur_sep, &context));
/* Print bottom margin */
for (i = 0; i < context.table_options->entire_table_options.bottom_margin; ++i) {
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, sz - dev, width - 1/* minus new_line*/, space_char));
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, sz - dev, 1, new_line_char));
}
F_FREE(col_width_arr);
F_FREE(row_height_arr);
@@ -770,7 +802,7 @@ int ft_set_border_style(FTABLE *table, struct ft_border_style *style)
int ft_set_option(FTABLE *table, unsigned row, unsigned col, uint32_t option, int value)
int ft_set_cell_option(FTABLE *table, unsigned row, unsigned col, uint32_t option, int value)
{
assert(table);
@@ -788,9 +820,25 @@ int ft_set_option(FTABLE *table, unsigned row, unsigned col, uint32_t option, in
return set_cell_option(table->options->cell_options, row, col, option, value);
}
int ft_set_default_option(uint32_t option, int value)
int ft_set_default_cell_option(uint32_t option, int value)
{
return set_default_cell_option(option, value);
}
FT_EXTERN int ft_set_default_tbl_option(uint32_t option, int value)
{
return set_default_entire_table_option(option, value);
}
FT_EXTERN int ft_set_tbl_option(FTABLE * FT_RESTRICT table, uint32_t option, int value)
{
assert(table);
if (table->options == NULL) {
table->options = create_table_options();
if (table->options == NULL)
return FT_MEMORY_ERROR;
}
return set_entire_table_option(table->options, option, value);
}

View File

@@ -64,6 +64,7 @@ typedef int fort_status_t;
#define FT_SUCCESS 0
#define FT_MEMORY_ERROR -1
#define FT_ERROR -2
#define FT_EINVAL -3
#define IS_SUCCESS(arg) ((arg) >= 0)
#define IS_ERROR(arg) ((arg) < 0)

View File

@@ -13,9 +13,9 @@ struct fort_cell_options g_default_cell_option =
FT_ANY_COLUMN, /* cell_col */
/* options */
FT_OPT_MIN_WIDTH | FT_OPT_TEXT_ALIGN | FT_OPT_TOP_PADDING
| FT_OPT_BOTTOM_PADDING | FT_OPT_LEFT_PADDING | FT_OPT_RIGHT_PADDING
| FT_OPT_EMPTY_STR_HEIGHT ,
FT_COPT_MIN_WIDTH | FT_COPT_TEXT_ALIGN | FT_COPT_TOP_PADDING
| FT_COPT_BOTTOM_PADDING | FT_COPT_LEFT_PADDING | FT_COPT_RIGHT_PADDING
| FT_COPT_EMPTY_STR_HEIGHT ,
0, /* col_min_width */
RightAligned, /* align */
@@ -35,21 +35,21 @@ static int get_option_value_if_exists_otherwise_default(const struct fort_cell_o
}
switch (option) {
case FT_OPT_MIN_WIDTH:
case FT_COPT_MIN_WIDTH:
return cell_opts->col_min_width;
case FT_OPT_TEXT_ALIGN:
case FT_COPT_TEXT_ALIGN:
return cell_opts->align;
case FT_OPT_TOP_PADDING:
case FT_COPT_TOP_PADDING:
return cell_opts->cell_padding_top;
case FT_OPT_BOTTOM_PADDING:
case FT_COPT_BOTTOM_PADDING:
return cell_opts->cell_padding_bottom;
case FT_OPT_LEFT_PADDING:
case FT_COPT_LEFT_PADDING:
return cell_opts->cell_padding_left;
case FT_OPT_RIGHT_PADDING:
case FT_COPT_RIGHT_PADDING:
return cell_opts->cell_padding_right;
case FT_OPT_EMPTY_STR_HEIGHT:
case FT_COPT_EMPTY_STR_HEIGHT:
return cell_opts->cell_empty_string_height;
case FT_OPT_ROW_TYPE:
case FT_COPT_ROW_TYPE:
return cell_opts->row_type;
default:
/* todo: implement later */
@@ -157,21 +157,21 @@ static fort_status_t set_cell_option_impl(fort_cell_options_t *opt, uint32_t opt
assert(opt);
OPTION_SET(opt->options, option);
if (OPTION_IS_SET(option, FT_OPT_MIN_WIDTH)) {
if (OPTION_IS_SET(option, FT_COPT_MIN_WIDTH)) {
opt->col_min_width = value;
} else if (OPTION_IS_SET(option, FT_OPT_TEXT_ALIGN)) {
} else if (OPTION_IS_SET(option, FT_COPT_TEXT_ALIGN)) {
opt->align = (enum TextAlignment)value;
} else if (OPTION_IS_SET(option, FT_OPT_TOP_PADDING)) {
} else if (OPTION_IS_SET(option, FT_COPT_TOP_PADDING)) {
opt->cell_padding_top = value;
} else if (OPTION_IS_SET(option, FT_OPT_BOTTOM_PADDING)) {
} else if (OPTION_IS_SET(option, FT_COPT_BOTTOM_PADDING)) {
opt->cell_padding_bottom = value;
} else if (OPTION_IS_SET(option, FT_OPT_LEFT_PADDING)) {
} else if (OPTION_IS_SET(option, FT_COPT_LEFT_PADDING)) {
opt->cell_padding_left = value;
} else if (OPTION_IS_SET(option, FT_OPT_RIGHT_PADDING)) {
} else if (OPTION_IS_SET(option, FT_COPT_RIGHT_PADDING)) {
opt->cell_padding_right = value;
} else if (OPTION_IS_SET(option, FT_OPT_EMPTY_STR_HEIGHT)) {
} else if (OPTION_IS_SET(option, FT_COPT_EMPTY_STR_HEIGHT)) {
opt->cell_empty_string_height = value;
} else if (OPTION_IS_SET(option, FT_OPT_ROW_TYPE)) {
} else if (OPTION_IS_SET(option, FT_COPT_ROW_TYPE)) {
opt->row_type = (enum RowType)value;
}
@@ -188,9 +188,9 @@ fort_status_t set_cell_option(fort_cell_opt_container_t *cont, unsigned row, uns
return set_cell_option_impl(opt, option, value);
/*
OPTION_SET(opt->options, option);
if (OPTION_IS_SET(option, FT_OPT_MIN_WIDTH)) {
if (OPTION_IS_SET(option, FT_COPT_MIN_WIDTH)) {
opt->col_min_width = value;
} else if (OPTION_IS_SET(option, FT_OPT_TEXT_ALIGN)) {
} else if (OPTION_IS_SET(option, FT_COPT_TEXT_ALIGN)) {
opt->align = value;
}
@@ -321,6 +321,44 @@ struct fort_border_style FORT_EMPTY_STYLE = EMPTY_STYLE;
fort_entire_table_options_t g_entire_table_options = {
0, /* left_margin */
0, /* top_margin */
0, /* right_margin */
0, /* bottom_margin */
};
static fort_status_t set_entire_table_option_internal(fort_entire_table_options_t *options, uint32_t option, int value)
{
assert(options);
if (OPTION_IS_SET(option, FT_TOPT_LEFT_MARGIN)) {
options->left_margin = value;
} else if (OPTION_IS_SET(option, FT_TOPT_TOP_MARGIN)) {
options->top_margin = value;
} else if (OPTION_IS_SET(option, FT_TOPT_RIGHT_MARGIN)) {
options->right_margin = value;
} else if (OPTION_IS_SET(option, FT_TOPT_BOTTOM_MARGIN)) {
options->bottom_margin = value;
} else {
return FT_EINVAL;
}
return FT_SUCCESS;
}
fort_status_t set_entire_table_option(fort_table_options_t *table_options, uint32_t option, int value)
{
assert(table_options);
return set_entire_table_option_internal(&table_options->entire_table_options, option, value);
}
fort_status_t set_default_entire_table_option(uint32_t option, int value)
{
return set_entire_table_option_internal(&g_entire_table_options, option, value);
}
fort_table_options_t g_table_options = {
/* border_style */
BASIC_STYLE,
@@ -340,7 +378,7 @@ fort_table_options_t* create_table_options()
destroy_table_options(options);
options = NULL;
}
memcpy(&options->entire_table_options, &g_entire_table_options, sizeof(fort_entire_table_options_t));
return options;
}

View File

@@ -40,14 +40,14 @@ typedef struct vector vector_t;
#define FT_ROW_UNSPEC (UINT_MAX-1)
#define FT_COLUMN_UNSPEC (UINT_MAX-1)
#define FT_OPT_MIN_WIDTH ((uint32_t)(0x01U << (0)))
#define FT_OPT_TEXT_ALIGN ((uint32_t)(0x01U << (1)))
#define FT_OPT_TOP_PADDING ((uint32_t)(0x01U << (2)))
#define FT_OPT_BOTTOM_PADDING ((uint32_t)(0x01U << (3)))
#define FT_OPT_LEFT_PADDING ((uint32_t)(0x01U << (4)))
#define FT_OPT_RIGHT_PADDING ((uint32_t)(0x01U << (5)))
#define FT_OPT_EMPTY_STR_HEIGHT ((uint32_t)(0x01U << (6)))
#define FT_OPT_ROW_TYPE ((uint32_t)(0x01U << (7)))
#define FT_COPT_MIN_WIDTH ((uint32_t)(0x01U << (0)))
#define FT_COPT_TEXT_ALIGN ((uint32_t)(0x01U << (1)))
#define FT_COPT_TOP_PADDING ((uint32_t)(0x01U << (2)))
#define FT_COPT_BOTTOM_PADDING ((uint32_t)(0x01U << (3)))
#define FT_COPT_LEFT_PADDING ((uint32_t)(0x01U << (4)))
#define FT_COPT_RIGHT_PADDING ((uint32_t)(0x01U << (5)))
#define FT_COPT_EMPTY_STR_HEIGHT ((uint32_t)(0x01U << (6)))
#define FT_COPT_ROW_TYPE ((uint32_t)(0x01U << (7)))
#define OPTION_IS_SET(ft_opts, option) ((ft_opts) & (option))
#define OPTION_SET(ft_opts, option) ((ft_opts) |=(option))
@@ -152,11 +152,23 @@ extern struct fort_border_style FORT_DOT_STYLE;
extern struct fort_border_style FORT_EMPTY_STYLE;
struct fort_entire_table_options
{
int left_margin;
int top_margin;
int right_margin;
int bottom_margin;
};
typedef fort_entire_table_options fort_entire_table_options_t;
extern fort_entire_table_options_t g_entire_table_options;
fort_status_t set_entire_table_option(fort_table_options_t *table_options, uint32_t option, int value);
fort_status_t set_default_entire_table_option(uint32_t option, int value);
struct fort_table_options
{
struct fort_border_style border_style;
fort_cell_opt_container_t * cell_options;
fort_entire_table_options_t entire_table_options;
};
typedef struct fort_table_options fort_table_options_t;
extern fort_table_options_t g_table_options;

View File

@@ -137,11 +137,11 @@ int print_row_separator(char *buffer, size_t buffer_sz,
enum RowType lower_row_type = Common;
if (lower_row != NULL) {
lower_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_OPT_ROW_TYPE);
lower_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
}
enum RowType upper_row_type = Common;
if (upper_row != NULL) {
upper_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row-1, FT_ANY_COLUMN, FT_OPT_ROW_TYPE);
upper_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row-1, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
}
@@ -244,11 +244,11 @@ int wprint_row_separator(wchar_t *buffer, size_t buffer_sz,
enum RowType lower_row_type = Common;
if (lower_row != NULL) {
lower_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_OPT_ROW_TYPE);
lower_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
}
enum RowType upper_row_type = Common;
if (upper_row != NULL) {
upper_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row-1, FT_ANY_COLUMN, FT_OPT_ROW_TYPE);
upper_row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row-1, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
}
/* Row separator anatomy
@@ -478,7 +478,7 @@ int snprintf_row(const fort_row_t *row, char *buffer, size_t buf_sz, size_t *col
*/
typedef const char (*border_chars_point_t)[BorderItemPosSize];
enum RowType row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_OPT_ROW_TYPE);
enum RowType row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
const char (*bord_chars)[BorderItemPosSize] = (row_type == Header)
? (border_chars_point_t) (&context->table_options->border_style.header_border_chars)
: (border_chars_point_t) (&context->table_options->border_style.border_chars);
@@ -537,7 +537,7 @@ int wsnprintf_row(const fort_row_t *row, wchar_t *buffer, size_t buf_sz, size_t
*/
typedef const char (*border_chars_point_t)[BorderItemPosSize];
enum RowType row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_OPT_ROW_TYPE);
enum RowType row_type = (enum RowType)get_cell_opt_value_hierarcial(context->table_options, context->row, FT_ANY_COLUMN, FT_COPT_ROW_TYPE);
const char (*bord_chars)[BorderItemPosSize] = (row_type)
? (border_chars_point_t) (&context->table_options->border_style.header_border_chars)
: (border_chars_point_t) (&context->table_options->border_style.border_chars);

View File

@@ -295,7 +295,7 @@ int buffer_printf(string_buffer_t *buffer, size_t buffer_row, size_t table_colum
int left = 0;
int right = 0;
switch (get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_TEXT_ALIGN)) {
switch (get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_TEXT_ALIGN)) {
case LeftAligned:
left = 0;
right = (buf_len - 1) - content_width;
@@ -379,7 +379,7 @@ int buffer_wprintf(string_buffer_t *buffer, size_t buffer_row, size_t table_colu
int left = 0;
int right = 0;
switch (get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_TEXT_ALIGN)) {
switch (get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_COPT_TEXT_ALIGN)) {
case LeftAligned:
left = 0;
right = (buf_len - 1) - content_width;

View File

@@ -181,6 +181,14 @@ fort_status_t table_geometry(const FTABLE *table, size_t *height, size_t *width)
}
F_FREE(col_width_arr);
F_FREE(row_height_arr);
if (table->options) {
*height += table->options->entire_table_options.top_margin;
*height += table->options->entire_table_options.bottom_margin;
*width += table->options->entire_table_options.left_margin;
*width += table->options->entire_table_options.right_margin;
}
return FT_SUCCESS;
}