[blender/f18] Loading droid-sans font from /usr/share/fonts (#867205)

Jochen Schmitt s4504kr at fedoraproject.org
Fri Oct 26 18:12:49 UTC 2012


commit 8111f425033e034b4072e3f4e4acf6cb9c28b940
Author: Jochen Schmitt <Jochen at herr-schmitt.de>
Date:   Thu Oct 18 11:37:03 2012 +0200

    Loading droid-sans font from /usr/share/fonts (#867205)

 blender-2.64a-droid.patch |   88 +++++++++++++++++++++++++++++++++++++++++++++
 blender.spec              |   13 +++++--
 2 files changed, 98 insertions(+), 3 deletions(-)
---
diff --git a/blender-2.64a-droid.patch b/blender-2.64a-droid.patch
new file mode 100644
index 0000000..b46094d
--- /dev/null
+++ b/blender-2.64a-droid.patch
@@ -0,0 +1,88 @@
+diff -up blender-2.64/source/blender/blenfont/intern/blf_translation.c.droid blender-2.64/source/blender/blenfont/intern/blf_translation.c
+--- blender-2.64/source/blender/blenfont/intern/blf_translation.c.droid	2012-10-17 14:14:42.976000002 +0200
++++ blender-2.64/source/blender/blenfont/intern/blf_translation.c	2012-10-18 09:49:29.559862273 +0200
+@@ -57,27 +57,23 @@
+ #include "DNA_userdef_types.h" /* For user settings. */
+ 
+ #ifdef WITH_INTERNATIONAL
+-static const char unifont_filename[] = "droidsans.ttf.gz";
++static const char unifont_filename[] = "droidsans.ttf";
+ static unsigned char *unifont_ttf = NULL;
+ static int unifont_size = 0;
+ 
+ unsigned char *BLF_get_unifont(int *unifont_size_r)
+ {
++	const char *fontpath = "/usr/share/fonts/google-droid";
++
+ 	if (unifont_ttf == NULL) {
+-		char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts");
+-		if (fontpath) {
+-			char unifont_path[1024];
+-
+-			BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename);
+-
+-			unifont_ttf = (unsigned char *)BLI_file_ungzip_to_mem(unifont_path, &unifont_size);
+-		}
+-		else {
+-			printf("%s: 'fonts' data path not found for international font, continuing\n", __func__);
+-		}
+-	}
++	  char unifont_path[1024];
++
++	  BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename);
+ 
+-	*unifont_size_r = unifont_size;
++	  unifont_ttf = (unsigned char *)BLI_file_to_mem(unifont_path, &unifont_size);
++
++	  *unifont_size_r = unifont_size;
++	}
+ 
+ 	return unifont_ttf;
+ }
+diff -up blender-2.64/source/blender/blenlib/BLI_fileops.h.droid blender-2.64/source/blender/blenlib/BLI_fileops.h
+--- blender-2.64/source/blender/blenlib/BLI_fileops.h.droid	2012-10-18 08:59:41.823290185 +0200
++++ blender-2.64/source/blender/blenlib/BLI_fileops.h	2012-10-18 09:26:35.989470635 +0200
+@@ -81,6 +81,8 @@ int    BLI_file_touch(const char *file);
+ int    BLI_file_gzip(const char *from, const char *to);
+ char  *BLI_file_ungzip_to_mem(const char *from_file, int *size_r);
+ 
++char *BLI_file_to_mem(const char *from_file, int *size_r);
++
+ size_t BLI_file_descriptor_size(int file);
+ size_t BLI_file_size(const char *file);
+ 
+diff -up blender-2.64/source/blender/blenlib/intern/fileops.c.droid blender-2.64/source/blender/blenlib/intern/fileops.c
+--- blender-2.64/source/blender/blenlib/intern/fileops.c.droid	2012-10-18 08:46:31.095218862 +0200
++++ blender-2.64/source/blender/blenlib/intern/fileops.c	2012-10-18 10:19:08.366408308 +0200
+@@ -153,6 +153,31 @@ char *BLI_file_ungzip_to_mem(const char
+ 	return mem;
+ }
+ 
++char *BLI_file_to_mem(const char *from_file, int *size_r)
++{
++        int file;
++	int size = 0;
++	char *mem = NULL;
++
++	file = BLI_open(from_file, O_RDONLY, 0);
++
++	size = BLI_file_descriptor_size(file);
++       
++	if (size == 0) {
++	  close (file);
++	  return 0;
++	}
++      
++	mem = MEM_callocN(size, "BLI_ungzip_to_mem");
++		
++	read(file, mem, size);
++	
++	close (file);
++
++	*size_r = size;
++
++	return mem;
++}
+ 
+ /* return 1 when file can be written */
+ int BLI_file_is_writable(const char *filename)
diff --git a/blender.spec b/blender.spec
index 9c21bd0..2c2423d 100644
--- a/blender.spec
+++ b/blender.spec
@@ -13,7 +13,7 @@
 Name:           blender
 Epoch:          1
 Version:        %{blender_api}a
-Release:        1%{?dist}
+Release:        2%{?dist}
 
 Summary:        3D modeling, animation, rendering and post-production
 
@@ -34,6 +34,8 @@ Patch3:        blender-2.64-openjpeg_stdbool.patch
 # fix build on non-x86 64-bit arches
 Patch4:        blender-2.64-64bit.patch
 
+Patch5:	       blender-2.64a-droid.patch
+
 BuildRequires:  desktop-file-utils
 BuildRequires:  gettext
 BuildRequires:  libtool
@@ -93,8 +95,6 @@ Requires(post): shared-mime-info
 Requires(postun): desktop-file-utils
 Requires(postun): shared-mime-info
 
-Requires:	  blender-fonts = %{?epoch:%{epoch}:}%{version}-%{release}
-
 %if 0%{?fedora} > 10
 Requires:	  dejavu-sans-fonts
 %endif
@@ -103,6 +103,8 @@ Requires:	  dejavu-sans-fonts
 Requires:	  dejavu-fonts
 %endif
 
+Requires:	  google-droid-sans-fonts
+
 Provides:	  blender(ABI) = %{blender_api}
 
 Provides:	  blender-fonts = %{?epoch:%{epoch}:}%{version}-%{release}
@@ -143,6 +145,8 @@ addon packages to extend blender.
 %patch3 -p1 -b .openjpeg_stdbool
 %patch4 -p1 -b .64bit
 
+%patch5 -p1 -b .droid
+
 find -name '.svn' -print | xargs rm -rf
 
 %build
@@ -273,6 +277,9 @@ fi || :
 %{_sysconfdir}/rpm/macros.blender
 
 %changelog
+* Thu Oct 18 2012 Jochen Schmitt <Jochen herr-schmitt de> - 1:2.64a-2
+- Loading droid-sans font from /usr/share/fonts (#867205)
+
 * Tue Oct  9 2012 Jochen Schmitt <Jochen herr-schmitt de> - 1:2.64a-1
 - New minor upstream update release
 


More information about the scm-commits mailing list