Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gnumeric
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
355
Issues
355
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
gnumeric
Commits
6bb20b43
Commit
6bb20b43
authored
Jun 15, 1999
by
Morten Welinder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More font work.
parent
e36a679f
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
197 additions
and
82 deletions
+197
-82
ChangeLog-1999-07-09
ChangeLog-1999-07-09
+12
-1
ChangeLog-2000-02-23
ChangeLog-2000-02-23
+12
-1
OChangeLog-1999-07-09
OChangeLog-1999-07-09
+12
-1
OChangeLog-2000-02-23
OChangeLog-2000-02-23
+12
-1
plugins/excel/ChangeLog
plugins/excel/ChangeLog
+7
-0
plugins/excel/ms-excel-read.c
plugins/excel/ms-excel-read.c
+16
-19
src/gnumeric-util.c
src/gnumeric-util.c
+7
-4
src/gnumeric-util.h
src/gnumeric-util.h
+2
-2
src/gui-util.c
src/gui-util.c
+7
-4
src/gui-util.h
src/gui-util.h
+2
-2
src/style.c
src/style.c
+108
-47
No files found.
ChangeLog-1999-07-09
View file @
6bb20b43
1999-06-15 Morten Welinder <terra@diku.dk>
* src/style.c (font_init): Rework. (Work in progress. Things
should work ok, but will become even better.)
(style_font_new_simple): Revert to loading a font, not a fontset.
* src/gnumeric-util.c (font_get_italic_name): Plug leak and unref
the StyleFont.
(font_get_bold_name, font_get_italic_name): New parameter units.
All callers changed.
1999-06-15 Tomas Ogren <stric@ing.umu.se>
* configure.in: Added sv
Mon Jun 14 18:24:40 1999 Morten Welinder <welinder@rentec.com
>
1999-06-14 Morten Welinder <terra@diku.dk
>
* src/style.c (style_font_new_simple): Add negative caching.
(DEFAULT_FONT): Don't have a complete wildcard here -- that might
...
...
ChangeLog-2000-02-23
View file @
6bb20b43
1999-06-15 Morten Welinder <terra@diku.dk>
* src/style.c (font_init): Rework. (Work in progress. Things
should work ok, but will become even better.)
(style_font_new_simple): Revert to loading a font, not a fontset.
* src/gnumeric-util.c (font_get_italic_name): Plug leak and unref
the StyleFont.
(font_get_bold_name, font_get_italic_name): New parameter units.
All callers changed.
1999-06-15 Tomas Ogren <stric@ing.umu.se>
* configure.in: Added sv
Mon Jun 14 18:24:40 1999 Morten Welinder <welinder@rentec.com
>
1999-06-14 Morten Welinder <terra@diku.dk
>
* src/style.c (style_font_new_simple): Add negative caching.
(DEFAULT_FONT): Don't have a complete wildcard here -- that might
...
...
OChangeLog-1999-07-09
View file @
6bb20b43
1999-06-15 Morten Welinder <terra@diku.dk>
* src/style.c (font_init): Rework. (Work in progress. Things
should work ok, but will become even better.)
(style_font_new_simple): Revert to loading a font, not a fontset.
* src/gnumeric-util.c (font_get_italic_name): Plug leak and unref
the StyleFont.
(font_get_bold_name, font_get_italic_name): New parameter units.
All callers changed.
1999-06-15 Tomas Ogren <stric@ing.umu.se>
* configure.in: Added sv
Mon Jun 14 18:24:40 1999 Morten Welinder <welinder@rentec.com
>
1999-06-14 Morten Welinder <terra@diku.dk
>
* src/style.c (style_font_new_simple): Add negative caching.
(DEFAULT_FONT): Don't have a complete wildcard here -- that might
...
...
OChangeLog-2000-02-23
View file @
6bb20b43
1999-06-15 Morten Welinder <terra@diku.dk>
* src/style.c (font_init): Rework. (Work in progress. Things
should work ok, but will become even better.)
(style_font_new_simple): Revert to loading a font, not a fontset.
* src/gnumeric-util.c (font_get_italic_name): Plug leak and unref
the StyleFont.
(font_get_bold_name, font_get_italic_name): New parameter units.
All callers changed.
1999-06-15 Tomas Ogren <stric@ing.umu.se>
* configure.in: Added sv
Mon Jun 14 18:24:40 1999 Morten Welinder <welinder@rentec.com
>
1999-06-14 Morten Welinder <terra@diku.dk
>
* src/style.c (style_font_new_simple): Add negative caching.
(DEFAULT_FONT): Don't have a complete wildcard here -- that might
...
...
plugins/excel/ChangeLog
View file @
6bb20b43
Tue Jun 15 18:12:19 1999 Morten Welinder <welinder@rentec.com>
* ms-excel-read.c (biff_font_data_get_style_font): Supply correct
size when initialising.
(biff_nasty_font_check_function): Revert last change. Extra
parameter ptsize.
1999-06-15 Jody Goldberg <jgoldberg@home.com>
* ms-formula-read.c (formula_func_data): Repopulate using xlcall.h and
...
...
plugins/excel/ms-excel-read.c
View file @
6bb20b43
...
...
@@ -425,10 +425,14 @@ biff_boundsheet_data_destroy (gpointer key, BIFF_BOUNDSHEET_DATA *d, gpointer us
* Ug! FIXME
**/
static
char
*
biff_nasty_font_check_function
(
char
*
name1
,
char
*
name2
)
biff_nasty_font_check_function
(
char
*
name1
,
char
*
name2
,
int
ptsize
)
{
if
(
gdk_fontset_load
(
name1
))
StyleFont
*
font
;
font
=
style_font_new_simple
(
name1
,
ptsize
);
if
(
font
)
{
style_font_unref
(
font
);
if
(
name2
)
g_free
(
name2
)
;
return
name1
;
...
...
@@ -444,16 +448,18 @@ biff_nasty_font_check_function (char *name1, char *name2)
static
StyleFont
*
biff_font_data_get_style_font
(
BIFF_FONT_DATA
*
fd
)
{
char
font_size
[
4
*
sizeof
(
int
)];
/* I know it may seem excessive. Time will say. */
int
i
;
char
*
fname1
,
*
fname2
;
StyleFont
*
ans
;
int
ptsize
;
ptsize
=
MAX
(
4
,
fd
->
height
/
20
);
if
(
!
fd
->
fontname
)
{
#if EXCEL_DEBUG > 0
printf
(
"Curious no font name on %d
\n
"
,
fd
->
index
);
#endif
return
style_font_new
(
gnumeric_default_font
->
font_name
,
1
);
return
style_font_new
(
gnumeric_default_font
->
font_name
,
ptsize
);
}
/*
...
...
@@ -469,36 +475,27 @@ biff_font_data_get_style_font (BIFF_FONT_DATA *fd)
fname1
=
g_strdup
(
gnumeric_default_font
->
font_name
);
fname2
=
font_change_component
(
gnumeric_default_font
->
font_name
,
1
,
fd
->
fontname
);
fname1
=
biff_nasty_font_check_function
(
fname2
,
fname1
);
fname1
=
biff_nasty_font_check_function
(
fname2
,
fname1
,
ptsize
);
/* printf ("FoNt [-]: %s\n", fname1) ; */
if
(
fd
->
italic
)
{
fname2
=
font_get_italic_name
(
fname1
);
fname2
=
font_get_italic_name
(
fname1
,
ptsize
);
/* printf ("FoNt [i]: %s\n", fname2) ; */
}
else
fname2
=
g_strdup
(
fname1
)
;
fname1
=
biff_nasty_font_check_function
(
fname2
,
fname1
)
;
fname1
=
biff_nasty_font_check_function
(
fname2
,
fname1
,
ptsize
)
;
if
(
fd
->
boldness
>=
0x2bc
)
{
fname2
=
font_get_bold_name
(
fname1
)
;
fname2
=
font_get_bold_name
(
fname1
,
ptsize
)
;
/* printf ("FoNt [b]: %s\n", fname1) ; */
}
else
fname2
=
g_strdup
(
fname1
)
;
fname1
=
biff_nasty_font_check_function
(
fname2
,
fname1
)
;
fname1
=
biff_nasty_font_check_function
(
fname2
,
fname1
,
ptsize
)
;
/* What about underlining? */
g_snprintf
(
font_size
,
16
,
"%d"
,
fd
->
height
/
2
);
{
char
*
tmp
;
tmp
=
font_change_component
(
fname1
,
7
,
font_size
);
fname2
=
font_change_component
(
tmp
,
6
,
"*"
);
g_free
(
tmp
);
}
fname1
=
biff_nasty_font_check_function
(
fname2
,
fname1
)
;
ans
=
style_font_new
(
fname1
,
1
)
;
ans
=
style_font_new
(
fname1
,
ptsize
)
;
g_free
(
fname1
)
;
if
(
fd
->
italic
)
...
...
src/gnumeric-util.c
View file @
6bb20b43
...
...
@@ -186,7 +186,7 @@ font_change_component (const char *fontname, int idx, const char *newvalue)
char
*
font_get_bold_name
(
const
char
*
fontname
)
font_get_bold_name
(
const
char
*
fontname
,
int
units
)
{
char
*
f
;
...
...
@@ -198,15 +198,18 @@ font_get_bold_name (const char *fontname)
}
char
*
font_get_italic_name
(
const
char
*
fontname
)
font_get_italic_name
(
const
char
*
fontname
,
int
units
)
{
char
*
f
;
StyleFont
*
sf
;
f
=
font_change_component
(
fontname
,
3
,
"o"
);
if
(
style_font_new
(
f
,
1
)
==
NULL
)
{
sf
=
style_font_new_simple
(
f
,
units
);
if
(
sf
==
NULL
)
{
g_free
(
f
);
f
=
font_change_component
(
fontname
,
3
,
"i"
);
}
}
else
style_font_unref
(
sf
);
return
f
;
}
...
...
src/gnumeric-util.h
View file @
6bb20b43
...
...
@@ -12,8 +12,8 @@ int run_popup_menu (GdkEvent *event, int button, char **strings);
int
gtk_radio_group_get_selected
(
GSList
*
radio_group
);
void
gtk_radio_button_select
(
GSList
*
group
,
int
n
);
char
*
font_get_bold_name
(
const
char
*
fontname
);
char
*
font_get_italic_name
(
const
char
*
fontname
);
char
*
font_get_bold_name
(
const
char
*
fontname
,
int
units
);
char
*
font_get_italic_name
(
const
char
*
fontname
,
int
units
);
char
*
font_change_component
(
const
char
*
fontname
,
int
idx
,
const
char
*
value
);
/*
...
...
src/gui-util.c
View file @
6bb20b43
...
...
@@ -186,7 +186,7 @@ font_change_component (const char *fontname, int idx, const char *newvalue)
char
*
font_get_bold_name
(
const
char
*
fontname
)
font_get_bold_name
(
const
char
*
fontname
,
int
units
)
{
char
*
f
;
...
...
@@ -198,15 +198,18 @@ font_get_bold_name (const char *fontname)
}
char
*
font_get_italic_name
(
const
char
*
fontname
)
font_get_italic_name
(
const
char
*
fontname
,
int
units
)
{
char
*
f
;
StyleFont
*
sf
;
f
=
font_change_component
(
fontname
,
3
,
"o"
);
if
(
style_font_new
(
f
,
1
)
==
NULL
)
{
sf
=
style_font_new_simple
(
f
,
units
);
if
(
sf
==
NULL
)
{
g_free
(
f
);
f
=
font_change_component
(
fontname
,
3
,
"i"
);
}
}
else
style_font_unref
(
sf
);
return
f
;
}
...
...
src/gui-util.h
View file @
6bb20b43
...
...
@@ -12,8 +12,8 @@ int run_popup_menu (GdkEvent *event, int button, char **strings);
int
gtk_radio_group_get_selected
(
GSList
*
radio_group
);
void
gtk_radio_button_select
(
GSList
*
group
,
int
n
);
char
*
font_get_bold_name
(
const
char
*
fontname
);
char
*
font_get_italic_name
(
const
char
*
fontname
);
char
*
font_get_bold_name
(
const
char
*
fontname
,
int
units
);
char
*
font_get_italic_name
(
const
char
*
fontname
,
int
units
);
char
*
font_change_component
(
const
char
*
fontname
,
int
idx
,
const
char
*
value
);
/*
...
...
src/style.c
View file @
6bb20b43
...
...
@@ -11,18 +11,12 @@
#include "gnumeric.h"
#include "format.h"
#include "color.h"
#include "gnumeric-util.h"
#define DEFAULT_FONT \
"-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-iso8859-*," \
"-*-*-medium-r-normal--12-*-*-*-*-*-iso8859-*," \
"-*-*-regular-r-normal--12-*-*-*-*-*-iso8859-*"
#define DEFAULT_BOLD_FONT \
"-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-*," \
"-*-*-bold-r-normal--12-*-*-*-*-*-iso8859-*"
#define DEFAULT_ITALIC_FONT \
"-adobe-helvetica-medium-o-normal--*-120-*-*-*-*-iso8859-*," \
"-*-*-medium-o-normal--12-*-*-*-*-*-iso8859-*"
#define DEFAULT_SIZE 12
#define DEBUG_FONTS
#define DEFAULT_FONT "-adobe-helvetica-medium-r-normal--*-*-*-*-*-*-iso8859-*"
#define DEFAULT_FONT_SIZE 12
static
GHashTable
*
style_format_hash
;
static
GHashTable
*
style_font_hash
;
...
...
@@ -34,6 +28,9 @@ StyleFont *gnumeric_default_font;
StyleFont
*
gnumeric_default_bold_font
;
StyleFont
*
gnumeric_default_italic_font
;
static
StyleFont
*
standard_fonts
[
2
][
2
];
/* [bold-p][italic-p] */
static
char
*
standard_font_names
[
2
][
2
];
/* [bold-p][italic-p] */
StyleFormat
*
style_format_new
(
const
char
*
name
)
{
...
...
@@ -105,6 +102,26 @@ font_compute_hints (StyleFont *font)
}
}
#ifdef DEBUG_FONTS
#include <X11/Xlib.h>
#include "gdk/gdkprivate.h"
/* Sorry */
static
const
char
*
my_gdk_actual_font_name
(
GdkFont
*
font
)
{
GdkFontPrivate
*
private
;
Atom
atom
,
font_atom
;
private
=
(
GdkFontPrivate
*
)
font
;
font_atom
=
XInternAtom
(
private
->
xdisplay
,
"FONT"
,
True
);
if
(
font_atom
!=
None
)
{
if
(
XGetFontProperty
(
private
->
xfont
,
font_atom
,
&
atom
)
==
True
)
return
XGetAtomName
(
private
->
xdisplay
,
atom
);
}
return
NULL
;
}
#endif
StyleFont
*
style_font_new_simple
(
const
char
*
font_name
,
int
units
)
{
...
...
@@ -112,29 +129,46 @@ style_font_new_simple (const char *font_name, int units)
StyleFont
key
;
g_return_val_if_fail
(
font_name
!=
NULL
,
NULL
);
g_return_val_if_fail
(
units
!=
0
,
NULL
);
g_return_val_if_fail
(
units
>
0
,
NULL
);
key
.
font_name
=
(
char
*
)
font_name
;
/* We will not change the name. */
/* This cast does not mean we will change the name. */
key
.
font_name
=
(
char
*
)
font_name
;
key
.
units
=
units
;
font
=
(
StyleFont
*
)
g_hash_table_lookup
(
style_font_hash
,
&
key
);
if
(
!
font
){
GdkFont
*
gdk_font
;
char
*
font_name_copy
;
char
*
font_name_copy
,
*
font_name_with_size
;
char
sizetxt
[
4
*
sizeof
(
int
)];
if
(
g_hash_table_lookup
(
style_font_negative_hash
,
&
key
))
return
NULL
;
font_name_copy
=
g_strdup
(
font_name
);
gdk_font
=
gdk_fontset_load
(
font_name_copy
);
sprintf
(
sizetxt
,
"%d"
,
units
);
font_name_with_size
=
font_change_component
(
font_name
,
6
,
sizetxt
);
gdk_font
=
gdk_font_load
(
font_name_copy
);
#ifdef DEBUG_FONTS
printf
(
"Font
\"
%s
\"\n
"
,
font_name_with_size
);
#endif
g_free
(
font_name_with_size
);
if
(
!
gdk_font
)
{
key
.
font_name
=
font_name_copy
;
g_hash_table_insert
(
style_font_negative_hash
,
&
key
,
&
key
);
#ifdef DEBUG_FONTS
printf
(
"was not resolved.
\n\n
"
);
#endif
return
NULL
;
}
#ifdef DEBUG_FONTS
printf
(
"was resolved as
\"
%s
\"
.
\n\n
"
,
my_gdk_actual_font_name
(
gdk_font
));
#endif
font
=
g_new0
(
StyleFont
,
1
);
font
->
font_name
=
font_name_copy
;
font
->
units
=
units
;
...
...
@@ -309,7 +343,7 @@ style_new (void)
style
->
valid_flags
=
STYLE_ALL
;
style
->
format
=
style_format_new
(
"General"
);
style
->
font
=
style_font_new
(
DEFAULT_FONT
,
DEFAULT_SIZE
);
style
->
font
=
style_font_new
(
DEFAULT_FONT
,
DEFAULT_
FONT_
SIZE
);
style
->
border
=
style_border_new_plain
();
style
->
fore_color
=
style_color_new
(
0
,
0
,
0
);
style
->
back_color
=
style_color_new
(
0xffff
,
0xffff
,
0xffff
);
...
...
@@ -529,12 +563,32 @@ style_merge_to (Style *target, Style *source)
static
void
font_init
(
void
)
{
gnumeric_default_font
=
style_font_new_simple
(
DEFAULT_FONT
,
DEFAULT_SIZE
);
int
boldp
,
italicp
;
for
(
boldp
=
0
;
boldp
<=
1
;
boldp
++
)
{
for
(
italicp
=
0
;
italicp
<=
1
;
italicp
++
)
{
char
*
name
;
int
size
=
DEFAULT_FONT_SIZE
;
if
(
!
gnumeric_default_font
)
gnumeric_default_font
=
style_font_new_simple
(
"fixed"
,
DEFAULT_SIZE
);
name
=
g_strdup
(
DEFAULT_FONT
);
if
(
!
gnumeric_default_font
)
{
if
(
boldp
)
{
char
*
tmp
;
tmp
=
font_get_bold_name
(
name
,
size
);
g_free
(
name
);
name
=
tmp
;
}
if
(
italicp
)
{
char
*
tmp
;
tmp
=
font_get_italic_name
(
name
,
size
);
g_free
(
name
);
name
=
tmp
;
}
standard_fonts
[
boldp
][
italicp
]
=
style_font_new_simple
(
name
,
size
);
if
(
!
standard_fonts
[
boldp
][
italicp
])
{
fprintf
(
stderr
,
"Gnumeric failed to find a suitable default font.
\n
"
"Please file a proper bug report (see http://bugs.gnome.org)
\n
"
...
...
@@ -542,13 +596,20 @@ font_init (void)
"
\n
"
"1. Values of LC_ALL and LANG environment variables.
\n
"
"2. A list of the fonts on your system (from the xlsfonts program).
\n
"
"3. The values here: boldp=%d, italicp=%d
\n
"
"
\n
"
"Thanks -- the Gnumeric Team
\n
"
);
"Thanks -- the Gnumeric Team
\n
"
,
boldp
,
italicp
);
exit
(
1
);
}
gnumeric_default_bold_font
=
style_font_new
(
DEFAULT_BOLD_FONT
,
DEFAULT_SIZE
);
gnumeric_default_italic_font
=
style_font_new
(
DEFAULT_ITALIC_FONT
,
DEFAULT_SIZE
);
standard_font_names
[
boldp
][
italicp
]
=
name
;
}
}
gnumeric_default_font
=
standard_fonts
[
0
][
0
];
gnumeric_default_bold_font
=
standard_fonts
[
1
][
0
];
gnumeric_default_italic_font
=
standard_fonts
[
0
][
1
];
}
void
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment