Commit fe0ffd39 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

get font list from pango. (global_gnome_font_shutdown) : and free it here.

2002-02-19  Jody Goldberg <jody@gnome.org>

	* src/global-gnome-font.c (global_gnome_font_init) : get font list
	  from pango.
	(global_gnome_font_shutdown) : and free it here.
parent e8c0d95d
2002-02-19 Jody Goldberg <jody@gnome.org>
* src/global-gnome-font.c (global_gnome_font_init) : get font list
from pango.
(global_gnome_font_shutdown) : and free it here.
2002-02-18 Jody Goldberg <jody@gnome.org>
* configure.in : post release bump.
......
2002-02-19 Jody Goldberg <jody@gnome.org>
* src/global-gnome-font.c (global_gnome_font_init) : get font list
from pango.
(global_gnome_font_shutdown) : and free it here.
2002-02-18 Jody Goldberg <jody@gnome.org>
* configure.in : post release bump.
......
2002-02-19 Jody Goldberg <jody@gnome.org>
* src/global-gnome-font.c (global_gnome_font_init) : get font list
from pango.
(global_gnome_font_shutdown) : and free it here.
2002-02-18 Jody Goldberg <jody@gnome.org>
* configure.in : post release bump.
......
......@@ -82,10 +82,10 @@
</figure>
<para>As you can see, we have put the model variables into cells
B3:D3. They are currently all zeros. The cell E4 contains the
B3:D3. They are currently all zeros. The cell E3 contains the
objective function definition. The easiest way to define it is to
use SUMPRODUCT build-in function. Thus in our model, we have the
formula `=SUMPRODUCT(B3:D3,B4:D4)' in E4.</para>
formula `=SUMPRODUCT(B3:D3,B4:D4)' in E3.</para>
<para>The constraints are defined in rows seven to ten. Since the
coefficients of these functions are in columns B, C and D we will
......@@ -106,7 +106,7 @@
</screenshot>
</figure>
<para>Since we have the objective function in E4 type this into
<para>Since we have the objective function in E3 type this into
the `Set Target Cell:' entry. We are about to maximize this
function, thus the radiobutton `Max' should be pressed on. By
default, the problem is assumed to be maximization problem. The
......
......@@ -59,8 +59,8 @@ add2numbers (FunctionEvalInfo *ei, Value *argv [])
The function should return a newly allocated Value structure.
Arguments are passed in the argv array and they contain Value
structures (look in gnumeric/src/expr.h for the definition of the
Value structure).
structures (look in gnumeric/src/value.h for the definition of the
_Value union, which is typedef'ed to Value in gnumeric.h).
The first parameter, ei is a pointer to the FunctionEvalInfo
structure, this looks like this: ( from expr.h )
......@@ -109,11 +109,11 @@ add2numbers (FunctionEvalPos *ei, Value *argv [])
switch (argv [1].type){
case VALUE_INTEGER:
number_a = argv [1].v.v_int;
number_b = argv [1].v.v_int;
break;
case VALUE_FLOAT:
number_a = argv [1].v.v_float;
number_b = argv [1].v.v_float;
break;
default:
......
......@@ -59,8 +59,8 @@ add2numbers (FunctionEvalInfo *ei, Value *argv [])
The function should return a newly allocated Value structure.
Arguments are passed in the argv array and they contain Value
structures (look in gnumeric/src/expr.h for the definition of the
Value structure).
structures (look in gnumeric/src/value.h for the definition of the
_Value union, which is typedef'ed to Value in gnumeric.h).
The first parameter, ei is a pointer to the FunctionEvalInfo
structure, this looks like this: ( from expr.h )
......@@ -109,11 +109,11 @@ add2numbers (FunctionEvalPos *ei, Value *argv [])
switch (argv [1].type){
case VALUE_INTEGER:
number_a = argv [1].v.v_int;
number_b = argv [1].v.v_int;
break;
case VALUE_FLOAT:
number_a = argv [1].v.v_float;
number_b = argv [1].v.v_float;
break;
default:
......
......@@ -1232,14 +1232,14 @@ gnumeric_rand (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
static char *help_randexp = {
N_("@FUNCTION=RandExp\n"
"@SYNTAX=RandExp(b)\n"
N_("@FUNCTION=RANDEXP\n"
"@SYNTAX=RANDEXP(b)\n"
"@DESCRIPTION="
"RandExp returns a exponentially distributed random number. "
"RANDEXP returns a exponentially-distributed random number. "
"\n"
"@EXAMPLES=\n"
"RandExp(0.5).\n"
"RANDEXP(0.5).\n"
"\n"
"@SEEALSO=RAND,RANDBETWEEN")
};
......@@ -1255,14 +1255,14 @@ gnumeric_randexp (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
static char *help_randpoisson = {
N_("@FUNCTION=RandPoisson\n"
"@SYNTAX=RandPoisson(lambda)\n"
N_("@FUNCTION=RANDPOISSON\n"
"@SYNTAX=RANDPOISSON(lambda)\n"
"@DESCRIPTION="
"RandPoisson returns a poisson distributed random number. "
"RANDPOISSON returns a poisson-distributed random number. "
"\n"
"@EXAMPLES=\n"
"RandPoisson(3).\n"
"RANDPOISSON(3).\n"
"\n"
"@SEEALSO=RAND,RANDBETWEEN")
};
......@@ -1281,17 +1281,17 @@ gnumeric_randpoisson (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
static char *help_randbinom = {
N_("@FUNCTION=RandBinom\n"
"@SYNTAX=RandBinom(p,trials)\n"
N_("@FUNCTION=RANDBINOM\n"
"@SYNTAX=RANDBINOM(p,trials)\n"
"@DESCRIPTION="
"RandBinom returns a binomialy distributed random number. "
"RANDBINOM returns a binomially-distributed random number. "
"\n"
"If @p < 0 or @p > 1 RandBinom returns #NUM! error. "
"If @trials < 0 RandBinom returns #NUM! error. "
"If @p < 0 or @p > 1 RANDBINOM returns #NUM! error. "
"If @trials < 0 RANDBINOM returns #NUM! error. "
"\n"
"@EXAMPLES=\n"
"RandBinom(0.5,2).\n"
"RANDBINOM(0.5,2).\n"
"\n"
"@SEEALSO=RAND,RANDBETWEEN")
};
......@@ -1315,7 +1315,7 @@ static char *help_randnegbinom = {
"@SYNTAX=RANDNEGBINOM(p,failures)\n"
"@DESCRIPTION="
"RANDNEGBINOM returns a negitive binomialy distributed random "
"RANDNEGBINOM returns a negative binomially-distributed random "
"number. "
"\n"
"If @p < 0 or @p > 1, RANDNEGBINOM returns #NUM! error. "
......@@ -1342,16 +1342,16 @@ gnumeric_randnegbinom (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
static char *help_randbernoulli = {
N_("@FUNCTION=RandBernoulli\n"
"@SYNTAX=RandBernoulli(p)\n"
N_("@FUNCTION=RANDBERNOULLI\n"
"@SYNTAX=RANDBERNOULLI(p)\n"
"@DESCRIPTION="
"RandBernoulli returns a Bernoulli distributed random number. "
"RANDBERNOULLI returns a Bernoulli-distributed random number. "
"\n"
"If @p < 0 or @p > 1 RandBernoulli returns #NUM! error. "
"If @p < 0 or @p > 1 RANDBERNOULLI returns #NUM! error. "
"\n"
"@EXAMPLES=\n"
"RandBernoulli(0.5).\n"
"RANDBERNOULLI(0.5).\n"
"\n"
"@SEEALSO=RAND,RANDBETWEEN")
};
......
......@@ -30,7 +30,7 @@
/* These are not supported yet */
typedef enum {
FUNCTION_RETURNS_ARRAY = 0x01, /* eg transpose(), mmult() */
FUNCTION_RECALC_ALWAYS = 0x02, /* eg now() */
FUNCTION_RECALC_ALWAYS = 0x02, /* eg now(), today() */
/* For functions that are not exactly compatible with various import
* formats. We need to recalc their results to avoid changing values
......
......@@ -1232,14 +1232,14 @@ gnumeric_rand (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
static char *help_randexp = {
N_("@FUNCTION=RandExp\n"
"@SYNTAX=RandExp(b)\n"
N_("@FUNCTION=RANDEXP\n"
"@SYNTAX=RANDEXP(b)\n"
"@DESCRIPTION="
"RandExp returns a exponentially distributed random number. "
"RANDEXP returns a exponentially-distributed random number. "
"\n"
"@EXAMPLES=\n"
"RandExp(0.5).\n"
"RANDEXP(0.5).\n"
"\n"
"@SEEALSO=RAND,RANDBETWEEN")
};
......@@ -1255,14 +1255,14 @@ gnumeric_randexp (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
static char *help_randpoisson = {
N_("@FUNCTION=RandPoisson\n"
"@SYNTAX=RandPoisson(lambda)\n"
N_("@FUNCTION=RANDPOISSON\n"
"@SYNTAX=RANDPOISSON(lambda)\n"
"@DESCRIPTION="
"RandPoisson returns a poisson distributed random number. "
"RANDPOISSON returns a poisson-distributed random number. "
"\n"
"@EXAMPLES=\n"
"RandPoisson(3).\n"
"RANDPOISSON(3).\n"
"\n"
"@SEEALSO=RAND,RANDBETWEEN")
};
......@@ -1281,17 +1281,17 @@ gnumeric_randpoisson (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
static char *help_randbinom = {
N_("@FUNCTION=RandBinom\n"
"@SYNTAX=RandBinom(p,trials)\n"
N_("@FUNCTION=RANDBINOM\n"
"@SYNTAX=RANDBINOM(p,trials)\n"
"@DESCRIPTION="
"RandBinom returns a binomialy distributed random number. "
"RANDBINOM returns a binomially-distributed random number. "
"\n"
"If @p < 0 or @p > 1 RandBinom returns #NUM! error. "
"If @trials < 0 RandBinom returns #NUM! error. "
"If @p < 0 or @p > 1 RANDBINOM returns #NUM! error. "
"If @trials < 0 RANDBINOM returns #NUM! error. "
"\n"
"@EXAMPLES=\n"
"RandBinom(0.5,2).\n"
"RANDBINOM(0.5,2).\n"
"\n"
"@SEEALSO=RAND,RANDBETWEEN")
};
......@@ -1315,7 +1315,7 @@ static char *help_randnegbinom = {
"@SYNTAX=RANDNEGBINOM(p,failures)\n"
"@DESCRIPTION="
"RANDNEGBINOM returns a negitive binomialy distributed random "
"RANDNEGBINOM returns a negative binomially-distributed random "
"number. "
"\n"
"If @p < 0 or @p > 1, RANDNEGBINOM returns #NUM! error. "
......@@ -1342,16 +1342,16 @@ gnumeric_randnegbinom (FunctionEvalInfo *ei, Value **argv)
/***************************************************************************/
static char *help_randbernoulli = {
N_("@FUNCTION=RandBernoulli\n"
"@SYNTAX=RandBernoulli(p)\n"
N_("@FUNCTION=RANDBERNOULLI\n"
"@SYNTAX=RANDBERNOULLI(p)\n"
"@DESCRIPTION="
"RandBernoulli returns a Bernoulli distributed random number. "
"RANDBERNOULLI returns a Bernoulli-distributed random number. "
"\n"
"If @p < 0 or @p > 1 RandBernoulli returns #NUM! error. "
"If @p < 0 or @p > 1 RANDBERNOULLI returns #NUM! error. "
"\n"
"@EXAMPLES=\n"
"RandBernoulli(0.5).\n"
"RANDBERNOULLI(0.5).\n"
"\n"
"@SEEALSO=RAND,RANDBETWEEN")
};
......
......@@ -10,12 +10,16 @@
#include "gnumeric.h"
#include "global-gnome-font.h"
#include <gdk/gdkpango.h>
#include <pango/pango-context.h>
#include <pango/pango-font.h>
#include <string.h>
#include <stdio.h>
#include <libgnomeprint/gnome-font.h>
#include <stdlib.h>
GList *gnumeric_font_family_list = NULL;
GList *gnumeric_point_size_list = NULL;
static PangoFontFamily **pango_families;
int const gnumeric_point_sizes [] = {
4, 8, 9, 10, 11, 12, 14, 16, 18,
......@@ -23,23 +27,31 @@ int const gnumeric_point_sizes [] = {
0
};
static int
compare_family_pointers_by_name (gconstpointer a, gconstpointer b)
{
PangoFontFamily * const * const fa = a;
PangoFontFamily * const * const fb = b;
return g_utf8_collate (pango_font_family_get_name (*fa),
pango_font_family_get_name (*fb));
}
void
global_gnome_font_init (void)
{
int i;
GList *l, *ll;
int n_families, i;
l = gnome_font_family_list ();
#if 0
pango_context_list_families (gtk_widget_get_pango_context (GTK_WIDGET (fontsel)),
&fontsel->families, &n_families);
#endif
pango_context_list_families (gdk_pango_context_get (),
&pango_families, &n_families);
qsort (pango_families, n_families, sizeof (*pango_families),
compare_family_pointers_by_name);
for (ll = l; ll; ll = ll->next){
gnumeric_font_family_list = g_list_insert_sorted (
gnumeric_font_family_list, g_strdup (ll->data), (GCompareFunc)strcmp);
}
gnome_font_family_list_free (l);
for (i = 0 ; i < n_families ; i++)
gnumeric_font_family_list = g_list_prepend (
gnumeric_font_family_list,
(gpointer) pango_font_family_get_name (pango_families[i]));
gnumeric_font_family_list = g_list_reverse (gnumeric_font_family_list);
for (i = 0; gnumeric_point_sizes [i] != 0; i++){
char buffer [6];
......@@ -56,14 +68,14 @@ global_gnome_font_shutdown (void)
{
GList *l;
for (l = gnumeric_font_family_list; l; l = l->next)
g_free (l->data);
g_free (pango_families);
pango_families = NULL;
g_list_free (gnumeric_font_family_list);
gnumeric_font_family_list = NULL;
for (l = gnumeric_point_size_list; l; l = l->next){
for (l = gnumeric_point_size_list; l; l = l->next)
g_free (l->data);
}
g_list_free (gnumeric_point_size_list);
gnumeric_point_size_list = NULL;
}
......@@ -4,7 +4,7 @@
*
* Author:
* Miguel de Icaza (miguel@helixcode.com)
* Jody GOldberg (jody@gnome.org)
* Jody Goldberg (jody@gnome.org)
*
* (C) 2000-2001 Ximian, Inc.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment