From 3d11867c9da4931659d379900ad7045b426cd978 Mon Sep 17 00:00:00 2001 From: handa Date: Thu, 22 Jan 2004 08:05:46 +0000 Subject: [PATCH] *** empty log message *** --- autogen.sh | 4 ++ example/.cvsignore | 8 +++ example/Makefile.am | 6 +- example/otfdraw.c | 176 --------------------------------------------------- example/otfdump.c | 23 +++++++ example/otflist.c | 23 +++++++ example/otftobdf.c | 23 +++++++ example/otfview.c | 23 +++++++ 8 files changed, 105 insertions(+), 181 deletions(-) create mode 100644 example/.cvsignore delete mode 100644 example/otfdraw.c diff --git a/autogen.sh b/autogen.sh index de43b40..c95bd14 100755 --- a/autogen.sh +++ b/autogen.sh @@ -15,6 +15,10 @@ echo "Running autoheader..." autoheader echo "Running autoconf..." autoconf +echo "The remaining steps to install this library are:" +echo " % ./configure" +echo " % make" +echo " % make install" # Copyright (C) 2003, 2004 # National Institute of Advanced Industrial Science and Technology (AIST) diff --git a/example/.cvsignore b/example/.cvsignore new file mode 100644 index 0000000..87d8dc1 --- /dev/null +++ b/example/.cvsignore @@ -0,0 +1,8 @@ +otfdump +otflist +otfview +otftobdf +Makefile.in +Makefile +.libs +.deps diff --git a/example/Makefile.am b/example/Makefile.am index 9cfdb47..18ca42b 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -22,7 +22,7 @@ ## Process this file with Automake to create Makefile.in -bin_PROGRAMS = otfdump otfdraw otfview otflist otftobdf +bin_PROGRAMS = otfdump otfview otflist otftobdf INCLUDES = `freetype-config --cflags` CommonLDADD = ${top_builddir}/src/libotf.la @@ -36,10 +36,6 @@ otfdump_SOURCE = otfdump.c otfdump_LDADD = ${CommonLDADD} otfdump_LDFLAGS = ${CommonLDFLAGS} -otfdraw_SOURCE = otfdraw.c -otfdraw_LDADD = ${CommonLDADD} -otfdraw_LDFLAGS = `freetype-config --libs` ${X_LIBS} ${X_PRE_LIBS} -lX11 -lXt -lXaw -lXmu -ldl -static - otfview_SOURCE = otfview.c otfview_LDADD = ${CommonLDADD} otfview_LDFLAGS = `freetype-config --libs` ${X_LIBS} ${X_PRE_LIBS} -lX11 -lXt -lXaw -lXmu -ldl -static diff --git a/example/otfdraw.c b/example/otfdraw.c deleted file mode 100644 index 609a3f2..0000000 --- a/example/otfdraw.c +++ /dev/null @@ -1,176 +0,0 @@ -#include -#include -#include - -#include "otf.h" - -#include -#include FT_FREETYPE_H - -#include - -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); -} diff --git a/example/otfdump.c b/example/otfdump.c index 8d5eca6..c589d16 100644 --- a/example/otfdump.c +++ b/example/otfdump.c @@ -1,3 +1,26 @@ +/* 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 #include #include diff --git a/example/otflist.c b/example/otflist.c index 5bd967b..db63961 100644 --- a/example/otflist.c +++ b/example/otflist.c @@ -1,3 +1,26 @@ +/* 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 #include #include diff --git a/example/otftobdf.c b/example/otftobdf.c index acbdf2c..1a5f584 100644 --- a/example/otftobdf.c +++ b/example/otftobdf.c @@ -1,3 +1,26 @@ +/* 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 #include diff --git a/example/otfview.c b/example/otfview.c index 45750a4..b662d99 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -1,3 +1,26 @@ +/* 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 #include #include -- 1.7.10.4