From: Alexandre Julliard julliard@winehq.org
--- dlls/wineps.drv/afm.c | 4 - dlls/wineps.drv/afm2c.c | 194 --------------------- dlls/wineps.drv/mkagl.c | 374 ---------------------------------------- tools/make_makefiles | 10 +- 4 files changed, 3 insertions(+), 579 deletions(-) delete mode 100644 dlls/wineps.drv/afm2c.c delete mode 100644 dlls/wineps.drv/mkagl.c
diff --git a/dlls/wineps.drv/afm.c b/dlls/wineps.drv/afm.c index 96654c0e6d0..ddc7df01600 100644 --- a/dlls/wineps.drv/afm.c +++ b/dlls/wineps.drv/afm.c @@ -170,10 +170,6 @@ static void PSDRV_DumpFontList(void) afmle->afm->FontName, afmle->afm->NumofMetrics, debugstr_w(afmle->afm->EncodingScheme));
- /* Uncomment to regenerate font data; see afm2c.c */ - - /* PSDRV_AFM2C(afmle->afm); */ - #if 0 for (i = 0; i < afmle->afm->NumofMetrics; ++i) { diff --git a/dlls/wineps.drv/afm2c.c b/dlls/wineps.drv/afm2c.c deleted file mode 100644 index df231796885..00000000000 --- a/dlls/wineps.drv/afm2c.c +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * - * Function to write WINEPS AFM data structures as C - * - * Copyright 2001 Ian Pilcher - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - * - * NOTES: - * - * PSDRV_AFM2C(AFM *afm) writes the AFM data structure addressed by afm (and - * its subsidiary objects) as a C file which can which can then be built in to - * the driver. It creates the file in the current directory with a name of - * the form {FontName}.c, where {FontName} is the PostScript font name with - * hyphens replaced by underscores. - * - * To use this function, do the following: - * - * * 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 - * 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 - * written *MUST* already be present in PSDRV_AGLGlyphNames in agl.c. - * See mkagl.c in this directory for information on how to generate - * updated glyph name information. Note, however, that if the glyph - * name information in agl.c is regenerated, *ALL* AFM data must also - * be recreated. - * - */ - -#include <string.h> -#include <stdio.h> -#include <math.h> - -#include "wine/debug.h" -#include "psdrv.h" - -WINE_DEFAULT_DEBUG_CHANNEL(psdrv); - -static inline void cursorto(FILE *of, int np, int cp) -{ - int ntp = np & 0xfffffff8; - int ctp = cp & 0xfffffff8; - - while (ctp < ntp) - { - fputc('\t', of); - ctp += 8; - cp = ctp; - } - - while (cp < np) - { - fputc(' ', of); - ++cp; - } -} - -static void writeHeader(FILE *of, const AFM *afm, const char *buffer) -{ - int i; - - fputc('/', of); - for (i = 1; i < 80; ++i) - fputc('*', of); - fprintf(of, "\n" - " *\n" - " *\tFont metric data for %s\n" - " *\n" - " *\tCopyright 2001 Ian Pilcher\n" - " *\n" - " *\n" - " *\tSee dlls/wineps/data/COPYRIGHTS for font copyright " - "information.\n" - " *\n" - " */\n" - "\n" - "#include "psdrv.h"\n", afm->FontName); -} - -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 const AFMMETRICS metrics[%i] =\n{\n", - afm->NumofMetrics); - - for (i = 0; i < afm->NumofMetrics; ++i) - { - fprintf(of, " { 0x%.4lx, %4g },\n", afm->Metrics[i].UV, afm->Metrics[i].WX); - } - - fprintf(of, "};\n"); -} - -static void writeAFM(FILE *of, const AFM *afm, const char *buffer) -{ - fputs("\n\n/*\n * Font metrics\n */\n\n", of); - - fprintf(of, "const AFM PSDRV_%s =\n{\n", buffer); - cursorto(of, 44, fprintf(of, " "%s",", afm->FontName)); - fputs("/* FontName */\n", of); - cursorto(of, 44, fprintf(of, " L"%S",", afm->FamilyName)); - fputs("/* FamilyName */\n", of); - cursorto(of, 44, fprintf(of, " L"%S",", afm->EncodingScheme)); - fputs("/* EncodingScheme */\n", of); - cursorto(of, 44, fprintf(of, " %s,", - (afm->Weight > 550) ? "FW_BOLD" : "FW_NORMAL")); - fputs("/* Weight */\n", of); - cursorto(of, 44, fprintf(of, " %g,", afm->ItalicAngle)); - fputs("/* ItalicAngle */\n", of); - cursorto(of, 44, fprintf(of, " %s,", - afm->IsFixedPitch ? "TRUE" : "FALSE")); - fputs("/* IsFixedPitch */\n", of); - 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); - fputs(" {\n", of); - cursorto(of, 44, 7 + fprintf(of, "\t%u,", - (unsigned int)(afm->WinMetrics.usUnitsPerEm))); - fputs("/* WinMetrics.usUnitsPerEm */\n", of); - cursorto(of, 44, 7 + fprintf(of, "\t%i,", - (int)(afm->WinMetrics.sAscender))); - fputs("/* WinMetrics.sAscender */\n", of); - cursorto(of, 44, 7 + fprintf(of, "\t%i,", - (int)(afm->WinMetrics.sDescender))); - fputs("/* WinMetrics.sDescender */\n", of); - cursorto(of, 44, 7 + fprintf(of, "\t%i,", - (int)(afm->WinMetrics.sLineGap))); - fputs("/* WinMetrics.sLineGap */\n", of); - cursorto(of, 44, 7 + fprintf(of, "\t%i,", - (int)(afm->WinMetrics.sAvgCharWidth))); - fputs("/* WinMetrics.sAvgCharWidth */\n", of); - cursorto(of, 44, 7 + fprintf(of, "\t%u,", - (unsigned int)(afm->WinMetrics.usWinAscent))); - fputs("/* WinMetrics.usWinAscent */\n", of); - cursorto(of, 44, 7 + fprintf(of, "\t%u", - (unsigned int)(afm->WinMetrics.usWinDescent))); - fputs("/* WinMetrics.usWinDescent */\n",of); - fputs(" },\n", of); - cursorto(of, 44, fprintf(of, " %i,", afm->NumofMetrics)); - fputs("/* NumofMetrics */\n", of); - fputs(" metrics\t\t\t\t /* Metrics */\n};\n", of); -} - -void PSDRV_AFM2C(const AFM *afm) -{ - char buffer[256]; - FILE *of; - unsigned int i; - - lstrcpynA(buffer, afm->FontName, sizeof(buffer) - 2); - - for (i = 0; i < strlen(buffer); ++i) - if (buffer[i] == '-') - buffer[i] = '_'; - - buffer[i] = '.'; buffer[i + 1] = 'c'; buffer[i + 2] = '\0'; - - MESSAGE("writing '%s'\n", buffer); - - of = fopen(buffer, "w"); - if (of == NULL) - { - ERR("error opening '%s' for writing\n", buffer); - return; - } - - buffer[i] = '\0'; - - writeHeader(of, afm, buffer); - writeMetrics(of, afm, buffer); - writeAFM(of, afm, buffer); - - fclose(of); -} diff --git a/dlls/wineps.drv/mkagl.c b/dlls/wineps.drv/mkagl.c deleted file mode 100644 index 8c6b69a0853..00000000000 --- a/dlls/wineps.drv/mkagl.c +++ /dev/null @@ -1,374 +0,0 @@ -/* - * Copyright 2001 Ian Pilcher - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" - -#include <sys/types.h> -#include <dirent.h> -#include <string.h> -#include <stdlib.h> -#include <stdio.h> -#include <ctype.h> - - -/* - * The array of glyph information - */ - -typedef struct -{ - int UV; - const char *name; -} GLYPHINFO; - -static GLYPHINFO glyphs[1500]; -static int num_glyphs = 0; - - -/* - * Functions to search and sort the array - */ - -static int cmp_by_UV(const void *a, const void *b) -{ - return ((const GLYPHINFO *)a)->UV - ((const GLYPHINFO *)b)->UV; -} - -static int cmp_by_name(const void *a, const void *b) -{ - return strcmp(((const GLYPHINFO *)a)->name, ((const GLYPHINFO *)b)->name); -} - -static inline void sort_by_UV(void) -{ - qsort(glyphs, num_glyphs, sizeof(GLYPHINFO), cmp_by_UV); -} - -static inline void sort_by_name(void) -{ - qsort(glyphs, num_glyphs, sizeof(GLYPHINFO), cmp_by_name); -} - -static inline GLYPHINFO *search_by_name(const char *name) -{ - GLYPHINFO gi; - - gi.name = name; - - return (GLYPHINFO *)bsearch(&gi, glyphs, num_glyphs, sizeof(GLYPHINFO), - cmp_by_name); -} - - -/* - * Use the 'optimal' combination of tabs and spaces to position the cursor - */ - -static inline void fcpto(FILE *f, int newpos, int curpos) -{ - int newtpos = newpos & ~7; - int curtpos = curpos & ~7; - - while (curtpos < newtpos) - { - fputc('\t', f); - curtpos += 8; - curpos = curtpos; - } - - while (curpos < newpos) - { - fputc(' ', f); - ++curpos; - } -} - -/* - * Make main() look "purty" - */ - -static inline void triple_space(FILE *f) -{ - fputc('\n', f); fputc('\n', f); -} - - -/* - * Read the Adobe Glyph List from 'glyphlist.txt' - */ - -static void read_agl(void) -{ - FILE *f = fopen("glyphlist.txt", "r"); - char linebuf[256], namebuf[128], commbuf[128]; - - if (f == NULL) - { - fprintf(stderr, "Error opening glyphlist.txt\n"); - exit(__LINE__); - } - - while (fgets(linebuf, sizeof(linebuf), f) != NULL) - { - unsigned int UV; - - if (linebuf[0] == '#') - continue; - - sscanf(linebuf, "%X;%[^;];%[^\n]", &UV, namebuf, commbuf); - - glyphs[num_glyphs].UV = (int)UV; - glyphs[num_glyphs].name = strdup(namebuf); - - if (glyphs[num_glyphs].name == NULL) - { - fprintf(stderr, "Memory allocation failure\n"); - exit(__LINE__); - } - - ++num_glyphs; - } - - fclose(f); - - if (num_glyphs != 1051) - { - fprintf(stderr, "Read %i glyphs\n", num_glyphs); - exit(__LINE__); - } -} - - -/* - * Read glyph names from all AFM files in current directory - */ - -static void read_afms(FILE *f_c, FILE *f_h) -{ - DIR *d = opendir("."); - struct dirent *de; - - fputs( "/*\n" - " * Built-in font metrics\n" - " */\n" - "\n" - "const AFM *const PSDRV_BuiltinAFMs[] =\n" - "{\n", f_c); - - - if (d == NULL) - { - fprintf(stderr, "Error opening current directory\n"); - exit(__LINE__); - } - - while ((de = readdir(d)) != NULL) - { - FILE *f; - char *cp, linebuf[256], font_family[128]; - int i, num_metrics; - - cp = strrchr(de->d_name, '.'); /* Does it end in */ - if (cp == NULL || strcmp(cp, ".afm") != 0) /* .afm or .AFM? */ - continue; - - f = fopen(de->d_name, "r"); - if (f == NULL) - { - fprintf(stderr, "Error opening %s\n", de->d_name); - exit(__LINE__); - } - - while (1) - { - if (fgets(linebuf, sizeof(linebuf), f) == NULL) - { - fprintf(stderr, "FontName not found in %s\n", de->d_name); - exit(__LINE__); - } - - if (strncmp(linebuf, "FontName ", 9) == 0) - break; - } - - sscanf(linebuf, "FontName %[^\r\n]", font_family); - - for (i = 0; font_family[i] != '\0'; ++i) - if (font_family[i] == '-') - font_family[i] = '_'; - - fprintf(f_h, "extern const AFM PSDRV_%s;\n", font_family); - fprintf(f_c, " &PSDRV_%s,\n", font_family); - fclose(f); - } - - closedir(d); - - fputs(" NULL\n};\n", f_c); -} - - -/* - * Write opening comments, etc. - */ - -static void write_header(FILE *f) -{ - int i; - - fputc('/', f); - for (i = 0; i < 79; ++i) - fputc('*', f); - fputs("\n" - " *\n" - " *\tFont and glyph data for the Wine PostScript driver\n" - " *\n" - " *\tCopyright 2001 Ian Pilcher\n" - " *\n" - " *\n" - " *\tThis data is derived from the Adobe Glyph list at\n" - " *\n" - " *\t " - "http://partners.adobe.com/asn/developer/type/glyphlist.txt%5Cn" - " *\n" - " *\tand 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-1998 Adobe Systems Incorporated.\n" - " *\n" - " */\n" - "\n" - "#include "psdrv.h"\n" - "#include "data/agl.h"\n", f); -} - -/* - * Write the AGL encoding vector, sorted by glyph name - */ - -static void write_encoding_by_name(FILE *f) -{ - int i, size = 0; - - for (i = 0; i < num_glyphs; ++i) - if (glyphs[i].UV != -1 && - (i == 0 || strcmp(glyphs[i - 1].name, glyphs[i].name) != 0)) - ++size; /* should be 1039 */ - - fputs( "/*\n" - " * The AGL encoding vector, sorted by glyph name - " - "duplicates omitted\n" - " */\n" - "\n", f); - - fprintf(f, "const INT PSDRV_AGLbyNameSize = %i;\n\n", size); - fprintf(f, "const UNICODEGLYPH PSDRV_AGLbyName[%i] =\n{\n", size); - - for (i = 0; i < num_glyphs; ++i) - { - if (glyphs[i].UV == -1) - continue; - - if (i != 0 && strcmp(glyphs[i - 1].name, glyphs[i].name) == 0) - continue; - - fprintf(f, " { 0x%.4x, "%s" },\n", glyphs[i].UV, glyphs[i].name); - } - - fprintf(f, "};\n"); -} - -/* - * Write the AGL encoding vector, sorted by Unicode value - */ - -static void write_encoding_by_UV(FILE *f) -{ - int i, size = 0; - - for (i = 0; i < num_glyphs; ++i) - if (glyphs[i].UV != -1) - ++size; /* better be 1051! */ - - sort_by_UV(); - - fputs( "/*\n" - " * The AGL encoding vector, sorted by Unicode value - " - "duplicates included\n" - " */\n" - "\n", f); - - fprintf(f, "const INT PSDRV_AGLbyUVSize = %i;\n\n", size); - fprintf(f, "const UNICODEGLYPH PSDRV_AGLbyUV[%i] =\n{\n", size); - - for (i = 0; i < num_glyphs; ++i) - { - if (glyphs[i].UV == -1) - continue; - - fprintf(f, " { 0x%.4x, "%s" },\n", glyphs[i].UV, glyphs[i].name); - } - fprintf(f, "};\n"); -} - - -/* - * Do it! - */ - -int main(int argc, char *argv[]) -{ - FILE *f_c, *f_h; - - if (argc < 3) - { - fprintf(stderr, "Usage: %s <C file> <header file>\n", argv[0]); - exit(__LINE__); - } - - f_c = fopen(argv[1], "w"); - if (f_c == NULL) - { - fprintf(stderr, "Error opening %s for writing\n", argv[1]); - exit(__LINE__); - } - - f_h = fopen(argv[2], "w"); - if (f_h == NULL) - { - fprintf(stderr, "Error opening %s for writing\n", argv[2]); - exit(__LINE__); - } - - write_header(f_c); - triple_space(f_c); - read_agl(); - read_afms(f_c, f_h); /* also writes font list */ - triple_space(f_c); - write_encoding_by_name(f_c); - triple_space(f_c); - write_encoding_by_UV(f_c); - - /* Clean up */ - fclose(f_c); - fclose(f_h); - - return 0; -} diff --git a/tools/make_makefiles b/tools/make_makefiles index ad9494e983e..ce3ebd08bb8 100755 --- a/tools/make_makefiles +++ b/tools/make_makefiles @@ -38,13 +38,9 @@ my %modules16 = "wow32.dll" => 1, );
-my %ignored_source_files = ( - "dlls/wineps.drv/afm2c.c" => 1, - "dlls/wineps.drv/mkagl.c" => 1, -); - my (@makefiles, %makefiles); my @nls_files; +my %deleted_files;
sub dirname($) { @@ -261,7 +257,7 @@ sub assign_sources_to_makefiles(@) { foreach my $file (@_) { - next if defined $ignored_source_files{$file}; + next if defined $deleted_files{$file}; next if $file =~ /Makefile.in$/; my $dir = dirname( $file ); my $subdir = $dir; @@ -395,7 +391,7 @@ my $git_dir = $ENV{GIT_DIR} || ".git"; die "needs to be run from a git checkout" unless -e $git_dir;
my @all_files = split /\0/, `git ls-files -c -z` or die "cannot get files list"; -map { $ignored_source_files{$_} = 1; } split /\0/, `git ls-files -d -z`; +map { $deleted_files{$_} = 1; } split /\0/, `git ls-files -d -z`; @makefiles = grep /Makefile.in$/, @all_files;
foreach my $file (sort @makefiles)