# automatically generated by the FlatBuffers compiler, do not modify

# namespace: flatbuffers

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class Text(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAsText(cls, buf, offset):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = Text()
        x.Init(buf, n + offset)
        return x

    # Text
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Text
    def Position(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = o + self._tab.Pos
            from casymda.visualization.web_server.flatbuffers.CanvasPosition import CanvasPosition
            obj = CanvasPosition()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Text
    def Anchor(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = o + self._tab.Pos
            from casymda.visualization.web_server.flatbuffers.Anchor import Anchor
            obj = Anchor()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Text
    def Text(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Text
    def Fill(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Text
    def FontFamily(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # Text
    def FontSize(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
        return 10

def TextStart(builder): builder.StartObject(6)
def TextAddPosition(builder, position): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(position), 0)
def TextAddAnchor(builder, anchor): builder.PrependStructSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(anchor), 0)
def TextAddText(builder, text): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(text), 0)
def TextAddFill(builder, fill): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(fill), 0)
def TextAddFontFamily(builder, fontFamily): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(fontFamily), 0)
def TextAddFontSize(builder, fontSize): builder.PrependUint8Slot(5, fontSize, 10)
def TextEnd(builder): return builder.EndObject()
