Bug 210278 - Problems using scalable fonts in XFig
Problems using scalable fonts in XFig
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: xfig (Show other bugs)
7
All Linux
medium Severity medium
: ---
: ---
Assigned To: Hans de Goede
: Reopened
: 56490 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-10-11 04:45 EDT by Fred Nosferatu
Modified: 2008-07-18 13:00 EDT (History)
2 users (show)

See Also:
Fixed In Version: 3.2.5-5.fc8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-07-18 12:49:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Patch to fix Xfig's scalable fonts handling (7.91 KB, patch)
2006-10-11 04:51 EDT, Fred Nosferatu
no flags Details | Diff
Patch to fix XFig's scalable font handling (6.57 KB, patch)
2006-10-11 04:57 EDT, Fred Nosferatu
no flags Details | Diff

  None (edit)
Description Fred Nosferatu 2006-10-11 04:45:12 EDT
*** Description of problem:
There is a problem using scalable fonts in XFig.  Basically, with a "virgin"
FC-3, -4 or -5 installation, the URW scalable fonts are not found, and so the
on-screen display is severely limited for text objects at zooms different to 1
and for text-sizes other than the default.  XFig can still be used, but
positioning text objects accurately in relation to other objects becomes impossible.

Related to this is the total absence of the AvantGarde fonts from XFig's display.

Other, apparently similar, font problems are mentioned in bugs 56940, 116542 and
195468, but my problem seemed different enough to create a new bug-report.

*** Version-Release number of selected component (if applicable): 
My version is xfig-3.2.4-17.2, but FC-3's releases have it too, and I believe
that xfig-3.2.4-21.1 from devel has it too.

*** How reproducible:
Very

*** Steps to Reproduce:
1.  Start XFig
2.  Change zoomlevel to 3
3.  Select 15-pt TimesItalic
4.  Put in some text, and see that it looks wonky.
  
*** Solution
Going over the sources, you'll find that the fonts are all hard-coded into the
file u_fonts.c.  Basically Xfig will try to find the font you selected by
looking through a list provided in u_fonts.c .  The trouble is that the URW
fonts are named differently to the fonts provided in earlier Red Hat
distributions (6.2, for example).  So you have the right fonts on your system,
but XFig looks for them with the wrong names.

The author of Xfig recommends the installation of the Adobe fonts, but I really
think for such a simple problem there must a simpler solution!  I've got a patch
attached that patches u_fonts.c with the names of the correct URW fonts, and als
patches w_drawprim.c .  In the latter file, some jiggery-pokery is done to
ensure that the zapf dingbats font is found, but on virgin FC distributions this
font will be named -urw-dingbats.

It's a silly solution, I know.  XFig's font-handling really ought to be made
more general, but I can't think how.
Comment 1 Fred Nosferatu 2006-10-11 04:51:36 EDT
Created attachment 138229 [details]
Patch to fix Xfig's scalable fonts handling
Comment 2 Fred Nosferatu 2006-10-11 04:57:17 EDT
Created attachment 138230 [details]
Patch to fix XFig's scalable font handling
Comment 3 Hans de Goede 2007-11-15 17:45:31 EST
*** Bug 56490 has been marked as a duplicate of this bug. ***
Comment 4 Hans de Goede 2007-11-16 16:07:13 EST
Thanks for the patch! I've incorporated it into xfig-3.2.5-5, which should show
up in updates-testing for both F-7 and F-8 in the next couple of days.

When xfig-3.2.5-5 becomes available, the updates system will add a comment here
to notify you of this. Then you can install it with this command:
yum --enablerepo=updates-testing update xfig

Note when testing on F-8, that there might be a problem with your font
configuration there, do: "/usr/share/fonts/default/Type1" and if there is no
fonts.dir file there, run this as root:
mkfontdir /usr/share/fonts/default/Type1

