@m_adam
Thanks for the response. For some reason, the return value is not accepted by the SetFont. It does not error out. It just uses the default font.
In addition, how were you able to determine that the [508] is for the font name? I can't seem to see such reference in the documentation.
You can check the working code here:
import c4d
from c4d import gui
# Welcome to the world of Python
def GetSegoeUiBoldFont():
bcFonts = c4d.bitmaps.GeClipMap.EnumerateFonts(c4d.GE_CM_FONTSORT_HIERARCHICAL)
for familyId, familyBc in bcFonts:
for fontDescriptionId, fontDescription in familyBc:
if fontDescription[508] == "SegoeUI-Bold":
return fontDescription
print fontDescription
def main():
w = 50
h = 50
image_with_text = c4d.bitmaps.GeClipMap()
image_with_text.Init(w=w,h=h,bits=32)
image_with_text.BeginDraw()
image_with_text.SetColor(125,255,255)
image_with_text.FillRect(x1=0,y1=0,x2=50,y2=50)
image_with_text.SetColor(0,0,0)
font_bc = GetSegoeUiBoldFont()
print font_bc
font_size = 15
image_with_text.SetFont(font_bc,font_size)
image_with_text.TextAt(x=10,y=15,txt='head')
image_with_text.EndDraw()
bmp = image_with_text.GetBitmap()
c4d.bitmaps.ShowBitmap(bmp)
# Execute main()
if __name__=='__main__':
main()