View | Details | Raw Unified | Return to bug 213600
Collapse All | Expand All

(-)Makefile (-9 / +3 lines)
Lines 5-15 PORTNAME= alfont Link Here
5
PORTVERSION=	209
5
PORTVERSION=	209
6
PORTREVISION=	2
6
PORTREVISION=	2
7
CATEGORIES=	x11-fonts
7
CATEGORIES=	x11-fonts
8
MASTER_SITES=	http://opensnc.sourceforge.net/alfont/mirror/ \
8
MASTER_SITES=	http://opensnc.sourceforge.net/alfont/mirror/
9
		SF/nemysisfreebsdp/${CATEGORIES}/${PORTNAME}/:nemysis
9
DISTFILES=	AlFont${DISTVERSION}.rar
10
#		http://opensnc.sourceforge.net/alfont/:opensnc
10
11
DISTFILES=	AlFont${DISTVERSION}.rar \
12
		alfont.c:nemysis
13
DIST_SUBDIR=	${PORTNAME}
11
DIST_SUBDIR=	${PORTNAME}
14
EXTRACT_ONLY=	AlFont${DISTVERSION}.rar
12
EXTRACT_ONLY=	AlFont${DISTVERSION}.rar
15
13
Lines 21-28 LICENSE_NAME= The FreeType Project LICEN Link Here
21
LICENSE_FILE=	${WRKSRC}/docs/FTL.txt
19
LICENSE_FILE=	${WRKSRC}/docs/FTL.txt
22
LICENSE_PERMS=	auto-accept
20
LICENSE_PERMS=	auto-accept
23
21
24
BROKEN=		unfetchable
25
26
EXTRACT_DEPENDS=	unrar:archivers/unrar
22
EXTRACT_DEPENDS=	unrar:archivers/unrar
27
LIB_DEPENDS=	liballeg.so.4:devel/allegro \
23
LIB_DEPENDS=	liballeg.so.4:devel/allegro \
28
		libfreetype.so:print/freetype2
24
		libfreetype.so:print/freetype2
Lines 60-67 do-extract: Link Here
60
		${_DISTDIR}/AlFont${DISTVERSION}.rar
56
		${_DISTDIR}/AlFont${DISTVERSION}.rar
61
57
62
post-patch:
58
post-patch:
63
	@${CP} -af ${_DISTDIR}/alfont.c ${WRKSRC}/src
64
65
	@${REINPLACE_CMD} -e \
59
	@${REINPLACE_CMD} -e \
66
		's|#define ALFONT_WINDOWS|//#define ALFONT_WINDOWS|; \
60
		's|#define ALFONT_WINDOWS|//#define ALFONT_WINDOWS|; \
67
		 s|//#define ALFONT_LINUX|#define ALFONT_LINUX|; \
61
		 s|//#define ALFONT_LINUX|#define ALFONT_LINUX|; \
(-)files/patch-src_alfont.c (+120 lines)
Added Link Here
1
--- src/alfont.c.orig	2016-10-18 20:04:21 UTC
2
+++ src/alfont.c
3
@@ -1,3 +1,28 @@
4
+/*
5
+ * Modified Alfont 2.0.9
6
+ *
7
+ * The original AllegroFont v2.0.9 has a few problems.
8
+ * This modification solves them.
9
+ *
10
+ * Modification by: Alexandre Martins (thanks to http://allegro.cc forums)
11
+ * Modification date: 2010-10-30
12
+ *
13
+ * Modification by: Rusmir Dusko
14
+ * (thanks to http://allegro.cc forums and Hans de Goede [alfont] Fix undefined reference to _msize)
15
+ * Modification date: 2014-03-10
16
+ *
17
+ * Original Alfont website: http://chernsha.sitesled.com/
18
+ * AllegroFont (c) 2001, 2002 Javier Gonzalez
19
+ * Enhanced by Chernsha since 2004 year
20
+ */
21
+
22
+//#define malloc_usable_size malloc_size
23
+
24
+#ifdef __GNUC__
25
+#define _msize malloc_usable_size
26
+#include <malloc_np.h>
27
+#endif
28
+
29
 /* AllegroFont - a wrapper for FreeType 2 */
30
 /* to render TTF and other font formats with Allegro */
31
 