And then do: "xset fp rehash" to reload X's font configuration.
Comment 5 Fedora Update System 2007-11-17 00:31:09 EST
xfig-3.2.5-5.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update xfig'
Comment 6 Fedora Update System 2007-11-17 00:36:12 EST
xfig-3.2.5-5.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update xfig'
Comment 7 Fred Nosferatu 2007-11-26 08:12:22 EST
Dear Hans & Co

The patch I submitted earlier was a dirty hack, designed to get XFig running on
my system as quickly as possible.  It's not a complete solution to the problem
at all.  For example, I don't expect the patched XFig to work on all other
distributions.  I'd like to get some ideas from you guys for a more civilized fix.

I REALLY don't like the fact that the fonts are hard-coded in as they are.  Here
are some suggestions for more civilized behaviour:

1.  we put a two-column text file somewhere that XFig can read, containing
    the names of the standard XFig fonts (say  Times-Roman, Times-Bold, ...)
    on the left and the URW font names (say 
    -urw-times-medium-r-normal--0-0-0-0-p-0-iso8859-1, etc.) on the right.
    Then struct _xfstruct x_fontinfo can be initialized from this file.
    This way, users have the option to specify different display fonts
    without having to recompile the program, and XFig would then be portable
    from one distro to another without the need to recompile.

    (Down side:  exposure to the nut behind the wheel)


2.  A configuration program, similar to the existing XFig font dialog might
    be provided to produce the text file in (1), perhaps using xfontsel to
    select the fonts.  So you might start this hypothetical XfigFontConf,
    click on the button that says "Helvetica Bold";  this brings up XFontSel,
    perhaps primed some of the relevant information via the -pattern option, 
    and allows the user to select the relevant font.

    (Down side:  Seems fool-proof, but they're sure to improve the fools.
     Also, now there are two programs to maintain...)

3.  As a further refinement, we might build this hypothetical XfigfontConf 
    into XFig, which can already detect missing scalable fonts (it gives error 
    messages, if I recall, if you select a missing font).

Of course, all of these have pitfalls.  Remember, these select DISPLAY fonts,
not the fonts that end up in PostScript files, etc., which are themselves also
hard-coded.  Does anybody have any better ideas?  I must say, the font-handling
in X does seem to be extremely complicated from the user's perspective, compared
to certain other operating $ystems...

Regards,

FN
Comment 8 Hans de Goede 2007-11-26 11:09:31 EST
(In reply to comment #7)
> Dear Hans & Co
> 
> The patch I submitted earlier was a dirty hack, designed to get XFig running on
> my system as quickly as possible.  It's not a complete solution to the problem
> at all.  For example, I don't expect the patched XFig to work on all other
> distributions.  I'd like to get some ideas from you guys for a more civilized fix.
> 

Well since this is the Fedora package its not meant to work on other distro's
OTOH, if they have the urw-fonts installed it should work fine. I've checked the
.fig files and they do not contain the font-names, so this will not cause import
/ export problems when moving to other versions / spins of xfig.

So while I agree this is not perfect, as long as we require urw-fonts (and we
do) this works just fine.

I've read your proposed solutions but they seem to cause more pain then they
fix. Our current fixed version "just works (tm)", without needing any tweaking,
I think that is as good as it gets, without getting unnecessary complicated.
Comment 9 Fedora Update System 2007-11-26 13:44:15 EST
xfig-3.2.5-5.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 10 Terje Røsten 2007-11-27 14:22:38 EST
It's a bug in urw-fonts which adds to the pain:  #401641.

A workaround until a update is released is the following:

# As root:

$ rpm -e --nodeps urw-fonts
# There must be two yum steps
$ yum install xorg-x11-font-utils
$ yum install urw-fonts

# X user
$ xset fp rehash


With this fix, and xfig-3.2.4-5 package thing works.

BTW: thanks for Xaw3d version, Hans!





Comment 11 Fedora Update System 2007-11-28 20:45:39 EST
xfig-3.2.5-5.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.