Set Font with function

I want to set the font of various text objects from python. My problem is that the function to set the font needs a KIFONT object and i have no idea how to generate that.

txt = pcbnew.PCB_TEXT(self.module)
txt.SetFont(...)

The SetFont(...) function needs the ominous KIFONT object. I tried using the name of the font but that didn’t work. I can’t find any help in the documentation and haven’t found any forum post that helps with using that function.

Does anyone know how to use that function?

you could try something like this:

txt = pcbnew.PCB_TEXT(f)
txt.SetFontIndex(0)
txt.GetFontName()
'C059'
txt.SetFontIndex(1)
txt.GetFontName()
'Cantarell'
txt.SetFontIndex(2)
txt.GetFontName()
'D050000L'

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.