32
@@ -336,7 +361,7 @@ int alfont_set_font_size(ALFONT_FONT *f,
33
       break;
34
 
35
     /* compare real height with asked height */
36
-    real_height = abs(f->face->size->metrics.ascender >> 6) + abs(f->face->size->metrics.descender >> 6);
37
+    real_height = labs(f->face->size->metrics.ascender >> 6) + labs(f->face->size->metrics.descender >> 6);
38
     if (real_height == h) {
39
       /* we found the wanted height */
40
       break;
41
@@ -468,7 +493,7 @@ ALFONT_FONT *alfont_load_font(const char
42
   alfont_set_char_extra_spacing(font, 0);
43
 
44
   //Initial Font attribute
45
-  font->language="";		   /* Initial Language */
46
+  font->language=NULL;		   /* Initial Language */
47
   font->type=0;				   /* Initial Code Convert */
48
   font->outline_top=0;		   /* Initial Font top outline width */
49
   font->outline_bottom=0;	   /* Initial Font bottom outline width */
50
@@ -515,7 +540,7 @@ ALFONT_FONT *alfont_load_font_from_mem(c
51
   memcpy((void *)font->data, (void *)data, data_len);
52
 
53
   /* load the font */
54
-  error = FT_New_Memory_Face(ft_library, font->data, font->data_size, 0, &font->face);
55
+  error = FT_New_Memory_Face(ft_library, (unsigned char*)font->data, font->data_size, 0, &font->face);
56
 
57
   if (error) {
58
     free(font->data);
59
@@ -548,7 +573,7 @@ ALFONT_FONT *alfont_load_font_from_mem(c
60
   alfont_set_char_extra_spacing(font, 0);
61
 
62
   //Initial Font attribute
63
-  font->language="";		   /* Initial Language */
64
+  font->language=NULL;		   /* Initial Language */
65
   font->type=0;				   /* Initial Code Convert */
66
   font->outline_top=0;		   /* Initial Font top outline width */
67
   font->outline_bottom=0;	   /* Initial Font bottom outline width */
68
@@ -3761,15 +3786,15 @@ int alfont_ugetx(ALFONT_FONT *f, char **
69
   //advances the *s pointer to the next character
70
 
71
   if (f->type==1) {
72
-  	ugetxc((char**)s);
73
+  	ugetxc((const char**)s);
74
 	#ifdef ALFONT_LINUX
75
-	ugetxc((char**)s);
76
+	ugetxc((const char**)s);
77
 	#endif
78
   }
79
   else if(f->type==2) {
80
-	ugetxc(&lpszWS);
81
+	ugetxc((const char**)&lpszWS);
82
 	#ifdef ALFONT_LINUX
83
-	ugetxc(&lpszWS);
84
+	ugetxc((const char**)&lpszWS);
85
 	#endif
86
   	#ifdef ALFONT_DOS
87
 	if ((c_pt = iconv_open(f->language, "UTF-16LE")) == (iconv_t)-1) {
88
@@ -3814,9 +3839,9 @@ int alfont_ugetx(ALFONT_FONT *f, char **
89
     #ifdef ALFONT_LINUX
90
 	set_uformat(U_UTF8);
91
     #endif
92
-	ugetxc((char**)s);
93
+	ugetxc((const char**)s);
94
 	#ifdef ALFONT_LINUX
95
-	ugetxc((char**)s);
96
+	ugetxc((const char**)s);
97
 	#endif
98
   }
99
 
100
@@ -4083,9 +4108,9 @@ int alfont_ugetxc(ALFONT_FONT *f, const 
101
 	#endif
102
   }
103
   else if(f->type==2) {
104
-	ugetxc(&lpszWS);
105
+	ugetxc((const char**)&lpszWS);
106
 	#ifdef ALFONT_LINUX
107
-	ugetxc(&lpszWS);
108
+	ugetxc((const char**)&lpszWS);
109
 	#endif
110
   	#ifdef ALFONT_DOS
111
 	if ((c_pt = iconv_open(f->language, "UTF-16LE")) == (iconv_t)-1) {
112
@@ -4828,7 +4853,7 @@ void alfont_set_language(ALFONT_FONT *f,
113
   }
114
   else
115
   {
116
-	f->language=(char *)malloc(strlen(language)*sizeof(char));
117
+	f->language=(char *)malloc((strlen(language)+1)*sizeof(char));
118
 	strcpy(f->language,language);
119
   }
120
 }

Return to bug 213600