- Update to 3.0.9

- Pass maintainership to submitter

Added file(s):
- files/patch-builtin.cpp
- files/patch-directory.cpp
- files/patch-encoding.l
- files/patch-ttf.cpp
- files/patch-util.h

This release contains additional patches and impovements from Redhat and net:
- Compressed fonts support via Zlib
- Improve performance when checking if a font has a mapping present
- Base font file selection on the magic at the start of the file
- iso8859-13 support
- Default read system encodings.dir instead of the one in current directory
- A lot of bugfixes

PR:		ports/100520
Submitted by:	Stanislav Sedov <ssedov@mbsd.msk.ru>
This commit is contained in:
Ion-Mihai Tetcu 2006-07-19 11:06:15 +00:00
parent d3cbeaecad
commit 6e89799a34
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=168232
10 changed files with 285 additions and 33 deletions

View File

@ -6,25 +6,24 @@
#
PORTNAME= ttmkfdir
PORTVERSION= 20021109
PORTREVISION= 1
PORTVERSION= 3.0.9
PORTREVISION= 0
PORTEPOCH= 1
CATEGORIES= x11-fonts x11
MASTER_SITES= http://people.redhat.com/yshao/
DISTNAME= ${PORTNAME}2
MASTER_SITES= http://mbsd.msk.ru/dist/
MAINTAINER= ports@FreeBSD.org
MAINTAINER= ssedov@mbsd.msk.ru
COMMENT= Create fonts.scale file for use with TrueType font server
LIB_DEPENDS= freetype.9:${PORTSDIR}/print/freetype2
USE_AUTOTOOLS= libtool:15:env
PLIST_FILES= bin/ttmkfdir
USE_BZIP2= yes
USE_GMAKE= yes
USE_GETOPT_LONG=yes
USE_X_PREFIX= yes
MAKE_ENV= LDFLAGS="${LDFLAGS}" CXX="${CXX}"
MAKE_ENV= LDFLAGS="${LDFLAGS}" CXXFLAGS="${CFLAGS}" CXX="${CXX}"
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/ttmkfdir ${PREFIX}/bin

View File

@ -1,3 +1,3 @@
MD5 (ttmkfdir2.tar.bz2) = 61efb004b19befdb5335ef058323002c
SHA256 (ttmkfdir2.tar.bz2) = dffa28ad5326ed6903146f7631facb42a0871fc7301785e44f3811bccbc84faa
SIZE (ttmkfdir2.tar.bz2) = 16650
MD5 (ttmkfdir-3.0.9.tar.bz2) = 7fbf13e432aa519669899b13d00673f3
SHA256 (ttmkfdir-3.0.9.tar.bz2) = c65f8e2ba5522c896df2eb7256852bf0a5855109deec0f874379474ef76c1c1c
SIZE (ttmkfdir-3.0.9.tar.bz2) = 20160

View File

@ -1,23 +1,41 @@
--- Makefile.orig Thu Mar 14 14:03:49 2002
+++ Makefile Sun Jan 22 20:15:17 2006
@@ -1,10 +1,7 @@
-FREETYPE_BASE=/usr/include/freetype2
-FREETYPE_INCL=-I$(FREETYPE_BASE)/.
-FREETYPE_LIB=/usr/lib/libfreetype.so
-
--- Makefile.orig Mon Dec 9 19:07:14 2002
+++ Makefile Wed Jul 19 11:35:12 2006
@@ -16,7 +16,6 @@
RELEASE=$(shell rpm -q --qf "%{release}\n" --specfile $(NAME).spec | head -1)
CVSTAG = r$(subst .,_,$(VERSION))
-CVSROOT = $(shell cat CVS/Root)
# Autodetec the proper command used to build RPM packages
RPMBUILD=$(shell [ -x /usr/bin/rpmbuild ] && echo rpmbuild || echo rpm)
@@ -24,11 +23,8 @@
FREETYPE_INCL=$(shell freetype-config --cflags)
FREETYPE_LIB=$(shell freetype-config --libs)
-OPTFLAGS=
-DEBUG=-ggdb
-CXX=g++
-CXXFLAGS=-Wall -pedantic $(FREETYPE_INCL) $(DEBUG)
+FREETYPE_INCL=`freetype-config --cflags`
+FREETYPE_LIB=`freetype-config --libs`
-CXXFLAGS=-Wall -pedantic $(FREETYPE_INCL) $(DEBUG) $(OPTFLAGS)
-LDFLAGS=$(FREETYPE_LIB) $(DEBUG)
+CXXFLAGS+=$(FREETYPE_INCL)
+
+LDFLAGS+=$(FREETYPE_LIB)
+CXXFLAGS+=-Wall $(FREETYPE_INCL)
+LDFLAGS+=$(FREETYPE_LIB) -lz
DESTDIR=
PREFIX=/usr
@@ -39,13 +35,13 @@
all: ttmkfdir
.cpp.o:
- libtool --mode=compile $(CXX) $(CXXFLAGS) -o $@ -c $^
+ $(CXX) $(CXXFLAGS) -o $@ -c $^
ttmkfdir: ttmkfdir.o directory.o commandline.o ttf.o encoding.o parser.o builtin.o
- libtool --mode=link $(CXX) -o $@ $^ $(LDFLAGS)
+ $(CXX) -o $@ $^ $(LDFLAGS)
@@ -21,3 +18,3 @@
parser.cpp: encoding.l
- flex -i -8 -o$@ $<
+ lex -i -8 -o$@ $<
install:
mkdir -p $(DESTDIR)$(BINDIR)

