X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/73c04bcfe1096173b00431f0cdc742894b15eef0..ef6cf650f4a75c3f97de06b51fa104f2069b9ea2:/icuSources/samples/layout/gnomelayout.cpp?ds=sidebyside diff --git a/icuSources/samples/layout/gnomelayout.cpp b/icuSources/samples/layout/gnomelayout.cpp index 43a56966..31e25871 100644 --- a/icuSources/samples/layout/gnomelayout.cpp +++ b/icuSources/samples/layout/gnomelayout.cpp @@ -2,7 +2,7 @@ /* ****************************************************************************** * * - * Copyright (C) 1999-2005, International Business Machines + * Copyright (C) 1999-2007, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * @@ -13,7 +13,8 @@ */ #include -#include "freetype/freetype.h" +#include +#include FT_FREETYPE_H #include "unicode/ustring.h" #include "unicode/uscript.h" @@ -36,7 +37,7 @@ struct Context Paragraph *paragraph; }; -static TT_Engine engine; +static FT_Library engine; static GnomeGUISupport *guiSupport; static GnomeFontMap *fontMap; static ScriptCompositeFontInstance *font; @@ -49,6 +50,7 @@ void closeSample(GtkWidget *sample); void showabout(GtkWidget */*widget*/, gpointer /*data*/) { GtkWidget *aboutBox; + const gchar *documentedBy[] = {NULL}; const gchar *writtenBy[] = { "Eric Mader", NULL @@ -56,9 +58,11 @@ void showabout(GtkWidget */*widget*/, gpointer /*data*/) aboutBox = gnome_about_new("Gnome Layout Sample", "0.1", - "Copyright (C) 1998-2002 By International Business Machines Corporation and others. All Rights Reserved.", - writtenBy, + "Copyright (C) 1998-2006 By International Business Machines Corporation and others. All Rights Reserved.", "A simple demo of the ICU LayoutEngine.", + writtenBy, + documentedBy, + "", NULL); gtk_widget_show(aboutBox); @@ -71,7 +75,7 @@ void notimpl(GtkObject */*object*/, gpointer /*data*/) gchar *prettyTitle(const gchar *path) { - gchar *name = g_basename(path); + const gchar *name = g_basename(path); gchar *title = g_strconcat("Gnome Layout Sample - ", name, NULL); return title; @@ -295,39 +299,43 @@ void closeSample(GtkWidget *app) int main (int argc, char *argv[]) { LEErrorCode fontStatus = LE_NO_ERROR; - GtkWidget *app; + poptContext ptctx; + GtkWidget *app; - TT_Init_FreeType(&engine); + FT_Init_FreeType(&engine); - gnome_init("gnomelayout", "0.1", argc, argv); + gnome_init_with_popt_table("gnomelayout", "0.1", argc, argv, NULL, 0, &ptctx); guiSupport = new GnomeGUISupport(); fontMap = new GnomeFontMap(engine, "FontMap.Gnome", 24, guiSupport, fontStatus); font = new ScriptCompositeFontInstance(fontMap); if (LE_FAILURE(fontStatus)) { - TT_Done_FreeType(engine); + FT_Done_FreeType(engine); return 1; } - if (argc <= 1) { - app = newSample("Sample.txt"); - - gtk_widget_show_all(app); - } else { - for (int i = 1; i < argc; i += 1) { - app = newSample(argv[i]); - - gtk_widget_show_all(app); - } + const char *defaultArgs[] = {"Sample.txt", NULL}; + const char **args = poptGetArgs(ptctx); + + if (args == NULL) { + args = defaultArgs; } + for (int i = 0; args[i] != NULL; i += 1) { + app = newSample(args[i]); + + gtk_widget_show_all(app); + } + + poptFreeContext(ptctx); + gtk_main(); delete font; delete guiSupport; - TT_Done_FreeType(engine); + FT_Done_FreeType(engine); exit(0); }