def set_font(self, family,style='<STR_LIT>',size=<NUM_LIT:0>):
family=family.lower()<EOL>if(family=='<STR_LIT>'):<EOL><INDENT>family=self.font_family<EOL><DEDENT>if(family=='<STR_LIT>'):<EOL><INDENT>family='<STR_LIT>'<EOL><DEDENT>elif(family=='<STR_LIT>' or family=='<STR_LIT>'):<EOL><INDENT>style='<STR_LIT>'<EOL><DEDENT>style=style.upper()<EOL>if('<STR_LIT>' in style):<EOL><INDENT>self.underline=<NUM_LIT:1><EOL>style=style.replace('<STR_LIT>','<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>self.underline=<NUM_LIT:0><EOL><DEDENT>if(style=='<STR_LIT>'):<EOL><INDENT>style='<STR_LIT>'<EOL><DEDENT>if(size==<NUM_LIT:0>):<EOL><INDENT>size=self.font_size_pt<EOL><DEDENT>if(self.font_family==family and self.font_style==style and self.font_size_pt==size):<EOL><INDENT>return<EOL><DEDENT>fontkey=family+style<EOL>if fontkey not in self.fonts:<EOL><INDENT>if fontkey in self.core_fonts:<EOL><INDENT>if fontkey not in fpdf_charwidths:<EOL><INDENT>name=os.path.join(FPDF_FONT_DIR,family)<EOL>if(family=='<STR_LIT>' or family=='<STR_LIT>'):<EOL><INDENT>name+=style.lower()<EOL><DEDENT>exec(compile(open(name+'<STR_LIT>').read(), name+'<STR_LIT>', '<STR_LIT>'))<EOL>if fontkey not in fpdf_charwidths:<EOL><INDENT>self.error('<STR_LIT>'+fontkey)<EOL><DEDENT><DEDENT>i=len(self.fonts)+<NUM_LIT:1><EOL>self.fonts[fontkey]={'<STR_LIT:i>':i,'<STR_LIT:type>':'<STR_LIT>','<STR_LIT:name>':self.core_fonts[fontkey],'<STR_LIT>':-<NUM_LIT:100>,'<STR_LIT>':<NUM_LIT:50>,'<STR_LIT>':fpdf_charwidths[fontkey]}<EOL><DEDENT>else:<EOL><INDENT>self.error('<STR_LIT>'+family+'<STR_LIT:U+0020>'+style)<EOL><DEDENT><DEDENT>self.font_family=family<EOL>self.font_style=style<EOL>self.font_size_pt=size<EOL>self.font_size=size/self.k<EOL>self.current_font=self.fonts[fontkey]<EOL>self.unifontsubset = (self.fonts[fontkey]['<STR_LIT:type>'] == '<STR_LIT>')<EOL>if(self.page><NUM_LIT:0>):<EOL><INDENT>self._out(sprintf('<STR_LIT>',self.current_font['<STR_LIT:i>'],self.font_size_pt))<EOL><DEDENT>
Select a font; size given in points