Eliminate glyph bounding boxes & other unused font metrics.
This commit is contained in:
parent
38f2be49f0
commit
2576513014
|
@ -156,6 +156,10 @@ static void PSDRV_DumpFontList(void)
|
|||
afmle->afm->FontName, afmle->afm->NumofMetrics,
|
||||
afmle->afm->EncodingScheme);
|
||||
|
||||
/* Uncomment to regenerate font data; see afm2c.c */
|
||||
|
||||
/* PSDRV_AFM2C(afmle->afm); */
|
||||
|
||||
for (i = 0; i < afmle->afm->NumofMetrics; ++i)
|
||||
{
|
||||
TRACE("\t\tU+%.4lX; C %i; N '%s'\n", afmle->afm->Metrics[i].UV,
|
||||
|
|
|
@ -13,13 +13,11 @@
|
|||
*
|
||||
* To use this function, do the following:
|
||||
*
|
||||
* * Move this file to the dlls/wineps directory.
|
||||
*
|
||||
* * Edit dlls/wineps/Makefile (or dlls/wineps/Makefile.in) and add
|
||||
* afm2c.c as a source file.
|
||||
*
|
||||
* * Edit dlls/wineps/afm.c and uncomment the call to PSDRV_AFM2C in
|
||||
* CalcWindowsMetrics() (or wherever it gets moved). The resulting
|
||||
* PSDRV_DumpFontList() (or wherever it gets moved). The resulting
|
||||
* compiler warning can be safely ignored.
|
||||
*
|
||||
* IMPORTANT: For this to work, all glyph names in the AFM data being
|
||||
|
@ -59,57 +57,7 @@ inline static void cursorto(FILE *of, int np, int cp)
|
|||
}
|
||||
}
|
||||
|
||||
static void writeCharWidths(FILE *of, AFM * afm)
|
||||
{
|
||||
int i, cp, w, row_start = 0;
|
||||
|
||||
fputc('\t', of); cp = 8;
|
||||
|
||||
for (i = 0; i < 255; ++i)
|
||||
{
|
||||
if (afm->CharWidths[i] == 0.0)
|
||||
w = 3;
|
||||
else
|
||||
w = (int)log10(afm->CharWidths[i]) + 3;
|
||||
|
||||
if (cp + w < 40)
|
||||
{
|
||||
cp += fprintf(of, "%g, ", (double)(afm->CharWidths[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
cursorto(of, 40, cp);
|
||||
fprintf(of, "/* CharWidths[%i] - CharWidths[%i] */\n\t",
|
||||
row_start, i - 1);
|
||||
cp = 8;
|
||||
row_start = i;
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
||||
if (afm->CharWidths[255] == 0.0)
|
||||
w = 3;
|
||||
else
|
||||
w = (int)pow(afm->CharWidths[i], 0.1) + 3;
|
||||
|
||||
if (cp + w < 40)
|
||||
{
|
||||
cp += fprintf(of, "%g", (double)(afm->CharWidths[255]));
|
||||
cursorto(of, 40, cp);
|
||||
fprintf(of, "/* CharWidths[%i] - CharWidths[255] */\n },\n",
|
||||
row_start);
|
||||
}
|
||||
else
|
||||
{
|
||||
cursorto(of, 40, cp);
|
||||
fprintf(of, "/* CharWidths[%i] - CharWidths[254] */\n\t", row_start);
|
||||
cp = 8 + fprintf(of, "%g", (double)(afm->CharWidths[255]));
|
||||
cursorto(of, 40, cp);
|
||||
fputs("/* CharWidths[255] */\n },\n", of);
|
||||
}
|
||||
}
|
||||
|
||||
static void writeHeader(FILE *of, AFM *afm, const char *buffer)
|
||||
static void writeHeader(FILE *of, const AFM *afm, const char *buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -123,160 +71,104 @@ static void writeHeader(FILE *of, AFM *afm, const char *buffer)
|
|||
" *\tCopyright 2001 Ian Pilcher\n"
|
||||
" *\n"
|
||||
" *\n"
|
||||
" *\tThis data is derived from the Adobe Font Metrics files at"
|
||||
"\n"
|
||||
" *\n"
|
||||
" *\t ftp://ftp.adobe.com/pub/adobe/type/win/all/afmfiles/"
|
||||
"base35/\n"
|
||||
" *\n"
|
||||
" *\twhich are Copyright 1985-1992 Adobe Systems Incorporated."
|
||||
"\n"
|
||||
" *\tSee dlls/wineps/data/COPYRIGHTS for font copyright "
|
||||
"information.\n"
|
||||
" *\n"
|
||||
" */\n"
|
||||
"\n"
|
||||
"#include \"psdrv.h\"\n", afm->FullName);
|
||||
"#include \"psdrv.h\"\n"
|
||||
"#include \"data/agl.h\"\n", afm->FullName);
|
||||
}
|
||||
|
||||
static void writeEncoding(FILE *of, AFM *afm, const char *buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf(of, "\n\n/*\n * %s encoding vector\n */\n", afm->EncodingScheme);
|
||||
|
||||
fprintf(of, "\nstatic const UNICODEGLYPH ug_%s[%i] =\n{\n", buffer,
|
||||
afm->Encoding->size);
|
||||
|
||||
for (i = 0; i < afm->Encoding->size - 1; ++i)
|
||||
{
|
||||
cursorto(of, 48,
|
||||
fprintf(of, " { 0x%.4lx, PSDRV_AGLGlyphNames + %4i },",
|
||||
afm->Encoding->glyphs[i].UV,
|
||||
afm->Encoding->glyphs[i].name - PSDRV_AGLGlyphNames));
|
||||
fprintf(of, "/* %s */\n", afm->Encoding->glyphs[i].name->sz);
|
||||
}
|
||||
|
||||
cursorto(of, 48, fprintf(of, " { 0x%.4lx, PSDRV_AGLGlyphNames + %4i }",
|
||||
afm->Encoding->glyphs[i].UV,
|
||||
afm->Encoding->glyphs[i].name - PSDRV_AGLGlyphNames));
|
||||
fprintf(of, "/* %s */\n};\n\n", afm->Encoding->glyphs[i].name->sz);
|
||||
|
||||
fprintf(of, "static UNICODEVECTOR enc_%s = { %i, ug_%s };\n", buffer,
|
||||
afm->Encoding->size, buffer);
|
||||
}
|
||||
|
||||
static void writeMetrics(FILE *of, AFM *afm, const char *buffer)
|
||||
static void writeMetrics(FILE *of, const AFM *afm, const char *buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
fputs("\n\n/*\n * Glyph metrics\n */\n\n", of);
|
||||
|
||||
fprintf(of, "static AFMMETRICS met_%s[%i] = \n{\n", buffer,
|
||||
fprintf(of, "static const AFMMETRICS metrics[%i] = \n{\n",
|
||||
afm->NumofMetrics);
|
||||
|
||||
for (i = 0; i < afm->NumofMetrics - 1; ++i)
|
||||
{
|
||||
fputs(" {\n\t", of);
|
||||
fprintf(of, "%3i, 0x%.4lx, %4g, PSDRV_AGLGlyphNames + %4i,\n\t\t",
|
||||
afm->Metrics[i].C, afm->Metrics[i].UV, afm->Metrics[i].WX,
|
||||
afm->Metrics[i].N - PSDRV_AGLGlyphNames);
|
||||
fprintf(of, "{ %4g, %4g, %4g, %4g }, NULL\t/* %s */\n },\n",
|
||||
afm->Metrics[i].B.llx, afm->Metrics[i].B.lly,
|
||||
afm->Metrics[i].B.urx, afm->Metrics[i].B.ury,
|
||||
afm->Metrics[i].N->sz);
|
||||
fprintf(of, " { %3i, 0x%.4lx, %4g, GN_%s },\n", afm->Metrics[i].C,
|
||||
afm->Metrics[i].UV, afm->Metrics[i].WX, afm->Metrics[i].N->sz);
|
||||
}
|
||||
|
||||
fputs(" {\n\t", of);
|
||||
fprintf(of, "%3i, 0x%.4lx, %4g, PSDRV_AGLGlyphNames + %4i,\n\t\t",
|
||||
afm->Metrics[i].C, afm->Metrics[i].UV, afm->Metrics[i].WX,
|
||||
afm->Metrics[i].N - PSDRV_AGLGlyphNames);
|
||||
fprintf(of, "{ %4g, %4g, %4g, %4g }, NULL\t/* %s */\n }\n};\n",
|
||||
afm->Metrics[i].B.llx, afm->Metrics[i].B.lly,
|
||||
afm->Metrics[i].B.urx, afm->Metrics[i].B.ury,
|
||||
afm->Metrics[i].N->sz);
|
||||
fprintf(of, " { %3i, 0x%.4lx, %4g, GN_%s }\n};\n", afm->Metrics[i].C,
|
||||
afm->Metrics[i].UV, afm->Metrics[i].WX, afm->Metrics[i].N->sz);
|
||||
}
|
||||
|
||||
static void writeAFM(FILE *of, AFM *afm, const char *buffer)
|
||||
static void writeAFM(FILE *of, const AFM *afm, const char *buffer)
|
||||
{
|
||||
fputs("\n\n/*\n * Font metrics\n */\n\n", of);
|
||||
|
||||
fprintf(of, "AFM PSDRV_%s =\n{\n", buffer);
|
||||
cursorto(of, 48, fprintf(of, " \"%s\",", afm->FontName));
|
||||
fprintf(of, "const AFM PSDRV_%s =\n{\n", buffer);
|
||||
cursorto(of, 44, fprintf(of, " \"%s\",", afm->FontName));
|
||||
fputs("/* FontName */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " \"%s\",", afm->FullName));
|
||||
cursorto(of, 44, fprintf(of, " \"%s\",", afm->FullName));
|
||||
fputs("/* FullName */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " \"%s\",", afm->FamilyName));
|
||||
cursorto(of, 44, fprintf(of, " \"%s\",", afm->FamilyName));
|
||||
fputs("/* FamilyName */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " \"%s\",", afm->EncodingScheme));
|
||||
cursorto(of, 44, fprintf(of, " \"%s\",", afm->EncodingScheme));
|
||||
fputs("/* EncodingScheme */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " %li,", afm->Weight));
|
||||
cursorto(of, 44, fprintf(of, " %s,",
|
||||
(afm->Weight > 550) ? "FW_BOLD" : "FW_NORMAL"));
|
||||
fputs("/* Weight */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " %g,", afm->ItalicAngle));
|
||||
cursorto(of, 44, fprintf(of, " %g,", afm->ItalicAngle));
|
||||
fputs("/* ItalicAngle */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " %s,",
|
||||
cursorto(of, 44, fprintf(of, " %s,",
|
||||
afm->IsFixedPitch ? "TRUE" : "FALSE"));
|
||||
fputs("/* IsFixedPitch */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " %g,", afm->UnderlinePosition));
|
||||
cursorto(of, 44, fprintf(of, " %g,", afm->UnderlinePosition));
|
||||
fputs("/* UnderlinePosition */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " %g,", afm->UnderlineThickness));
|
||||
cursorto(of, 44, fprintf(of, " %g,", afm->UnderlineThickness));
|
||||
fputs("/* UnderlineThickness */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " { %g, %g, %g, %g },", afm->FontBBox.llx,
|
||||
cursorto(of, 44, fprintf(of, " { %g, %g, %g, %g },", afm->FontBBox.llx,
|
||||
afm->FontBBox.lly, afm->FontBBox.urx, afm->FontBBox.ury));
|
||||
fputs("/* FontBBox */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " %g,", afm->CapHeight));
|
||||
fputs("/* CapHeight */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " %g,", afm->XHeight));
|
||||
fputs("/* XHeight */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " %g,", afm->Ascender));
|
||||
cursorto(of, 44, fprintf(of, " %g,", afm->Ascender));
|
||||
fputs("/* Ascender */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " %g,", afm->Descender));
|
||||
cursorto(of, 44, fprintf(of, " %g,", afm->Descender));
|
||||
fputs("/* Descender */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " %g,", afm->FullAscender));
|
||||
fputs("/* FullAscender */\n", of);
|
||||
fputs(" {\n", of);
|
||||
cursorto(of, 40, 7 + fprintf(of, "\t%u,",
|
||||
cursorto(of, 44, 7 + fprintf(of, "\t%u,",
|
||||
(unsigned int)(afm->WinMetrics.usUnitsPerEm)));
|
||||
fputs("/* WinMetrics.usUnitsPerEm */\n", of);
|
||||
cursorto(of, 40, 7 + fprintf(of, "\t%i,",
|
||||
cursorto(of, 44, 7 + fprintf(of, "\t%i,",
|
||||
(int)(afm->WinMetrics.sAscender)));
|
||||
fputs("/* WinMetrics.sAscender */\n", of);
|
||||
cursorto(of, 40, 7 + fprintf(of, "\t%i,",
|
||||
cursorto(of, 44, 7 + fprintf(of, "\t%i,",
|
||||
(int)(afm->WinMetrics.sDescender)));
|
||||
fputs("/* WinMetrics.sDescender */\n", of);
|
||||
cursorto(of, 40, 7 + fprintf(of, "\t%i,",
|
||||
cursorto(of, 44, 7 + fprintf(of, "\t%i,",
|
||||
(int)(afm->WinMetrics.sLineGap)));
|
||||
fputs("/* WinMetrics.sLineGap */\n", of);
|
||||
cursorto(of, 40, 7 + fprintf(of, "\t%i,",
|
||||
cursorto(of, 44, 7 + fprintf(of, "\t%i,",
|
||||
(int)(afm->WinMetrics.sAvgCharWidth)));
|
||||
fputs("/* WinMetrics.sAvgCharWidth */\n", of);
|
||||
cursorto(of, 40, 7 + fprintf(of, "\t%i,",
|
||||
cursorto(of, 44, 7 + fprintf(of, "\t%i,",
|
||||
(int)(afm->WinMetrics.sTypoAscender)));
|
||||
fputs("/* WinMetrics.sTypoAscender */\n", of);
|
||||
cursorto(of, 40, 7 + fprintf(of, "\t%i,",
|
||||
cursorto(of, 44, 7 + fprintf(of, "\t%i,",
|
||||
(int)(afm->WinMetrics.sTypoDescender)));
|
||||
fputs("/* WinMetrics.sTypoDescender */\n", of);
|
||||
cursorto(of, 40, 7 + fprintf(of, "\t%i,",
|
||||
cursorto(of, 44, 7 + fprintf(of, "\t%i,",
|
||||
(int)(afm->WinMetrics.sTypoLineGap)));
|
||||
fputs("/* WinMetrics.sTypoLineGap */\n", of);
|
||||
cursorto(of, 40, 7 + fprintf(of, "\t%u,",
|
||||
cursorto(of, 44, 7 + fprintf(of, "\t%u,",
|
||||
(unsigned int)(afm->WinMetrics.usWinAscent)));
|
||||
fputs("/* WinMetrics.usWinAscent */\n", of);
|
||||
cursorto(of, 40, 7 + fprintf(of, "\t%u",
|
||||
cursorto(of, 44, 7 + fprintf(of, "\t%u",
|
||||
(unsigned int)(afm->WinMetrics.usWinDescent)));
|
||||
fputs("/* WinMetrics.usWinDescent */\n",of);
|
||||
fputs(" },\n {\n", of);
|
||||
writeCharWidths(of, afm);
|
||||
cursorto(of, 48, fprintf(of, " %i,", afm->NumofMetrics));
|
||||
fputs(" },\n", of);
|
||||
cursorto(of, 44, fprintf(of, " %i,", afm->NumofMetrics));
|
||||
fputs("/* NumofMetrics */\n", of);
|
||||
cursorto(of, 48, fprintf(of, " met_%s,", buffer));
|
||||
fputs("/* Metrics */\n", of);
|
||||
if (afm->Encoding == &PSDRV_AdobeGlyphList)
|
||||
cursorto(of, 48, fprintf(of, " &PSDRV_AdobeGlyphList"));
|
||||
else
|
||||
cursorto(of, 48, fprintf(of, " &enc_%s", buffer));
|
||||
fputs("/* Encoding */\n};\n", of);
|
||||
fputs(" metrics\t\t\t\t /* Metrics */\n};\n", of);
|
||||
}
|
||||
|
||||
void PSDRV_AFM2C(AFM *afm)
|
||||
void PSDRV_AFM2C(const AFM *afm)
|
||||
{
|
||||
char buffer[256];
|
||||
FILE *of;
|
||||
|
@ -303,10 +195,6 @@ void PSDRV_AFM2C(AFM *afm)
|
|||
buffer[i] = '\0';
|
||||
|
||||
writeHeader(of, afm, buffer);
|
||||
|
||||
if (afm->Encoding != &PSDRV_AdobeGlyphList)
|
||||
writeEncoding(of, afm, buffer);
|
||||
|
||||
writeMetrics(of, afm, buffer);
|
||||
writeAFM(of, afm, buffer);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,399 @@
|
|||
Font copyright information for Wine PostScript driver built-in font metrics.
|
||||
|
||||
|
||||
The font metric information built into the Wine PostScript driver is derived
|
||||
from two sources. Individual glyph metrics and some font-wide metrics are
|
||||
derived from the Adobe Font Metrics (AFM) files at:
|
||||
|
||||
ftp://ftp.adobe.com/pub/adobe/type/win/all/afmfiles/base35/
|
||||
|
||||
Windows-specific font metrics, which are not present in the AFM files are
|
||||
derived from each PostScript font's TrueType "workalike".
|
||||
|
||||
|
||||
ITC Avant Garde Gothic Demi
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All
|
||||
rights reserved. ITC Avant Garde Gothic is a registered trademark of
|
||||
International Typeface Corporation.
|
||||
|
||||
Windows metrics derived from Century Gothic Bold. Typeface copyright The
|
||||
Monotype Corporation plc. Data copyright The Monotype Corporation plc/Type
|
||||
Solutions Inc. 1990-1991. All rights reserved. Centyry Gothic is a trademark
|
||||
of The Monotype Corporation plc.
|
||||
|
||||
|
||||
ITC Avant Garde Gothic Demi Oblique
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All
|
||||
rights reserved. ITC Avant Garde Gothic is a registered trademark of
|
||||
International Typeface Corporation.
|
||||
|
||||
Windows metrics derived from Century Gothic Bold Italic. Typeface copyright The
|
||||
Monotype Corporation plc. Data copyright The Monotype Corporation plc/Type
|
||||
Solutions Inc. 1990-1991. All rights reserved. Century Gothic is a trademark
|
||||
of The Monotype Corporation plc.
|
||||
|
||||
|
||||
ITC Avant Garde Gothic Book
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All
|
||||
rights reserved. ITC Avant Garde Gothic is a registered trademark of
|
||||
International Typeface Corporation.
|
||||
|
||||
Windows metrics derived from Century Gothic. Typeface copyright The Monotype
|
||||
Corporation plc. Data copyright The Monotype Corporation plc/Type Solutions
|
||||
Inc. 1990-1991. All rights reserved. Century Gothic is a trademark of The
|
||||
Monotype Corporation plc.
|
||||
|
||||
|
||||
ITC Avant Garde Gothic Book Oblique
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990, 1991 Adobe Systems Incorporated. All
|
||||
rights reserved. ITC Avant Garde Gothic is a registered trademark of
|
||||
International Typeface Corporation.
|
||||
|
||||
Windows metrics derived from Century Gothic Italic. Typeface copyright The
|
||||
Monotype Corporation plc. Data copyright The Monotype Corporation plc/Type
|
||||
Solutions Inc. 1990-1991. All rights reserved. Century Gothic is a trademark
|
||||
of The Monotype Corporation plc.
|
||||
|
||||
|
||||
ITC Bookman Demi
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All rights
|
||||
reserved. ITC Bookman is a registered trademark of International Typeface
|
||||
Corporation.
|
||||
|
||||
Windows metrics derived from Bookman Old Style Bold. Digitized data copyright
|
||||
The Monotype Corporation 1991-1995. All rights reserved. Bookman Old Style is
|
||||
a trademark of The Monotype Corporation which may be registered in certain
|
||||
jurisdictions.
|
||||
|
||||
|
||||
ITC Bookman Demi Italic
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All rights
|
||||
reserved. ITC Bookman is a registered trademark of International Typeface
|
||||
Corporation.
|
||||
|
||||
Windows metrics derived from Bookman Old Style Bold Italic. Digitized data
|
||||
copyright The Monotype Corporation 1991-1995. All rights reserved. Bookman Old
|
||||
Style is a trademark of The Monotype Corporation which may be registered in
|
||||
certain jurisdictions.
|
||||
|
||||
|
||||
ITC Bookman Light
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All rights
|
||||
reserved. ITC Bookman is a registered trademark of International Typeface
|
||||
Corporation.
|
||||
|
||||
Windows metrics derived from Bookman Old Style. Digitized data copyright The
|
||||
Monotype Corporation 1991-1995. All rights reserved. Bookman Old Style is a
|
||||
trademark of The Monotype Corporation which may be registered in certain
|
||||
jurisdictions.
|
||||
|
||||
|
||||
ITC Bookman Light Italic
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1992 Adobe Systems Incorporated. All rights
|
||||
reserved. ITC Bookman is a registered trademark of International Typeface
|
||||
Corporation.
|
||||
|
||||
Windows metrics derived from Bookman Old Style Italic. Digitized data copyright
|
||||
The Monotype Corporation 1991-1995. All rights reserved. Bookman Old Style is
|
||||
a trademark of The Monotype Corporation which may be registered in certain
|
||||
jurisdictions.
|
||||
|
||||
|
||||
Courier Bold
|
||||
|
||||
Copyright (c) 1989, 1990, 1991 Adobe Systems Incorporated. All rights reserved.
|
||||
|
||||
Windows metrics derived from Courier New Bold. Typeface copyright The Monotype
|
||||
Corporation plc. Data copyright The Monotype Corporation plc/Type Solutions
|
||||
Inc. 1990-1992. All rights reserved. Courier is a trademark of The Monotype
|
||||
Corporation plc, registered in certain countries.
|
||||
|
||||
|
||||
Courier Bold Oblique
|
||||
|
||||
Copyright (c) 1989, 1990, 1991 Adobe Systems Incorporated. All rights reserved.
|
||||
|
||||
Windows metrics derived from Courier New Bold Italic. Typeface copyright The
|
||||
Monotype Corporation plc. Data copyright The Monotype Corporation plc/Type
|
||||
Solutions Inc. 1990-1992. All rights reserved. Courier is a trademark of The
|
||||
Monotype Corporation plc, registered in certain countries.
|
||||
|
||||
|
||||
Courier
|
||||
|
||||
Copyright (c) 1989, 1990, 1991 Adobe Systems Incorporated. All rights reserved.
|
||||
|
||||
Windows metrics derived from Courier New. Typeface copyright The Monotype
|
||||
Corporation plc. Data copyright The Monotype Corporation plc/Type Solutions
|
||||
Inc. 1990-1994. All rights reserved. Courier is a trademark of The Monotype
|
||||
Corporation plc, registered in certain countries.
|
||||
|
||||
|
||||
Courier Oblique
|
||||
|
||||
Copyright (c) 1989, 1990, 1991 Adobe Systems Incorporated. All rights reserved.
|
||||
|
||||
Windows metrics derived from Courier New Italic. Typeface copyright The
|
||||
Monotype Corporation plc. Data copyright The Monotype Corporation plc/Type
|
||||
Solutions Inc. 1990-1992. All rights reserved. Courier is a trademark of The
|
||||
Monotype Corporation plc, registered in certain countries.
|
||||
|
||||
|
||||
Helvetica
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Helvetica is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Arial. Typeface copyright The Monotype Corporation
|
||||
plc. Data copyright The Monotype Corporation plc/Type Solutions Inc. 1990-1992.
|
||||
All rights reserved. Arial is a registered trademark of The Monotype
|
||||
Corporation plc, registered in the United Stated Patent and Trademark Office and
|
||||
elsewhere.
|
||||
|
||||
|
||||
Helvetica Bold
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Helvetica is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Arial Bold. Typeface copyright The Monotype
|
||||
Corporation plc. Data copyright The Monotype Corporation plc/Type Solutions
|
||||
Inc. 1990-1992. All rights reserved. Arial is a registered trademark of The
|
||||
Monotype Corporation plc, registered in the United States Patent and Trademark
|
||||
Office and elsewhere.
|
||||
|
||||
|
||||
Helvetica Bold Oblique
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Helvetica is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Arial Bold Italic. Typeface copyright The Monotype
|
||||
Corporation plc. Data copyright The Monotype Corporation plc/Type Solutions
|
||||
Inc. 1990-1992. All rights reserved. Arial is a registered trademark of The
|
||||
Monotype Corporation plc, registered in the United States Patent and Trademark
|
||||
Office and elsewhere.
|
||||
|
||||
|
||||
Helvetica Narrow
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Helvetica is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Arial Narrow. Digitized data copyright The
|
||||
Monotype Corporation 1991-1995. All rights reserved. Arial is a trademark of
|
||||
The Monotype Corporation which may be registered in certain jurisdictions.
|
||||
|
||||
|
||||
Helvetica Narrow Bold
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Helvetica is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Arial Narrow Bold. Digitized data copyright The
|
||||
Monotype Corporation 1991-1995. All rights reserved. Arial is a trademark of
|
||||
The Monotype Corporation which may be registered in certain jurisdictions.
|
||||
|
||||
|
||||
Helvetica Narrow Bold Oblique
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Helvetica is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Arial Narrow Bold Italic. Digitized data copyright
|
||||
The Monotype Corporation 1991-1995. All rights reserved. Arial is a trademark
|
||||
of The Monotype Corporation which may be registered in certain jurisdictions.
|
||||
|
||||
|
||||
Helvetica Narrow Oblique
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Helvetica is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Arial Narrow Italic. Digitized data copyright The
|
||||
Monotype Corporation 1991-1995. All rights reserved. Arial is a trademark of
|
||||
The Monotype Corporation which may be registered in certain jurisdictions.
|
||||
|
||||
|
||||
Helvetica Oblique
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Helvetica is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Arial Italic. Typeface copyright The Monotype
|
||||
Corporation plc. Data copyright The Monotype Corporation plc/Type Solutions
|
||||
Inc. 1990-1992. All rights reserved. Arial is a registered trademark of The
|
||||
Monotype Corporation plc, registered in the United States Patent and Trademark
|
||||
Office and elsewhere.
|
||||
|
||||
|
||||
New Century Schoolbook Bold
|
||||
|
||||
Copyright (c) 1985, 1987, 1988, 1991 Adobe Systems Incorporated. All rights
|
||||
reserved.
|
||||
|
||||
Windows metrics derived from Century Schoolbook Bold. Typeface copyright The
|
||||
Monotype Corporation plc. Data copyright The Monotype Corporation plc/Type
|
||||
Solutions Inc. 1990-1991. All rights reserved. Century Schoolbook is a
|
||||
registered trademark of The Monotype Corporation plc.
|
||||
|
||||
|
||||
New Century Schoolbook Bold Italic
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1991 Adobe Systems Incorporated. All rights
|
||||
reserved.
|
||||
|
||||
Windows metrics derived from Century Schoolbook Bold Italic. Typeface copyright
|
||||
The Monotype Corporation plc. Data copyright The Monotype Corporation plc/Type
|
||||
Solutions Inc. 1990-1991. All rights reserved. Century Schoolbook is a
|
||||
registered trademark of The Monotype Corporation plc.
|
||||
|
||||
|
||||
New Century Schoolbook Italic
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1991 Adobe Systems Incorporated. All rights
|
||||
reserved.
|
||||
|
||||
Windows metrics derived from Century Schoolbook Italic. Typeface copyright The
|
||||
Monotype Corporation plc. Data copyright The Monotype Corporation plc/Type
|
||||
Solutions Inc. 1990-1991. All rights reserved. Century Schoolbook is a
|
||||
registered trademark of The Monotype Corporation plc.
|
||||
|
||||
|
||||
New Century Schoolbook Roman
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1991 Adobe Systems Incorporated. All rights
|
||||
reserved.
|
||||
|
||||
Windows metrics derived from Century Schoolbook. Typeface copyright The
|
||||
Monotype Corporation plc. Data copyright The Monotype Corporation plc/Type
|
||||
Solutions Inc. 1990-1991. All rights reserved. Century Schoolbook is a
|
||||
registered trademark of The Monotype Corporation plc.
|
||||
|
||||
|
||||
Palatino Bold
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Palatino is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Book Antiqua Bold. Digitized data copyright The
|
||||
Monotype Corporation 1991-1995. All rights reserved. Book Anqiqua is a
|
||||
trademark of the Monotype Corporation which may be registered in certain
|
||||
jurisdictions.
|
||||
|
||||
|
||||
Palatino Bold Italic
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Palatino is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Book Antiqua Bold Italic. Digitized data copyright
|
||||
The Monotype Corporation 1991-1995. All rights reserved. Book Antiqua is a
|
||||
trademark of the Monotype Corporation which may be registered in certain
|
||||
jurisdictions.
|
||||
|
||||
|
||||
Palatino Italic
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Palatino is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Book Antiqua Italic. Digitized data copyright The
|
||||
Monotype Corporation 1991-1995. All rights reserved. Book Antiqua is a
|
||||
trademark of The Monotype Corporation which may be registered in certain
|
||||
jurisdictions.
|
||||
|
||||
|
||||
Palatino Roman
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Palatino is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Book Antiqua. Digitized data copyright The
|
||||
Monotype Corporation 1991-1995. All rights reserved. Book Antiqua is a
|
||||
trademark of The Monotype Corporation which may be registered in certain
|
||||
jurisdictions.
|
||||
|
||||
|
||||
Symbol
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved.
|
||||
|
||||
Windows metrics derived from [Monotype] Symbol. Typeface copyright The Monotype
|
||||
Corporation plc. Data copyright the Monotype Corporation plc/Type Solutions
|
||||
Inc. 1990-1992. All rights reserved.
|
||||
|
||||
|
||||
Times Bold
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Times is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Times New Roman Bold. Typeface copyright The
|
||||
Monotype Corporation plc/Type Solutions Inc. 1990-1992. All rights reserved.
|
||||
Times New Roman is a registered trademark of the Monotype Corporation plc,
|
||||
registered in the United States Patent and Trademark Office and elsewhere.
|
||||
|
||||
|
||||
Times Bold Italic
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Times is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Times New Roman Bold Italic. Typeface copyright
|
||||
the Monotype Corporation plc/Type Solutions Inc. 1990-1992. All rights
|
||||
reserved. Times New Roman is a registered trademark of the Monotype Corporation
|
||||
plc, registered in the United States Patent and Trademark Office and elsewhere.
|
||||
|
||||
|
||||
Times Italic
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Times is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Times New Roman Italic. Typeface copyright The
|
||||
Monotype Corporation plc/Type Solutions Inc. 1990-1992. All rights reserved.
|
||||
Times New Roman is a registered trademark of the Monotype Corporation plc,
|
||||
registered in the United States Patent and Trademark Office and elsewhere.
|
||||
|
||||
Times Roman
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. Times is a trademark of Linotype AG and/or its subsidiaries.
|
||||
|
||||
Windows metrics derived from Times New Roman. Typeface copyright The Monotype
|
||||
Corporation plc/Type Solutions Inc. 1990-1992. All rights reserved. Times New
|
||||
Roman is a registered trademark of The Monotype Corporation plc, registered in
|
||||
the United States Patent and Trademark Office and elsewhere.
|
||||
|
||||
|
||||
ITC Zapf Chancery Medium Italic
|
||||
|
||||
Copyright (c) 1985, 1987, 1989, 1990 Adobe Systems Incorporated. All rights
|
||||
reserved. ITC Zapf Chancery is a registered trademark of International Typeface
|
||||
Corporation.
|
||||
|
||||
Windows metrics derived from Monotype Corsiva. Digitized data copyright The
|
||||
Monotype Corporation 1991-1995. All rights reserved. Monotype Corsiva is a
|
||||
trademark of The Monotype Corporation which may be registered in certain
|
||||
jurisdictions.
|
||||
|
||||
|
||||
ITC Zapf Dingbats
|
||||
|
||||
Copyright (c) 1985, 1987, 1988, 1989 Adobe Systems Incorporated. All rights
|
||||
reserved. ITC Zapf Dingbats is a registered trademark of International Typeface
|
||||
Corporation.
|
||||
|
||||
Windows metrics derived from Monotype Sorts. Digitized data copyright Monotype
|
||||
Typography Ltd 1991-1995. All rights reserved. Monotype Sorts is a trademark
|
||||
of Monotype Typography, Ltd which may be registered in certain jurisdictions.
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -32,13 +32,20 @@ typedef struct _tagAFMLIGS {
|
|||
struct _tagAFMLIGS *next;
|
||||
} AFMLIGS;
|
||||
|
||||
typedef struct _tagAFMMETRICS {
|
||||
typedef struct {
|
||||
int C; /* character */
|
||||
LONG UV;
|
||||
float WX;
|
||||
const GLYPHNAME *N; /* name */
|
||||
AFMBBOX B;
|
||||
const AFMLIGS *L; /* Ligatures */
|
||||
} OLD_AFMMETRICS;
|
||||
|
||||
typedef struct {
|
||||
INT C; /* AFM encoding (or -1) */
|
||||
LONG UV; /* Unicode value */
|
||||
FLOAT WX; /* Advance width */
|
||||
const GLYPHNAME *N; /* Glyph name */
|
||||
} AFMMETRICS;
|
||||
|
||||
typedef struct {
|
||||
|
@ -65,11 +72,8 @@ typedef struct _tagAFM {
|
|||
float UnderlinePosition;
|
||||
float UnderlineThickness;
|
||||
AFMBBOX FontBBox;
|
||||
float CapHeight;
|
||||
float XHeight;
|
||||
float Ascender;
|
||||
float Descender;
|
||||
float FullAscender; /* Ascent of Aring character */
|
||||
WINMETRICS WinMetrics;
|
||||
int NumofMetrics;
|
||||
const AFMMETRICS *Metrics;
|
||||
|
|
|
@ -305,9 +305,6 @@ static BOOL StartAFM(FT_Face face, AFM **p_afm)
|
|||
|
||||
afm->Ascender = PSUnits(os2->sTypoAscender, em_size);
|
||||
afm->Descender = PSUnits(os2->sTypoDescender, em_size);
|
||||
afm->FullAscender = afm->FontBBox.ury; /* get rid of this */
|
||||
|
||||
/* CapHeight & XHeight set by ReadCharMetrics */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -339,8 +336,6 @@ static BOOL ReadCharMetrics(FT_Face face, AFM *afm, AFMMETRICS **p_metrics)
|
|||
{
|
||||
FT_UInt glyph_index = FT_Get_Char_Index(face, charcode);
|
||||
FT_Error error;
|
||||
FT_Glyph glyph;
|
||||
FT_BBox bbox;
|
||||
CHAR buffer[128]; /* for glyph names */
|
||||
|
||||
if (glyph_index == 0)
|
||||
|
@ -353,15 +348,6 @@ static BOOL ReadCharMetrics(FT_Face face, AFM *afm, AFMMETRICS **p_metrics)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
error = FT_Get_Glyph(face->glyph, &glyph);
|
||||
if (error != FT_Err_Ok)
|
||||
{
|
||||
ERR("%s returned %i\n", "FT_Get_Glyph", error);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
FT_Glyph_Get_CBox(glyph, ft_glyph_bbox_unscaled, &bbox);
|
||||
|
||||
error = FT_Get_Glyph_Name(face, glyph_index, buffer, sizeof(buffer));
|
||||
if (error != FT_Err_Ok)
|
||||
{
|
||||
|
@ -375,17 +361,7 @@ static BOOL ReadCharMetrics(FT_Face face, AFM *afm, AFMMETRICS **p_metrics)
|
|||
|
||||
metrics[index].C = metrics[index].UV = charcode;
|
||||
metrics[index].WX = PSUnits(face->glyph->metrics.horiAdvance, em_size);
|
||||
metrics[index].B.llx = PSUnits(bbox.xMin, em_size);
|
||||
metrics[index].B.lly = PSUnits(bbox.yMin, em_size);
|
||||
metrics[index].B.urx = PSUnits(bbox.xMax, em_size);
|
||||
metrics[index].B.ury = PSUnits(bbox.yMax, em_size);
|
||||
metrics[index].L = NULL;
|
||||
|
||||
if (charcode == 0x0048) /* 'H' */
|
||||
afm->CapHeight = metrics[index].B.ury;
|
||||
if (charcode == 0x0078) /* 'x' */
|
||||
afm->XHeight = metrics[index].B.ury;
|
||||
|
||||
++index;
|
||||
}
|
||||
|
||||
|
|
|
@ -511,16 +511,6 @@ static BOOL ReadFontMetrics(FILE *file, CHAR buffer[], INT bufsize, AFM **p_afm)
|
|||
if (retval == FALSE || found == FALSE)
|
||||
goto cleanup_afm;
|
||||
|
||||
retval = ReadFloat(file, buffer, bufsize, "CapHeight", /* optional */
|
||||
&(afm->CapHeight), &found);
|
||||
if (retval == FALSE)
|
||||
goto cleanup_afm;
|
||||
|
||||
retval = ReadFloat(file, buffer, bufsize, "XHeight", /* optional */
|
||||
&(afm->XHeight), &found);
|
||||
if (retval == FALSE)
|
||||
goto cleanup_afm;
|
||||
|
||||
retval = ReadFloat(file, buffer, bufsize, "Ascender", /* optional */
|
||||
&(afm->Ascender), &found);
|
||||
if (retval == FALSE)
|
||||
|
@ -562,7 +552,7 @@ static BOOL ReadFontMetrics(FILE *file, CHAR buffer[], INT bufsize, AFM **p_afm)
|
|||
* Non-fatal error: leave metrics->C set to INT_MAX
|
||||
*
|
||||
*/
|
||||
static BOOL ParseC(LPSTR sz, AFMMETRICS *metrics)
|
||||
static BOOL ParseC(LPSTR sz, OLD_AFMMETRICS *metrics)
|
||||
{
|
||||
int base = 10;
|
||||
long l;
|
||||
|
@ -596,7 +586,7 @@ static BOOL ParseC(LPSTR sz, AFMMETRICS *metrics)
|
|||
* Non-fatal error: leave metrics->WX set to FLT_MAX
|
||||
*
|
||||
*/
|
||||
static BOOL ParseW(LPSTR sz, AFMMETRICS *metrics)
|
||||
static BOOL ParseW(LPSTR sz, OLD_AFMMETRICS *metrics)
|
||||
{
|
||||
CHAR *cp, *end_ptr;
|
||||
BOOL vector = TRUE;
|
||||
|
@ -650,7 +640,7 @@ static BOOL ParseW(LPSTR sz, AFMMETRICS *metrics)
|
|||
* Non-fatal error: leave metrics->B.ury set to FLT_MAX
|
||||
*
|
||||
*/
|
||||
static BOOL ParseB(LPSTR sz, AFMMETRICS *metrics)
|
||||
static BOOL ParseB(LPSTR sz, OLD_AFMMETRICS *metrics)
|
||||
{
|
||||
CHAR *cp, *end_ptr;
|
||||
double d;
|
||||
|
@ -696,7 +686,7 @@ static BOOL ParseB(LPSTR sz, AFMMETRICS *metrics)
|
|||
* Non-fatal error: leave metrics-> set to NULL
|
||||
*
|
||||
*/
|
||||
static BOOL ParseN(LPSTR sz, AFMMETRICS *metrics)
|
||||
static BOOL ParseN(LPSTR sz, OLD_AFMMETRICS *metrics)
|
||||
{
|
||||
CHAR save, *cp, *end_ptr;
|
||||
|
||||
|
@ -734,7 +724,7 @@ static BOOL ParseN(LPSTR sz, AFMMETRICS *metrics)
|
|||
* fatal error; sets *metrics to 'badmetrics' on non-fatal error.
|
||||
*
|
||||
*/
|
||||
static const AFMMETRICS badmetrics =
|
||||
static const OLD_AFMMETRICS badmetrics =
|
||||
{
|
||||
INT_MAX, /* C */
|
||||
LONG_MAX, /* UV */
|
||||
|
@ -744,7 +734,7 @@ static const AFMMETRICS badmetrics =
|
|||
NULL /* L */
|
||||
};
|
||||
|
||||
static BOOL ParseCharMetrics(LPSTR buffer, INT len, AFMMETRICS *metrics)
|
||||
static BOOL ParseCharMetrics(LPSTR buffer, INT len, OLD_AFMMETRICS *metrics)
|
||||
{
|
||||
CHAR *cp = buffer;
|
||||
|
||||
|
@ -844,7 +834,7 @@ static int UnicodeGlyphByNameIndex(const void *a, const void *b)
|
|||
((const UNICODEGLYPH *)b)->name->index;
|
||||
}
|
||||
|
||||
static VOID Unicodify(AFM *afm, AFMMETRICS *metrics)
|
||||
static VOID Unicodify(AFM *afm, OLD_AFMMETRICS *metrics)
|
||||
{
|
||||
INT i;
|
||||
|
||||
|
@ -924,17 +914,18 @@ static VOID Unicodify(AFM *afm, AFMMETRICS *metrics)
|
|||
* Reads metrics for all glyphs. *p_metrics will be NULL on non-fatal error.
|
||||
*
|
||||
*/
|
||||
static int AFMMetricsByUV(const void *a, const void *b)
|
||||
static int OldAFMMetricsByUV(const void *a, const void *b)
|
||||
{
|
||||
return ((const AFMMETRICS *)a)->UV - ((const AFMMETRICS *)b)->UV;
|
||||
return ((const OLD_AFMMETRICS *)a)->UV - ((const OLD_AFMMETRICS *)b)->UV;
|
||||
}
|
||||
|
||||
static BOOL ReadCharMetrics(FILE *file, CHAR buffer[], INT bufsize, AFM *afm,
|
||||
AFMMETRICS **p_metrics)
|
||||
{
|
||||
BOOL retval, found;
|
||||
AFMMETRICS *metrics;
|
||||
INT i, len;
|
||||
BOOL retval, found;
|
||||
OLD_AFMMETRICS *old_metrics, *encoded_metrics;
|
||||
AFMMETRICS *metrics;
|
||||
INT i, len;
|
||||
|
||||
retval = ReadInt(file, buffer, bufsize, "StartCharMetrics",
|
||||
&(afm->NumofMetrics), &found);
|
||||
|
@ -944,22 +935,22 @@ static BOOL ReadCharMetrics(FILE *file, CHAR buffer[], INT bufsize, AFM *afm,
|
|||
return retval;
|
||||
}
|
||||
|
||||
afm->Metrics = *p_metrics = metrics = HeapAlloc(PSDRV_Heap, 0,
|
||||
afm->NumofMetrics * sizeof(*metrics));
|
||||
if (metrics == NULL)
|
||||
old_metrics = HeapAlloc(PSDRV_Heap, 0,
|
||||
afm->NumofMetrics * sizeof(*old_metrics));
|
||||
if (old_metrics == NULL)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < afm->NumofMetrics; ++i)
|
||||
{
|
||||
retval = ReadLine(file, buffer, bufsize, &len);
|
||||
if (retval == FALSE)
|
||||
goto cleanup_metrics;
|
||||
goto cleanup_old_metrics;
|
||||
|
||||
if(len > 0)
|
||||
{
|
||||
retval = ParseCharMetrics(buffer, len, metrics + i);
|
||||
if (retval == FALSE || metrics[i].C == INT_MAX)
|
||||
goto cleanup_metrics;
|
||||
retval = ParseCharMetrics(buffer, len, old_metrics + i);
|
||||
if (retval == FALSE || old_metrics[i].C == INT_MAX)
|
||||
goto cleanup_old_metrics;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -970,45 +961,44 @@ static BOOL ReadCharMetrics(FILE *file, CHAR buffer[], INT bufsize, AFM *afm,
|
|||
continue;
|
||||
|
||||
case INT_MIN: WARN("Ignoring long line '%32s...'\n", buffer);
|
||||
goto cleanup_metrics; /* retval == TRUE */
|
||||
goto cleanup_old_metrics; /* retval == TRUE */
|
||||
|
||||
case EOF: WARN("Unexpected EOF\n");
|
||||
goto cleanup_metrics; /* retval == TRUE */
|
||||
goto cleanup_old_metrics; /* retval == TRUE */
|
||||
}
|
||||
}
|
||||
|
||||
Unicodify(afm, metrics); /* wait until all glyph names have been read */
|
||||
Unicodify(afm, old_metrics); /* wait until glyph names have been read */
|
||||
|
||||
qsort(metrics, afm->NumofMetrics, sizeof(*metrics), AFMMetricsByUV);
|
||||
qsort(old_metrics, afm->NumofMetrics, sizeof(*old_metrics),
|
||||
OldAFMMetricsByUV);
|
||||
|
||||
for (i = 0; metrics[i].UV == -1; ++i); /* count unencoded glyphs */
|
||||
for (i = 0; old_metrics[i].UV == -1; ++i); /* count unencoded glyphs */
|
||||
|
||||
if (i != 0)
|
||||
afm->NumofMetrics -= i;
|
||||
encoded_metrics = old_metrics + i;
|
||||
|
||||
afm->Metrics = *p_metrics = metrics = HeapAlloc(PSDRV_Heap, 0,
|
||||
afm->NumofMetrics * sizeof(*metrics));
|
||||
if (afm->Metrics == NULL)
|
||||
goto cleanup_old_metrics; /* retval == TRUE */
|
||||
|
||||
for (i = 0; i < afm->NumofMetrics; ++i, ++metrics, ++encoded_metrics)
|
||||
{
|
||||
AFMMETRICS *new_metrics;
|
||||
|
||||
TRACE("Ignoring %i unencoded glyphs\n", i);
|
||||
|
||||
afm->NumofMetrics -= i;
|
||||
memmove(metrics, metrics + i, afm->NumofMetrics * sizeof(*metrics));
|
||||
|
||||
new_metrics = HeapReAlloc(PSDRV_Heap, 0, metrics,
|
||||
afm->NumofMetrics * sizeof(*metrics));
|
||||
if (new_metrics == NULL)
|
||||
{
|
||||
retval = FALSE;
|
||||
goto cleanup_metrics;
|
||||
}
|
||||
|
||||
afm->Metrics = *p_metrics = new_metrics;
|
||||
metrics->C = encoded_metrics->C;
|
||||
metrics->UV = encoded_metrics->UV;
|
||||
metrics->WX = encoded_metrics->WX;
|
||||
metrics->N = encoded_metrics->N;
|
||||
}
|
||||
|
||||
HeapFree(PSDRV_Heap, 0, old_metrics);
|
||||
|
||||
afm->WinMetrics.sAvgCharWidth = PSDRV_CalcAvgCharWidth(afm);
|
||||
|
||||
return TRUE;
|
||||
|
||||
cleanup_metrics: /* handle fatal or non-fatal errors */
|
||||
HeapFree(PSDRV_Heap, 0, metrics);
|
||||
cleanup_old_metrics: /* handle fatal or non-fatal errors */
|
||||
HeapFree(PSDRV_Heap, 0, old_metrics);
|
||||
*p_metrics = NULL;
|
||||
return retval;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue