[dia] Bug 669647 - Error messages on the opening of .fig files
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Bug 669647 - Error messages on the opening of .fig files
- Date: Tue, 14 Feb 2012 21:35:43 +0000 (UTC)
commit b2ed346ec9ca9e5c5e93b022928179a350c48fd7
Author: Hans Breuer <hans breuer org>
Date: Tue Feb 14 22:30:42 2012 +0100
Bug 669647 - Error messages on the opening of .fig files
The font set selection (Latex vs. PostScript fonts) was not according to the specification, actually inverted.
plug-ins/xfig/xfig-common.c | 6 ++++++
plug-ins/xfig/xfig-import.c | 6 +++---
plug-ins/xfig/xfig.h | 2 ++
3 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/xfig/xfig-common.c b/plug-ins/xfig/xfig-common.c
index 639a00d..9ba855a 100644
--- a/plug-ins/xfig/xfig-common.c
+++ b/plug-ins/xfig/xfig-common.c
@@ -72,3 +72,9 @@ char *fig_fonts[] =
"ZapfDingbats",
NULL
};
+
+int
+num_fig_fonts (void)
+{
+ return G_N_ELEMENTS(fig_fonts)-1;
+}
\ No newline at end of file
diff --git a/plug-ins/xfig/xfig-import.c b/plug-ins/xfig/xfig-import.c
index 08bed85..fbeecc0 100644
--- a/plug-ins/xfig/xfig-import.c
+++ b/plug-ins/xfig/xfig-import.c
@@ -976,7 +976,7 @@ fig_read_text(FILE *file) {
tprop->attr.position.x = x/FIG_UNIT;
tprop->attr.position.y = y/FIG_UNIT;
- if (font_flags & 4) {
+ if ((font_flags & 4) == 0) {
switch (font) {
case 0: tprop->attr.font = dia_font_new_from_legacy_name("Times-Roman"); break;
case 1: tprop->attr.font = dia_font_new_from_legacy_name("Times-Roman"); break;
@@ -990,8 +990,8 @@ fig_read_text(FILE *file) {
} else {
if (font == -1) {
/* "Default font" - wazzat? */
- tprop->attr.font = dia_font_new_from_legacy_name("Times Roman");
- } else if (font < 0 || font > 34) {
+ tprop->attr.font = dia_font_new_from_legacy_name("Times-Roman");
+ } else if (font < 0 || font >= num_fig_fonts()) {
message_warning("Can't find Postscript font nr. %d, using sans\n", font);
tprop->attr.font = dia_font_new_from_legacy_name("Helvetica");
} else {
diff --git a/plug-ins/xfig/xfig.h b/plug-ins/xfig/xfig.h
index fe01392..9fb9622 100644
--- a/plug-ins/xfig/xfig.h
+++ b/plug-ins/xfig/xfig.h
@@ -4,6 +4,8 @@
extern Color fig_default_colors[];
extern char *fig_fonts[];
+int num_fig_fonts (void);
+
#define FIG_MAX_DEFAULT_COLORS 32
#define FIG_MAX_USER_COLORS 512
#define FIG_MAX_DEPTHS 1000
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]