scaled w = uWidth.ToScaledPoints(); scaled h = uHeight.ToScaledPoints(); scaled x0 = uXMargin.ToScaledPoints(); scaled y0 = uYMargin.ToScaledPoints();  root->DoBoxedLayout(LAYOUT_AUTO, BREAK_GOOD, w - 2 * x0); const BoundingBox& box = root->GetBoundingBox(); root->SetPosition(0, box.ascent); root->Freeze();  GraphicsContextValues values; values.foreground = BLACK_COLOR; values.background = WHITE_COLOR; values.lineStyle = LINE_STYLE_SOLID; values.lineWidth = px2sp(1);  PS_DrawingArea area(values, x0, y0, stdout); area.SetSize(w, h); if (!colors) area.DisableColors(); fm.DumpFontDictionary(stdout);  area.DumpPreamble();  root->SetDirty(); root->Render(area); area.DumpEpilogue(); } } else #endif printHelp();
area.DumpPreamble();  engine.Render(&sheet); area.DumpEpilogue(); #else printHelp(); #endif
main(int argc, char *argv[]){  sprintf(appName, "MathML to PostScript v%s", MATHML2PS_VERSION);  while (TRUE) {    int option_index = 0;    static struct option long_options[] =    {      { "version", 	 no_argument,       NULL, OPTION_VERSION },      { "help",    	 no_argument,       NULL, OPTION_HELP },      { "verbose",       optional_argument, NULL, OPTION_VERBOSE },      { "size",          required_argument, NULL, OPTION_SIZE },      { "unit",          required_argument, NULL, OPTION_UNIT },      { "margins",       required_argument, NULL, OPTION_MARGINS },      { "font-size",     required_argument, NULL, OPTION_FONT_SIZE },      { "disable-colors",no_argument,       NULL, OPTION_DISABLE_COLORS },      { "config",        required_argument, NULL, OPTION_CONFIG },      { NULL,            no_argument, NULL, 0 }    };    int c = getopt_long(argc, argv, "vhg:u:m:f:", long_options, &option_index);    if (c == -1) break;    switch (c) {    case OPTION_VERSION:    case 'v':      printVersion();      break;    case OPTION_HELP:    case 'h':      printHelp();      break;    case OPTION_SIZE:    case 'g':      if (optarg == NULL) printHelp();      if (!parseSize(optarg)) fprintf(stderr, "error while parsing size\n");      break;    case OPTION_UNIT:    case 'u':      if (optarg == NULL) printHelp();      if (!parseUnit(optarg)) fprintf(stderr, "error while parsing unit\n");      break;    case OPTION_MARGINS:    case 'm':      if (optarg == NULL) printHelp();      if (!parseMargins(optarg)) fprintf(stderr, "error while parsing margins\n");      break;    case OPTION_VERBOSE:      if (optarg == NULL) MathEngine::logger.SetLogLevel(0);      else MathEngine::logger.SetLogLevel(*optarg - '0');      break;    case OPTION_FONT_SIZE:    case 'f':      if (optarg == NULL) printHelp();      fontSize = atof(optarg);      break;    case OPTION_DISABLE_COLORS:      colors = false;      break;    case OPTION_CONFIG:      configPath = optarg;      break;    case '?':      break;    default:      fprintf(stderr, "*** getopt returned %o value\n", c);      break;    }  }  MathEngine::logger(LOG_INFO, "Font size : %f", fontSize);  MathEngine::logger(LOG_INFO, "Paper size: %fx%f", width, height);  MathEngine::logger(LOG_INFO, "Margins   : %fx%f", xMargin, yMargin);#ifdef HAVE_LIBT1  if (optind < argc) {    MathEngine::InitGlobalData(configPath);    MathMLParser parser(argv[optind]);    MathMLDocument* document = parser.Parse();    document->Normalize();    if (document != NULL) {      MathMLElement* root = document->GetRoot();      assert(root != NULL);      PS_T1_FontManager fm;      CharMapper cm(fm);      cm.Load("/usr/local/share/gtkmathview/font-configuration.xml");      cm.Load("config/font-configuration.xml");      UnitValue size;      size.Set(fontSize, UNIT_PT);      RenderingEnvironment env(cm);      env.SetFontSize(size);      root->Setup(&env);      root->DoBoxedLayout(LAYOUT_MIN);      root->DoBoxedLayout(LAYOUT_MAX);      UnitValue uWidth;      UnitValue uHeight;      UnitValue uXMargin;      UnitValue uYMargin;      uWidth.Set(width, unitId);      uHeight.Set(height, unitId);      uXMargin.Set(xMargin, unitId);      uYMargin.Set(yMargin, unitId);      scaled w = uWidth.ToScaledPoints();      scaled h = uHeight.ToScaledPoints();      scaled x0 = uXMargin.ToScaledPoints();      scaled y0 = uYMargin.ToScaledPoints();      root->DoBoxedLayout(LAYOUT_AUTO, BREAK_GOOD, w - 2 * x0);      const BoundingBox& box = root->GetBoundingBox();      root->SetPosition(0, box.ascent);      root->Freeze();      GraphicsContextValues values;      values.foreground = BLACK_COLOR;      values.background = WHITE_COLOR;      values.lineStyle = LINE_STYLE_SOLID;      values.lineWidth = px2sp(1);      PS_DrawingArea area(values, x0, y0, stdout);      area.SetSize(w, h);      if (!colors) area.DisableColors();      fm.DumpFontDictionary(stdout);      area.DumpPreamble();      //area.DumpGrid();      root->SetDirty();      root->Render(area);      area.DumpEpilogue();    }  } else#endif // HAVE_LIBT1    printHelp();  exit(0);}