b***@hylafax.org
2010-01-18 23:04:13 UTC
http://bugs.hylafax.org/show_bug.cgi?id=925
Summary: faxmail cannot find ghostscript fonts
Product: HylaFAX
Version: 6.0.3
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: faxmail
AssignedTo: hylafax-***@hylafax.org
ReportedBy: ***@bodo-m.de
For debugging purposes I called faxmail manually and fed a file to stdin that
contains a text-only e-mail.
I get these error messages:
$ faxmail -d ***@987xxxx -n < foo
Warning: /usr/share/ghostscript/8.70/Resource/Init/Fontmap.GS - line too
long.Font Courier: /usr/share/fonts/type1/gsfonts/Courier: Can not open font
metrics file; using fixed widths.
Warning: /usr/share/ghostscript/8.70/Resource/Init/Fontmap.GS - line too
long.Font Helvetica-Bold: /usr/share/fonts/type1/gsfonts/Helvetica-Bold: Can
not open font metrics file; using fixed widths.
Warning: /usr/share/ghostscript/8.70/Resource/Init/Fontmap.GS - line too
long.Font Helvetica-Oblique: /usr/share/fonts/type1/gsfonts/Helvetica-Oblique:
Can not open font metrics file; using fixed widths.
request id is 42 (group id 42) for host localhost (1 file)
I found the error message two times in TextFormat.c++ in function
bool
TextFont::decodeFontName(const char* name, fxStr& filename, fxStr& emsg)
if (strcmp(key, buf + 1) == 0) {
//match - now ensure it is the last one in the file
// for gs compatibility
*(tmp + strcspn(tmp, ") \t;")) = '\0';
fxStr val = tmp;
while (fgets(buf, sizeof(buf), fd) != NULL) {
len = strcspn(buf, "%\n");
*(buf + len) = '\0';
if (len == strlen(buf)) {
emsg = fxStr::format(
"Warning: %s - line too long.", (const char*)
fontMapFile);
break;
}
if (len == 0) continue;
tmp = buf + strcspn(buf, ") \t");
*tmp++ = '\0';
tmp += strspn(tmp, " \t");
if (strcmp(key, buf + 1) == 0) {
*(tmp + strcspn(tmp, ") \t;")) = '\0';
val = tmp;
}
}
I think the problem is this
len = strcspn(buf, "%\n");
*(buf + len) = '\0';
if (len == strlen(buf)) {
Normally a line read from the Fontmap[.GS] file should be terminated with
newline.
strcspn returns the number of characters before the newline or before the
comment character.
The next line replaces the comment character or newline with '\0' which changes
the string length to len.
That's why len == strlen(buf) will always be true.
I think the code should look like this:
while (fgets(buf, sizeof(buf), fd) != NULL) {
len = strcspn(buf, "%\n");
if (len == strlen(buf)) {
emsg = fxStr::format(
"Warning: %s - line too long.", (const char*)
fontMapFile);
break;
}
*(buf + len) = '\0';
if (len == 0) continue;
I observed the problem with the Debian package version 2:6.0.3-5.1, but I used
the relevant part of the latest version from Git repository for debugging.
Summary: faxmail cannot find ghostscript fonts
Product: HylaFAX
Version: 6.0.3
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: faxmail
AssignedTo: hylafax-***@hylafax.org
ReportedBy: ***@bodo-m.de
For debugging purposes I called faxmail manually and fed a file to stdin that
contains a text-only e-mail.
I get these error messages:
$ faxmail -d ***@987xxxx -n < foo
Warning: /usr/share/ghostscript/8.70/Resource/Init/Fontmap.GS - line too
long.Font Courier: /usr/share/fonts/type1/gsfonts/Courier: Can not open font
metrics file; using fixed widths.
Warning: /usr/share/ghostscript/8.70/Resource/Init/Fontmap.GS - line too
long.Font Helvetica-Bold: /usr/share/fonts/type1/gsfonts/Helvetica-Bold: Can
not open font metrics file; using fixed widths.
Warning: /usr/share/ghostscript/8.70/Resource/Init/Fontmap.GS - line too
long.Font Helvetica-Oblique: /usr/share/fonts/type1/gsfonts/Helvetica-Oblique:
Can not open font metrics file; using fixed widths.
request id is 42 (group id 42) for host localhost (1 file)
I found the error message two times in TextFormat.c++ in function
bool
TextFont::decodeFontName(const char* name, fxStr& filename, fxStr& emsg)
if (strcmp(key, buf + 1) == 0) {
//match - now ensure it is the last one in the file
// for gs compatibility
*(tmp + strcspn(tmp, ") \t;")) = '\0';
fxStr val = tmp;
while (fgets(buf, sizeof(buf), fd) != NULL) {
len = strcspn(buf, "%\n");
*(buf + len) = '\0';
if (len == strlen(buf)) {
emsg = fxStr::format(
"Warning: %s - line too long.", (const char*)
fontMapFile);
break;
}
if (len == 0) continue;
tmp = buf + strcspn(buf, ") \t");
*tmp++ = '\0';
tmp += strspn(tmp, " \t");
if (strcmp(key, buf + 1) == 0) {
*(tmp + strcspn(tmp, ") \t;")) = '\0';
val = tmp;
}
}
I think the problem is this
len = strcspn(buf, "%\n");
*(buf + len) = '\0';
if (len == strlen(buf)) {
Normally a line read from the Fontmap[.GS] file should be terminated with
newline.
strcspn returns the number of characters before the newline or before the
comment character.
The next line replaces the comment character or newline with '\0' which changes
the string length to len.
That's why len == strlen(buf) will always be true.
I think the code should look like this:
while (fgets(buf, sizeof(buf), fd) != NULL) {
len = strcspn(buf, "%\n");
if (len == strlen(buf)) {
emsg = fxStr::format(
"Warning: %s - line too long.", (const char*)
fontMapFile);
break;
}
*(buf + len) = '\0';
if (len == 0) continue;
I observed the problem with the Debian package version 2:6.0.3-5.1, but I used
the relevant part of the latest version from Git repository for debugging.
--
Configure bugmail: http://bugs.hylafax.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
____________________ HylaFAX(tm) Developers Mailing List ____________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-devel-***@hylafax.org < /dev/null
Configure bugmail: http://bugs.hylafax.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
____________________ HylaFAX(tm) Developers Mailing List ____________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-devel-***@hylafax.org < /dev/null