Пример #1
0
bool
GeometricBrickDecorator::compareFaceToFace(int which, ID &faceOther) 
{
  ID faceID(4);
  ID myFace(4);
  this->getFace(which, myFace, faceID);
  return ( (myFace(0) == faceOther(0)) &&
	   (myFace(1) == faceOther(1)) &&
	   (myFace(2) == faceOther(2)) &&
	   (myFace(3) == faceOther(3)) 
	   );
}
Пример #2
0
//
// MAIN
//
int main(int argc, const char *argv[]){
	
	//
	// Command line processor:
	//
	CLP clp("Fontaine","1.2.1",L("Copyright ⓒ 2014 by Edward H. Trager. All Rights Reserved. Released under GPL v. 2 or later."),"http://www.unifont.org","fontaine [option]... [font file]...\n");
	
	//
	// Set up command line switches:
	//
	
	clp.addSwitch("--json"            , "-J" , "Produce output report in JSON format. (default)");
	clp.addSwitch("--text"            , "-T" , "Produce output report in plain text format.");
	clp.addSwitch("--xhtml"           , "-H" , "Produce output report in XHTML format.");
	clp.addSwitch("--fxhtml"          , "-Y" , "Produce output report in FANCY XHTML format.");
	clp.addSwitch("--xml"             , "-X" , "Produce output report in XML format.");
	// ---
	clp.addSwitch("--show-conscript"  , "-C" , "Report fictional orthographies");
	clp.addSwitch("--hide-conscript"  , "-c" , "Don't report fictional orthographies (default)");
	clp.addSwitch("--show-full"       , "-F" , "Report orthographies for which the font provides full support");
	clp.addSwitch("--hide-full"       , "-f" , "Don't report orthographies for which the font provides full support");
	clp.addSwitch("--show-missing"    , "-M" , "Report which Unicode values are missing from fragmentary and partially-supported orthographies. (default)");
	clp.addSwitch("--hide-missing"    , "-m" , "Don't report which Unicode values are missing from fragmentary and partially-supported orthographies.");
	clp.addSwitch("--show-partial"    , "-P" , "Report orthographies for which the font provides only partial support");
	clp.addSwitch("--hide-partial"    , "-p" , "Don't report orthographies for which the font provides only partial support");
	clp.addSwitch("--show-fragmentary", "-R" , "Report orthographies for which the font provides only fragmentary support.");
	clp.addSwitch("--hide-fragmentary", "-r" , "Don't report orthographies for which the font provides only fragmentary support.");
	// ---
	clp.addSwitch("--version"         , "-v" , "Print version and exit");
	clp.addSwitch("--help"            , "-h" , "Print help and exit");
	
	//
	// Parse command line arguments:
	//
	if(clp.parse(argc,argv)){
	
		// No error, process the switches
		if(clp.hasSwitchSet("--help")){
			clp.printHelp();
			return 0;
		}
		if(clp.hasSwitchSet("--version")){
			
			clp.printCopyrightNotice();
			return 0;
			
		}
		
		////////////////////
		//
		// MAIN PROCESSING:
		//
		////////////////////
		
		//
		// These are the arguments left over after stripping off command line arguments:
		//
		std::vector<std::string> arguments = clp.getArguments();
		
		FontLibrary myLibrary;
		
		////////////////////////////////////////////////////////////
		//
		// The report object:
		//
		// Can only have one report, so we only instantiate the first
		// one ...
		//
		////////////////////////////////////////////////////////////
		
		MLR *mlr;
		unsigned int reportCount=0;
		
		if      (clp.hasSwitchSet("--text" ) ) mlr = new TEXTR();
		else if (clp.hasSwitchSet("--xhtml") ) mlr = new XHTMLR();
		else if (clp.hasSwitchSet("--fxhtml")) mlr = new FXHTMLR();
		else if (clp.hasSwitchSet("--xml"  ) ) mlr = new XMLR();
		else {
			//
			// Always maintain JSON as the last option
			// so that it will be the default option as well:
			//
			// if (clp.hasSwitchSet("--json" ) ) ...
			//
			mlr = new JSONR();
			
		}
		
		mlr->startRoot();
		mlr->startList("fonts");
		//
		// Read font disk files:
		//
		for(unsigned i=0;i<arguments.size();i++){
			
			//
			// instantiate a FontFace object using the font file name:
			//
			FontFace myFace(myLibrary,arguments[i].c_str());
			
			//
			// The options are currently set in the FontFace object --
			// -- this could change to a more elegant design in the future ...
			//
			if      (clp.hasSwitchSet("--show-missing")) myFace.setReportOnMissing(true);
			else if (clp.hasSwitchSet("--hide-missing")) myFace.setReportOnMissing(false);
			
			if      (clp.hasSwitchSet("--show-fragmentary")) myFace.setReportOnFragmentary(true);
			else if (clp.hasSwitchSet("--hide-fragmentary")) myFace.setReportOnFragmentary(false);
			
			if      (clp.hasSwitchSet("--show-partial")) myFace.setReportOnPartial(true);
			else if (clp.hasSwitchSet("--hide-partial")) myFace.setReportOnPartial(false);
			
			if      (clp.hasSwitchSet("--show-full")) myFace.setReportOnFull(true);
			else if (clp.hasSwitchSet("--hide-full")) myFace.setReportOnFull(false);
			
			if      (clp.hasSwitchSet("--show-conscript")) myFace.setReportOnConscript(true);
			else if (clp.hasSwitchSet("--hide-conscript")) myFace.setReportOnConscript(false);
			
			myFace.checkOrthographies();
			//
			// non-const method that calls methods 
			// on mlr to prepare the report:
			//
			myFace.fillReport(mlr);
			
		}
		
		mlr->endList("fonts");
		mlr->endRoot();
		
		//
		// Print the report:
		//
		std::cout << mlr->getReport();
		
		delete mlr;
	}
	
	return 0;
	
}