Selected font convert to mesh?

I want some selected font object to be converted to mesh

got this small loop but not working as expected

cn1 = 0

for obj in bpy.data.objects:

if (obj.select_get() is False and obj.type == 'FONT'):
	bpy.ops.object.convert(target='MESH', keep_original=False)
	print (' obj is selected ',obj.name ,' Converted to Mesh  type =',obj.type )
	cn1 +=1

print ( ’ end converted count =’ , cn1)
print ()

can some one help to make this work

thanks
happy bl

You can append all font objects to a list, then call bpy.ops.object.convert and pass the list as override.

import bpy

def convert_font_mesh():
    objects = bpy.context.view_layer.objects
    to_convert = []

    for obj in objects:
        if obj.select_get() and obj.type == 'FONT':
            to_convert.append(obj)

    if to_convert:
        active = objects.active
        if active not in to_convert:
            objects.active = to_convert[0]

        ctx = {'selected_editable_objects': to_convert}
        bpy.ops.object.convert(ctx, target='MESH', keep_original=False)
        objects.active = active

    print("Converted %s fonts." % len(to_convert))

if __name__ == "__main__":
    convert_font_mesh()

forgot to say this was for 2.8 !

is it important to first make a list of the fonts text ?
why not convert it directly to mesh ?

will test it

thanks
happy bl

Tested on 2.83 so should be fine.

The operator expects context.selected_editable_objects which is already a list. Adding all selected fonts to a list and running the operator once is faster than running it for every object.