File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Open diff view settings 
Filter options 
Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Open diff view settings 
Original file line number Diff line number Diff line change 77 */  
88
99#include  < pybind11/pybind11.h> 
10+ #include  < pybind11/stl.h> 
1011#include  " pprdrv.h" 
11- #include  < vector> 
1212
1313namespace  py  =  pybind11;
1414using  namespace  pybind11 ::literals; 
@@ -40,25 +40,20 @@ static void convert_ttf_to_ps(
4040    const  char  *filename,
4141    py::object &output,
4242    int  fonttype,
43-     py::iterable* glyph_ids )
43+     std::optional<std::vector< int >> glyph_ids_or_none )
4444{
4545    PythonFileWriter output_ (output);
4646
47-     std::vector<int > glyph_ids_;
48-     if  (glyph_ids) {
49-         for  (py::handle glyph_id: *glyph_ids) {
50-             glyph_ids_.push_back (glyph_id.cast <int >());
51-         }
52-     }
53- 
5447    if  (fonttype != 3  && fonttype != 42 ) {
5548        throw  py::value_error (
5649            " fonttype must be either 3 (raw Postscript) or 42 (embedded Truetype)" 
5750    }
5851
52+     auto  glyph_ids = glyph_ids_or_none.value_or (std::vector<int >{});
53+ 
5954    try 
6055    {
61-         insert_ttfont (filename, output_, static_cast <font_type_enum>(fonttype), glyph_ids_ );
56+         insert_ttfont (filename, output_, static_cast <font_type_enum>(fonttype), glyph_ids );
6257    }
6358    catch  (TTException &e)
6459    {
 
 
   
 
     
   
   
          
    
    
    
      
     
    You can’t perform that action at this time.
  
    
  
    
      
        
       
      
     
   
 
    
    
  
    
      
      
     
  
 
  
    
      
      
     
  
 
     
    
0 commit comments