Discussion:
[Bug 925] New: faxmail cannot find ghostscript fonts
b***@hylafax.org
2010-01-18 23:04:13 UTC
Permalink
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.
--
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
b***@hylafax.org
2010-01-19 01:40:35 UTC
Permalink
http://bugs.hylafax.org/show_bug.cgi?id=925





------- Comment #1 from ***@howardsilvan.com 2010-01-18 20:40 -------
We fixed this in HylaFAX+ 5.3.0 a bit differently.

Does your suggested code change actually work for you?

One of the problems that you're going to find over time is that Ghostscript has
removed font metric information for many font aliases.

http://hylafax.cvs.sourceforge.net/viewvc/hylafax/hylafax/util/TextFormat.c%2B%2B?r1=1.6&r2=1.7
http://hylafax.cvs.sourceforge.net/viewvc/hylafax/hylafax/util/TextFormat.c%2B%2B?r1=1.7&r2=1.8
http://hylafax.cvs.sourceforge.net/viewvc/hylafax/hylafax/etc/faxsetup.sh.in?r1=1.24&r2=1.25
http://hylafax.cvs.sourceforge.net/viewvc/*checkout*/hylafax/hylafax/util/genfontmap.ps?revision=1.1

Hopefully that's all of it.
--
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
b***@hylafax.org
2010-01-19 06:36:27 UTC
Permalink
http://bugs.hylafax.org/show_bug.cgi?id=925


***@bodo-m.de changed:

What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |trivial
Summary|faxmail cannot find |bogus error message when
|ghostscript fonts |font metrics not found




------- Comment #2 from ***@bodo-m.de 2010-01-19 01:36 -------
(In reply to comment #1)
Post by b***@hylafax.org
Does your suggested code change actually work for you?
I did not yet test my code change.
I extracted the relevant function from the source code and ran it with GDB.
When it had found the alias for Courier and tried to check if it's the last
matching line, it produced the error message.
I stopped debugging at this point because I found some bug.

After looking at the source code and the Fontmap.GS file again I think my
change will only remove the error message but not the problem finding the font
metrics.

I found another Fontmap file on my system. When I add the corresponding fontmap
path the error is gone.

The only remaining problem is that TextFont::decodeFontName() should store an
error message like "font not found in FontMap or FontPath" in this error
situation.

My code change will only remove the bogus error message "line too long".

I changed the summary and severity.

In my case it might be a bug of the Debian package that does not include the
correct FontMap path in hyla.conf. I will report this to the Debian BTS.
--
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
b***@hylafax.org
2010-10-13 20:39:00 UTC
Permalink
http://bugs.hylafax.org/show_bug.cgi?id=925





------- Comment #3 from ***@mcgill.ca 2010-10-13 16:38 -------
Created an attachment (id=1190)
--> (http://bugs.hylafax.org/attachment.cgi?id=1190&action=view)
config.log
--
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
b***@hylafax.org
2010-10-13 20:51:32 UTC
Permalink
http://bugs.hylafax.org/show_bug.cgi?id=925


***@ifax.com changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #1190 is|0 |1
obsolete| |
--
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
Loading...