View File

@ -0,0 +1,11 @@
--- builtin.cpp.orig Mon Jan 13 04:11:10 2003
+++ builtin.cpp Wed Jul 19 11:27:41 2006
@@ -600,7 +600,7 @@
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
};
-};
+}
Encoding::BuiltinEncoding_t Encoding::builtin_encodings[] = {
{256,191,32,{TT_PLATFORM_MICROSOFT,TT_MS_ID_UNICODE_CS,iso8859_1},{"iso8859-1",}},

View File

@ -0,0 +1,46 @@
--- directory.cpp.orig Mon Dec 9 11:29:11 2002
+++ directory.cpp Wed Jul 19 11:41:32 2006
@@ -1,7 +1,9 @@
#include <cctype>
#include <dirent.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <fcntl.h>
#include "directory.h"
@@ -37,19 +39,24 @@
bool
ttfdirectory::select (const char *name) const
{
- int len;
+ int fd;
+ unsigned int n;
struct stat buf;
+ char sigdata[8];
+ char TTsig[] = "\000\001\000\000\000", OTsig[] = "OTTO";
/* must be a regular file */
if (::stat (name, &buf) || !(S_ISREG (buf.st_mode))) {
return false;
}
-
- /* we make the decision by the extension of the file name */
- return (((len = strlen (name)) > 4) &&
- (name[len - 4] == '.') &&
- (std::toupper(name[len - 3]) == 'T') &&
- (std::toupper(name[len - 2]) == 'T') &&
- ((std::toupper(name[len - 1]) == 'F') ||
- (std::toupper(name[len - 1]) == 'C')));
+
+ fd = ::open(name, O_RDONLY);
+ if (fd < 0) return false;
+ n = read(fd, sigdata, sizeof(sigdata));
+ close(fd);
+ if (n < sizeof(sigdata))
+ return false;
+
+ return (!memcmp(sigdata, TTsig, 5)
+ || !memcmp(sigdata, OTsig, 4));
}

View File

@ -1,11 +1,79 @@
--- encoding.cpp.orig Tue Mar 12 15:40:09 2002
+++ encoding.cpp Sun Mar 21 22:33:00 2004
@@ -2,7 +2,7 @@
--- encoding.cpp.orig Wed Jul 19 11:30:05 2006
+++ encoding.cpp Wed Jul 19 11:30:28 2006
@@ -2,7 +2,9 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
-#include "freetype/freetype.h"
+#include <unistd.h>
+#include <zlib.h>
+#include <ft2build.h>
#include "ttmkfdir.h"
#include "encoding.h"
@@ -32,9 +34,16 @@
NextFile (FILE *f, char *name)
{
char file_name [1024];
- char command[1024];
+ char line_buf [1024];
+ char tmp_file_name[] = "/tmp/ttmkfdir_XXXXXX";
+ char inbuf[300000];
+ FILE *od;
+ gzFile fd;
+ int rvalue, tmpfd;
- if (fscanf (f, "%*s %[^\n]\n", file_name) == 1) {
+ if (fgets (line_buf, sizeof(line_buf), f) != NULL) {
+
+ sscanf (line_buf, "%*s %[^\n]\n", file_name);
if (file_name[0] == '/') {
name[0] = 0;
@@ -44,9 +53,25 @@
strcat (name, file_name);
- sprintf (command, "exec %s < %s", (toupper(name[strlen (name) - 1]) == 'Z')
- ? "gzip -d" : "cat", name);
- return popen (command, "r");
+ bzero(inbuf, sizeof(inbuf));
+
+ fd = gzopen (name,"rb");
+ rvalue = gzread (fd, inbuf, sizeof(inbuf));
+
+ tmpfd = mkstemp (tmp_file_name);
+ if (tmpfd == -1) {
+ return 0;
+ }
+
+ od = fdopen (tmpfd,"w");
+ fputs (inbuf, od);
+ fflush (od);
+ fclose (od);
+
+ od = fopen (tmp_file_name,"r");
+ unlink (tmp_file_name);
+ return od;
+
}
return 0;
@@ -75,7 +100,7 @@
yyrestart (input);
yylex (name, *this);
- pclose (input);
+ fclose (input);
}
fclose (f);
@@ -97,7 +122,7 @@
NumericMapping *m = new NumericMapping (size, b->mapdata.platform, b->mapdata.encoding);
- for (int i = 0; i < size; i++)
+ for (unsigned int i = 0; i < size; i++)
(*m)[i] = b->mapdata.mappingtable[i];
AddMapping (m);

View File

@ -0,0 +1,44 @@
--- encoding.l.orig Wed Jul 19 11:39:18 2006
+++ encoding.l Wed Jul 19 11:39:22 2006
@@ -8,7 +8,7 @@
#include "ttmkfdir.h"
#include "encoding.h"
-#define DEFAULT_SIZE 0x100 /* 8 bit encoding */
+#define DEFAULT_SIZE 0xFFFF /* 8 bit encoding */
#define YY_DECL int yylex (char *current_file, Encodings_t &dest)
static unsigned int line_number = 1;
@@ -43,6 +43,7 @@
STARTENCODING{WHITESPACES}{STRING} {
cur_enc = new Encoding;
cur_enc->names.push_back (strip_first (yytext));
+ cur_enc->size = DEFAULT_SIZE;
BEGIN(INSIDE_ENC_BLOCK);
}
@@ -97,6 +98,7 @@
<INSIDE_MAP_BLOCK>UNDEFINE{WHITESPACES}{NUMBER}({WHITESPACES}{NUMBER})? {
char *startptr = strip_first (yytext);
char *endptr;
+ long msize = cur_map->size();
int i1 = std::strtol (startptr, &endptr, 0);
startptr = endptr;
@@ -108,13 +110,14 @@
}
/* now mark all the unassigned codes */
- for (long i = i1; i <= i2; i++) {
+ for (long i = i1; i <= i2 && i < msize; i++) {
(*cur_map)[i] = -1;
}
}
<INSIDE_MAP_BLOCK>{NUMBER}({WHITESPACES}{NUMBER}){0,2} {
- int numbers[3], i = 0, start_range, end_range, target, res;
+ int numbers[3], target, res;
+ unsigned int i = 0, start_range, end_range;
char *startptr;
char *endptr = yytext;

View File

@ -0,0 +1,46 @@
--- ttf.cpp.orig Wed Jul 19 11:13:20 2006
+++ ttf.cpp Wed Jul 19 11:22:41 2006
@@ -51,20 +51,27 @@
bool
Face::MappingPresent (int cmapidx, NumericMapping *m, int enc_size, int start_code, bool enc_comp)
{
- int idx, missing = 0;
+ int idx;
+ unsigned int missing = 0, bail_at, msize;
+
FT_Set_Charmap (face, face->charmaps[cmapidx]);
- for (unsigned int i = start_code; i < m->size (); i++) {
+ msize = m->size();
+ if (enc_size <= 256) {
+ bail_at = int (cmdline::instance()->option ("max-missing"));
+ } else {
+ bail_at = ((int (cmdline::instance()->option ("max-missing-percentage"))
+& enc_comp)*enc_size)/100;
+ }
+
+ for (unsigned int i = start_code; i < msize && missing < bail_at; i++) {
if ((*m)[i] < 0)
continue;
if ((idx = FT_Get_Char_Index (face, (*m)[i])) == 0)
missing++;
}
- if (enc_size <= 256) {
- return (missing <= int (cmdline::instance()->option ("max-missing")));
- } else {
- return ((100 * missing/enc_size) <= int (cmdline::instance()->option ("max-missing-percentage")) & enc_comp);
- }
+
+ return missing < bail_at;
}
Face::Face (const std::string &filename)
@@ -239,7 +246,7 @@
for (i = 0; i < n; i++) {
if ((fterror = FT_Get_Sfnt_Name (face, i, &NamePtr)) != FT_Err_Ok) {
std::cout << "Warning: Can't SFNT name : " << FileName << "(" << fterror << ")" << std::endl;
- return;
+ return NULL;
};
platform = NamePtr.platform_id;
encoding = NamePtr.encoding_id;

View File

@ -1,6 +1,6 @@
--- ttf.h.orig Wed Mar 13 19:16:38 2002
+++ ttf.h Sun Mar 21 22:30:16 2004
@@ -3,15 +3,18 @@
--- ttf.h.orig Wed Jul 19 11:36:47 2006
+++ ttf.h Wed Jul 19 11:36:50 2006
@@ -3,16 +3,19 @@
#define TTF_H__
#include <string>
@ -20,8 +20,18 @@
#include "util.h"
#include "encoding.h"
+
+using namespace std;
+using namespace std;
+
namespace ttf {
class Face {
@@ -49,7 +52,7 @@
TT_Postscript *post;
std::string FileName;
};
-};
+}
#endif /* TTF_H__ */

View File

@ -0,0 +1,10 @@
--- util.h.orig Mon Dec 9 11:29:11 2002
+++ util.h Wed Jul 19 11:27:37 2006
@@ -17,6 +17,6 @@
Singleton (void) {};
~Singleton (void) {};
};
-};
+}
#endif // TTMKFDIRUTIL_H__