Top | ![]() |
![]() |
![]() |
![]() |
Functions
Types and Values
#define | GO_SUBSCRIPT_RISE |
#define | GO_SUBSCRIPT_SCALE |
#define | GO_SUPERSCRIPT_RISE |
#define | GO_SUPERSCRIPT_SCALE |
GOFormat | |
GOFormatCurrency | |
GOFormatDetails | |
enum | GOFormatFamily |
enum | GOFormatMagic |
enum | GOFormatNumberError |
Functions
go_format_dec_precision ()
GOFormat *
go_format_dec_precision (GOFormat const *fmt
);
Decreases the displayed precision for fmt
by one digit.
go_format_details_init ()
void go_format_details_init (GOFormatDetails *details
,GOFormatFamily family
);
go_format_foreach ()
void go_format_foreach (GHFunc func
,gpointer user_data
);
Executes func
for each registered GOFormat
go_format_generate_number_str ()
void go_format_generate_number_str (GString *dst
,int min_digits
,int num_decimals
,gboolean thousands_sep
,gboolean negative_red
,gboolean negative_paren
,const char *prefix
,const char *postfix
);
Generates a format string for a number format with the given
parameters and appends it to dst
.
Parameters
dst |
GString to append format string to. |
|
min_digits |
minimum number of digits before decimal separator. |
|
num_decimals |
number of decimals |
|
thousands_sep |
if true, use a thousands separator. |
|
negative_red |
if true, make negative values red. |
|
negative_paren |
if true, enclose negative values in parentheses. |
|
prefix |
optional string to place before number part of the format |
|
postfix |
optional string to place after number part of the format |
go_format_generate_str ()
void go_format_generate_str (GString *dst
,GOFormatDetails const *details
);
go_format_get_details ()
void go_format_get_details (GOFormat const *fmt
,GOFormatDetails *dst
,gboolean *exact
);
go_format_inc_precision ()
GOFormat *
go_format_inc_precision (GOFormat const *fmt
);
Increases the displayed precision for fmt
by one digit.
go_format_new_markup ()
GOFormat * go_format_new_markup (PangoAttrList *markup
,gboolean add_ref
);
If add_ref
is FALSE absorb the reference to markup
, otherwise add a
reference.
go_format_output_to_odf ()
gboolean go_format_output_to_odf (GsfXMLOut *xout
,GOFormat const *fmt
,int cond_part
,char const *name
,gboolean with_extension
);
go_format_specialize ()
const GOFormat * go_format_specialize (GOFormat const *fmt
,double val
,char type
,gboolean *inhibit_minus
);
go_format_specializel ()
const GOFormat * go_format_specializel (GOFormat const *fmt
,long double val
,char type
,gboolean *inhibit_minus
);
go_format_str_delocalize ()
char *
go_format_str_delocalize (char const *str
);
De-localizes the given format string, i.e., changes locale's decimal separators to dots and performs other such transformations.
go_format_str_localize ()
char *
go_format_str_localize (char const *str
);
Localizes the given format string, i.e., changes decimal dots to the locale's notion of that and performs other such transformations.
go_format_unref ()
void
go_format_unref (GOFormat const *fmt
);
Removes a reference to fmt
, freeing when it goes to zero.
go_format_value ()
char * go_format_value (GOFormat const *fmt
,double val
);
Converts val
into a string using format specified by fmt
.
go_format_value_gstring ()
GOFormatNumberError go_format_value_gstring (PangoLayout *layout
,GString *str
,const GOFormatMeasure measure
,const GOFontMetrics *metrics
,GOFormat const *fmt
,double val
,char type
,const char *sval
,GOColor *go_color
,int col_width
,GODateConventions const *date_conv
,gboolean unicode_minus
);
Render a floating-point value into layout
in such a way that the
layouting width does not needlessly exceed col_width
. Optionally
use unicode minus instead of hyphen.
Parameters
layout |
Optional PangoLayout, probably preseeded with font attribute. |
|
str |
a GString to store (not append!) the resulting string in. |
|
measure |
Function to measure width of string/layout. |
[scope call] |
metrics |
Font metrics corresponding to |
|
fmt |
||
val |
floating-point value. Must be finite. |
|
type |
a format character |
|
sval |
a string to append to |
|
go_color |
a color to rende |
|
col_width |
intended max width of layout in pango units. -1 means no restriction. |
|
date_conv |
||
unicode_minus |
Use unicode minuses, not hyphens. |
go_format_value_gstringl ()
GOFormatNumberError go_format_value_gstringl (PangoLayout *layout
,GString *str
,const GOFormatMeasure measure
,const GOFontMetrics *metrics
,GOFormat const *fmt
,long double val
,char type
,const char *sval
,GOColor *go_color
,int col_width
,GODateConventions const *date_conv
,gboolean unicode_minus
);
Render a floating-point value into layout
in such a way that the
layouting width does not needlessly exceed col_width
. Optionally
use unicode minus instead of hyphen.
Parameters
layout |
Optional PangoLayout, probably preseeded with font attribute. |
|
str |
a GString to store (not append!) the resulting string in. |
|
measure |
Function to measure width of string/layout. |
[scope call] |
metrics |
Font metrics corresponding to |
|
fmt |
||
val |
floating-point value. Must be finite. |
|
type |
a format character |
|
sval |
a string to append to |
|
go_color |
a color to rende |
|
col_width |
intended max width of layout in pango units. -1 means no restriction. |
|
date_conv |
||
unicode_minus |
Use unicode minuses, not hyphens. |
go_render_general ()
void go_render_general (PangoLayout *layout
,GString *str
,GOFormatMeasure measure
,const GOFontMetrics *metrics
,double val
,int col_width
,gboolean unicode_minus
,guint numeral_shape
,guint custom_shape_flags
);
Render a floating-point value into layout
in such a way that the
layouting width does not needlessly exceed col_width
. Optionally
use unicode minus instead of hyphen.
Parameters
layout |
Optional PangoLayout, probably preseeded with font attribute. |
|
str |
a GString to store (not append!) the resulting string in. |
|
measure |
Function to measure width of string/layout. |
[scope call] |
metrics |
Font metrics corresponding to |
|
val |
floating-point value. Must be finite. |
|
col_width |
intended max width of layout in pango units. -1 means no restriction. |
|
unicode_minus |
Use unicode minuses, not hyphens. |
|
numeral_shape |
numeral shape identifier. |
|
custom_shape_flags |
flags for using |
go_render_generall ()
void go_render_generall (PangoLayout *layout
,GString *str
,GOFormatMeasure measure
,const GOFontMetrics *metrics
,long double val
,int col_width
,gboolean unicode_minus
,guint numeral_shape
,guint custom_shape_flags
);
Render a floating-point value into layout
in such a way that the
layouting width does not needlessly exceed col_width
. Optionally
use unicode minus instead of hyphen.
Parameters
layout |
Optional PangoLayout, probably preseeded with font attribute. |
|
str |
a GString to store (not append!) the resulting string in. |
|
measure |
Function to measure width of string/layout. |
[scope call] |
metrics |
Font metrics corresponding to |
|
val |
floating-point value. Must be finite. |
|
col_width |
intended max width of layout in pango units. -1 means no restriction. |
|
unicode_minus |
Use unicode minuses, not hyphens. |
|
numeral_shape |
numeral shape identifier. |
|
custom_shape_flags |
flags for using |
Types and Values
GOFormatCurrency
typedef struct { gchar const *symbol; gchar const *description; gboolean precedes; gboolean has_space; } GOFormatCurrency;
GOFormatDetails
typedef struct { GOFormatFamily family; GOFormatMagic magic; /* NUMBER, SCIENTIFIC, CURRENCY, ACCOUNTING, FRACTION, PERCENTAGE: */ int min_digits; int num_decimals; /* NUMBER, CURRENCY, ACCOUNTING, PERCENTAGE: */ gboolean thousands_sep; /* NUMBER, CURRENCY, ACCOUNTING, PERCENTAGE: */ gboolean negative_red; gboolean negative_paren; /* CURRENCY, ACCOUNTING: */ GOFormatCurrency const *currency; /* CURRENCY: */ gboolean force_quoted; /* SCIENTIFIC: */ int exponent_step; int exponent_digits; gboolean exponent_sign_forced; gboolean use_markup; gboolean simplify_mantissa; gboolean append_SI; gchar *appended_SI_unit; int scale; /* FRACTION: */ gboolean automatic_denominator; gboolean split_fraction; gboolean pi_scale; int numerator_min_digits; int denominator_min_digits; int denominator_max_digits; int denominator; } GOFormatDetails;
Members
GOFormatFamily |
||
GOFormatMagic |
||
minimum digits number. |
||
decimals number. |
||
thousands separator. |
||
display negative number using red ink. |
||
uses parenthersis around negative numbers. |
||
GOFormatCurrency const * |
||
force quotes use. |
||
steps between allowed exponents in scientific notation. |
||
digits number in exponent. |
||
whether the sign in the exponent is always shown. |
||
whether to use a markup. |
||
simplify the mantissa. |
||
append an SI unit. |
||
the SI unit to append. |
||
scale. |
||
use an automatic denominator for fractions. |
||
split the fraction. |
||
use multiples of pi for fractions, e.g. 1/2*pi. |
||
minimum digits number for the numerator. |
||
minimum digits number for the denominator. |
||
minimum digits number for the denominator. |
||
fixed denominator. |