[Bf-committers] Possible fix for bug #1483 (Internat. font path badly constructed)

Stefan Gartner bf-committers@blender.org
Fri, 6 Aug 2004 11:29:21 +0200


--Boundary-03=_190EBurPv02PN4u
Content-Type: multipart/mixed;
  boundary="Boundary-01=_x90EBCUy+xw6yyL"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--Boundary-01=_x90EBCUy+xw6yyL
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi all,
the attached patch should fix bug #1483, however I'm not quite sure if it's=
=20
100% correct. Especially the following questions remain:

* is there a better way than using BLI_split_dirfile() to get the basename =
of
  a file?
* Why is the full path to the font file stored in U.fontname?

greetings,
sgefant

--Boundary-01=_x90EBCUy+xw6yyL
Content-Type: text/x-diff;
  charset="us-ascii";
  name="fontpath.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="fontpath.diff"

Index: source/blender/src/language.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/bf-blender/blender/source/blender/src/language.c,v
retrieving revision 1.25
diff -u -p -I"$Id:.*" -r1.25 language.c
=2D-- source/blender/src/language.c	10 Jul 2004 13:48:12 -0000	1.25
+++ source/blender/src/language.c	6 Aug 2004 09:12:39 -0000
@@ -201,6 +201,8 @@ void set_interface_font(char *str)=20
 void start_interface_font(void)=20
 {
 	char tstr[FILE_MAXDIR+FILE_MAXFILE];
+	char dirbuf[FILE_MAXDIR];
+	char filebuf[FILE_MAXFILE];
 	int result =3D 0;
 #ifdef __APPLE__
 	char *bundlepath;
@@ -211,7 +213,8 @@ void start_interface_font(void)=20
 =09
 	if(U.fontsize !=3D 0) { // we have saved user settings
 		// try load the font from the font dir
=2D		BLI_make_file_string("/", tstr, U.fontdir, U.fontname);
+		BLI_split_dirfile(U.fontname, dirbuf, filebuf);
+		BLI_make_file_string("/", tstr, U.fontdir, filebuf);
 		result =3D FTF_SetFont(tstr, U.fontsize);
=20
 		if(!result) {	// else try loading font from current dir
Index: source/blender/src/headerbuttons.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/bf-blender/blender/source/blender/src/headerbuttons.c,v
retrieving revision 1.83
diff -u -p -I"$Id:.*" -r1.83 headerbuttons.c
=2D-- source/blender/src/headerbuttons.c	26 Jul 2004 21:32:56 -0000	1.83
+++ source/blender/src/headerbuttons.c	6 Aug 2004 09:12:40 -0000
@@ -658,6 +658,8 @@ void do_global_buttons(unsigned short ev
 	ScrArea *sa;
 	int nr=3D 1;
 	char buf[FILE_MAXDIR+FILE_MAXFILE];
+	char dirbuf[FILE_MAXDIR];
+	char filebuf[FILE_MAXFILE];
=20
=20
 	ob=3D OBACT;
@@ -1549,7 +1551,9 @@ void do_global_buttons(unsigned short ev
 			sa=3D closest_bigger_area();
 			areawinset(sa->win);
 		}
=2D		BLI_make_file_string("/", buf, U.fontdir, U.fontname);
+
+		BLI_split_dirfile(U.fontname, dirbuf, filebuf);
+		BLI_make_file_string("/", buf, U.fontdir, filebuf);
 		activate_fileselect(FILE_SPECIAL, "LOAD UI FONT", buf, set_interface_fon=
t);
 		break;
=20

--Boundary-01=_x90EBCUy+xw6yyL--

--Boundary-03=_190EBurPv02PN4u
Content-Type: application/pgp-signature
Content-Description: signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBBE091+200iUD+EwYRAsLKAKCP27q7yhZkV9p9F3B+Y5Lo65u2GQCbBpS7
4gUqc51PG618HXbAMKv6+NE=
=B1I6
-----END PGP SIGNATURE-----

--Boundary-03=_190EBurPv02PN4u--