Closed Bug 211020 Opened 21 years ago Closed 21 years ago

[ps] Unused data in gfx/src/ps/font_metrics.c

Categories

(Core :: Printing: Output, defect)

All
Linux
defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: kherron+mozilla, Unassigned)

Details

(Keywords: memory-footprint)

Attachments

(1 file)

gfx/src/ps/font_metrics.c defines an array of font metrics data structures for
eight postscript fonts. When compiled it produces about 25k of data.

This array is  only referenced in one place, in nsPostScriptObj.cpp. The
reference in question is #ifdef OLDFONTS; I couldn't find any other reference to
this symbol in the source tree. The name of each font is the only part
referenced, so all of the font metric information is going to waste.

Another set of font metric information is defined in Times-Bold.h etc. The data
in font_metrics.c appears to be obsolete code.
The array in question is called PSFE_MaskToFI; it's an array of PS_FontInfo
structures. This patch removes the references to PSFE_MaskToFI from
nsPostScriptObj.cpp.

With the array removed, the only other PS_FontInfo object in the source is a
member of struct PrintSetup_ defined in nsPostScriptObj.h. Checking showed that
these three fields of PrintSetup_ were being initialized but never used
otherwise:

    char *otherFontName[N_FONTS];
    PS_FontInfo *otherFontInfo[N_FONTS];
    int16 otherFontCharSetID;

The patch also removes these three members, the code which initializes them,
and the definitions for some no-longer-used typedefs.

The two files font_metrics.c and xlate_i.h are no longer needed and should be
removed from the source tree.

I've tested building mozilla and printing; no difference was noted. The patch
saves about 25k of data.
 
Before:
> size font_metrics.o libgfxps.so
   text    data     bss     dec     hex filename
    162   25056       0   25218    6282 font_metrics.o
 295224  242428  131164  668816   a3490 libgfxps.so

After:
> size libgfxps.so
   text    data     bss     dec     hex filename
 294307  217308  131164  642779   9cedb libgfxps.so
Attachment #126693 - Flags: superreview?(alecf)
Attachment #126693 - Flags: review?(bzbarsky)
Comment on attachment 126693 [details] [diff] [review]
Remove obsolete font metric structures and typedefs

r=me.  Please let me know if/when this needs checking in.
Attachment #126693 - Flags: review?(bzbarsky) → review+
Summary: Unused data in gfx/src/ps/font_metrics.c → [ps] Unused data in gfx/src/ps/font_metrics.c
Comment on attachment 126693 [details] [diff] [review]
Remove obsolete font metric structures and typedefs

nice cleanup! sr=alecf
Attachment #126693 - Flags: superreview?(alecf) → superreview+
Checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: