+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "otf.h"
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#include <X11/Xlib.h>
-
-Display *display;
-int screen;
-Window win;
-GC gc;
-
-void
-draw_bitmap (FT_Face face, int x, int y)
-{
- int i, j;
- FT_Bitmap *bmp = &face->glyph->bitmap;
- unsigned char *buf = (unsigned char *) bmp->buffer;
-
- for (i = 0; i < bmp->rows; i++, buf += bmp->pitch)
- for (j = 0; j < bmp->width; j++)
- if (buf[j / 8] & (1 << (7 - (j % 8))))
- XDrawPoint (display, win, gc, x + j, y + i);
-}
-
-void
-quit (char *msg)
-{
- fprintf (stderr, "Error by %s\n", msg);
- exit (1);
-}
-
-
-static void
-otf_dump_value_record (unsigned value_format, OTF_ValueRecord *value_record)
-{
- if (value_format & OTF_XPlacement)
- printf (" (XPlacement %d)", value_record->XPlacement);
- if (value_format & OTF_YPlacement)
- printf (" (YPlacement %d)", value_record->YPlacement);
-}
-
-
-
-void
-otf_dump_gstring (OTF_GlyphString *gstring)
-{
- int i;
-
- for (i = 0; i < gstring->used; i++)
- {
- OTF_Glyph *g = gstring->glyphs + i;
-
- printf ("%02d: c:%04X, g:%04X class:%d\n",
- i, g->c, g->glyph_id, g->GlyphClass);
- // otf_dump_value_record (g->value_format1, &g->value_record1);
- // otf_dump_value_record (g->value_format2, &g->value_record2);
- }
-}
-
-
-int
-main (int argc, char **argv)
-{
- OTF *otf;
- int i;
- OTF_GlyphString gstring;
-
- if (argc != 2)
- {
- fprintf (stderr, "Usage, otfdump OTF-FILE");
- exit (1);
- }
-
- otf = OTF_open (argv[1]);
- if (! otf)
- {
- OTF_perror ("otfdraw");
- exit (1);
- }
- gstring.size = 10;
- gstring.glyphs = (OTF_Glyph *) malloc (sizeof (OTF_Glyph) * 30);
- memset (gstring.glyphs, 0, sizeof (OTF_Glyph) * 30);
- gstring.used = 0;
-#if 0
- gstring.glyphs[gstring.used++].c = 0x93F;
- gstring.glyphs[gstring.used++].c = 0x939;
- gstring.glyphs[gstring.used++].c = 0x928;
- gstring.glyphs[gstring.used++].c = 0x94D;
- gstring.glyphs[gstring.used++].c = 0x926;
- gstring.glyphs[gstring.used++].c = 0x940;
-#else
- gstring.glyphs[gstring.used++].c = 0x92A;
- gstring.glyphs[gstring.used++].c = 0x930;
- gstring.glyphs[gstring.used++].c = 0x94D;
- gstring.glyphs[gstring.used++].c = 0x924;
- gstring.glyphs[gstring.used++].c = 0x94D;
- gstring.glyphs[gstring.used++].c = 0x92F;
- gstring.glyphs[gstring.used++].c = 0x947;
- gstring.glyphs[gstring.used++].c = 0x915;
-#endif
- OTF_drive_cmap (otf, &gstring);
- OTF_drive_gdef (otf, &gstring);
- otf_dump_gstring (&gstring);
- if (OTF_drive_gsub (otf, &gstring, "deva", NULL, NULL) < 0)
- printf ("otf_gsub error\n");
- else
- printf ("RESULT of GSUB\n");
- otf_dump_gstring (&gstring);
-
- if (OTF_drive_gpos (otf, &gstring, "deva", NULL, NULL) < 0)
- printf ("otf_gsub error\n");
- else
- printf ("RESULT of GPOS\n");
- otf_dump_gstring (&gstring);
-
- {
- int x, y;
- int err;
- FT_Library library;
- FT_Face face;
-
- err = FT_Init_FreeType (&library);
- if (err)
- quit ("FT_Init_FreeType");
- err = FT_New_Face (library, argv[1], 0, &face);
- if (err == FT_Err_Unknown_File_Format)
- quit ("FT_New_Face: unknown file format");
- else if (err)
- quit ("FT_New_Face: unknown error");
- err = FT_Set_Char_Size (face, 0, 32*64, 400, 400);
- if (err)
- quit ("FT_Set_Char_Size");
-
- display = XOpenDisplay (NULL);
- screen = DefaultScreen (display);
- win = XCreateSimpleWindow (display, RootWindow (display, screen),
- 0, 0, 800, 600, 1, BlackPixel (display, screen),
- WhitePixel (display, screen));
- gc = DefaultGC (display, screen);
- XMapWindow (display, win);
- XSelectInput (display, win, ExposureMask);
-
- while (1)
- {
- XEvent event;
-
- XNextEvent (display, &event);
-
- XClearWindow (display, win);
- x = 20, y = 300;
- for (i = 0; i < gstring.used; i++)
- {
- FT_Load_Glyph (face, gstring.glyphs[i].glyph_id,
- FT_LOAD_RENDER | FT_LOAD_MONOCHROME);
-
- if (gstring.glyphs[i].positioning_type)
- {
- printf ("%d:%d\n", i, gstring.glyphs[i].positioning_type);
- }
- draw_bitmap (face,
- x + face->glyph->bitmap_left,
- y - face->glyph->bitmap_top);
- x += face->glyph->advance.x >> 6;
- }
- }
- }
-
-
- OTF_close (otf);
- exit (0);
-}
+/* otfdump.c -- Dump OpenType Layout Tables.
+
+Copyright (C) 2003, 2004
+ National Institute of Advanced Industrial Science and Technology (AIST)
+ Registration Number H15PRO167
+
+This file is part of libotf.
+
+Libotf 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.
+
+Libotf 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, in a file named COPYING; if not,
+write to the Free Software Foundation, Inc., 59 Temple Place, Suite
+330, Boston, MA 02111-1307, USA. */
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+/* otflist.c -- List OpenType fonts.
+
+Copyright (C) 2003, 2004
+ National Institute of Advanced Industrial Science and Technology (AIST)
+ Registration Number H15PRO167
+
+This file is part of libotf.
+
+Libotf 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.
+
+Libotf 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, in a file named COPYING; if not,
+write to the Free Software Foundation, Inc., 59 Temple Place, Suite
+330, Boston, MA 02111-1307, USA. */
+
#include <stdio.h>
#include <unistd.h>
#include <string.h>
+/* otftobdf.c -- Generate BDF font from OpenType font.
+
+Copyright (C) 2003, 2004
+ National Institute of Advanced Industrial Science and Technology (AIST)
+ Registration Number H15PRO167
+
+This file is part of libotf.
+
+Libotf 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.
+
+Libotf 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, in a file named COPYING; if not,
+write to the Free Software Foundation, Inc., 59 Temple Place, Suite
+330, Boston, MA 02111-1307, USA. */
+
#include <stdio.h>
#include <ft2build.h>
+/* otfview.c -- View glyphs of OpenType fonts.
+
+Copyright (C) 2003, 2004
+ National Institute of Advanced Industrial Science and Technology (AIST)
+ Registration Number H15PRO167
+
+This file is part of libotf.
+
+Libotf 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.
+
+Libotf 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, in a file named COPYING; if not,
+write to the Free Software Foundation, Inc., 59 Temple Place, Suite
+330, Boston, MA 02111-1307, USA. */
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>