[wadalabfont-kit] / jis2prim / Matchers.h  

Diff of /jis2prim/Matchers.h

Parent Directory | Revision Log

version 1.1, Fri Feb 22 12:03:48 2002 UTC version 1.2, Mon Mar 4 00:44:36 2002 UTC
Line 2 
Line 2 
 #define _MATCHERS_H  #define _MATCHERS_H
   
 #include <vector>  #include <vector>
   #include <set>
 /* Matchters */  /* Matchters */
 #include "PatMatch.h"  #include "PatMatch.h"
 #include "BitmapFont.h"  #include "BitmapFont.h"
Line 13 
Line 14 
   PatMatch pm;    PatMatch pm;
  public:   public:
   MatchResult(int xx, int yy,PatMatch& p) :x(xx),y(yy),pm(p){}    MatchResult(int xx, int yy,PatMatch& p) :x(xx),y(yy),pm(p){}
     vector<pixel> getPixels() const {
       return pm.getPixels(x,y);
     }
 };  };
   
 class Matchers {  class Matchers {
Line 96 
Line 100 
   }    }
   bool coverCheck(const BitmapFont& bf){    bool coverCheck(const BitmapFont& bf){
     vector<MatchResult> mr=findMatch(bf);      vector<MatchResult> mr=findMatch(bf);
     vector<set<int> > pixel2match(bf.pixels.size());      vector<set<int> > pixel2match(bf.getSize());
     vector<set<int> > match2pixel(mr.size());      vector<set<int> > match2pixel(mr.size());
     vector<MatchResult>::iterator it;      vector<MatchResult>::iterator it;
     for(it=mr.begin();it!=mr.end();it++){      for(it=mr.begin();it!=mr.end();it++){
       int n= it-mr-begin();        int n= it-mr.begin();
       set<pixel> ps;        vector<pixel> ps=(*it).getPixels();
 hogehoge        vector<pixel>::iterator ips;
       match2pixel[n].swap(ps);        for(ips=ps.begin();ips!=ps.end();ips++){
           int m=bf.getIndex(*ips);
           assert(m != -1);
           match2pixel[n].insert(m);
           pixel2match[m].insert(n);
         }
       }
       for(int i=0;i<bf.getPixelSize();i++){
         if(pixel2match[i].empty()) return false;
     }      }
     return true;      return true;
   }    }


Generate output suitable for use with a patch program
Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

ktanaka

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help