@cell
def add_text(component: ComponentOrFactory, text: str='', text_offset: Float2=(0, 0), text_anchor: Anchor='cc', text_factory: ComponentFactory=text_rectangular_multi_layer) -> Component:
    'Return component inside a new component with text geometry.\n\n    Args:\n        component:\n        text: text string.\n        text_offset: relative to component anchor. Defaults to center (cc).\n        text_anchor: relative to component (ce cw nc ne nw sc se sw center cc).\n        text_factory: function to add text labels.\n    '
    component = (component() if callable(component) else component)
    component_new = Component()
    component_new.component = component
    ref = component_new.add_ref(component)
    t = (component_new << text_factory(text))
    t.move((np.array(text_offset) + getattr(ref.size_info, text_anchor)))
    component_new.add_ports(ref.ports)
    component_new.copy_child_info(component)
    return component_new
Return component inside a new component with text geometry.

Args:
    component:
    text: text string.
    text_offset: relative to component anchor. Defaults to center (cc).
    text_anchor: relative to component (ce cw nc ne nw sc se sw center cc).
    text_factory: function to add text labels.
@cell
def add_text(component: ComponentOrFactory, text: str=, text_offset: Float2=(0, 0), text_anchor: Anchor='cc', text_factory: ComponentFactory=text_rectangular_multi_layer) -> Component:
    'Return component inside a new component with text geometry.\n\n    Args:\n        component:\n        text: text string.\n        text_offset: relative to component anchor. Defaults to center (cc).\n        text_anchor: relative to component (ce cw nc ne nw sc se sw center cc).\n        text_factory: function to add text labels.\n    '
    component = (component() if callable(component) else component)
    component_new = Component()
    component_new.component = component
    ref = component_new.add_ref(component)
    t = (component_new << text_factory(text))
    t.move((np.array(text_offset) + getattr(ref.size_info, text_anchor)))
    component_new.add_ports(ref.ports)
    component_new.copy_child_info(component)
    return component_new