# Path: opc/text.py
# class WidthCache(object):
# class OPCText(object):
#     def __init__(self, space):
#     def add(self, char, width):
#     def get(self, char):
#     def __init__(self, typeface):
#     def drawHalfChar(self, matrix, x, y, char, offset, fg, bg):
#     def drawChar(self, matrix, x, y, c, fg, bg):
#     def drawText(self, matrix, x, y, string, fg, bg):


from .. _baseclass import ArtBaseClass
from opc.text import OPCText, typeface_bbc
        self.nextMessage = self._getText()

        self.typeface = OPCText(typeface_bbc)
        self.base = 0

    def _initText(self):
        raise NotImplementedError

    def _getText(self):
        raise NotImplementedError

    def start(self, matrix):
        matrix.setFirmwareConfig(nointerp=True)

    def refresh(self, matrix):
        matrix.clear(self.bg)

        y = matrix.height/2 - 4

        end = self.typeface.drawText(matrix, 0-self.base, y,
                                     self.thisMessage, self.fg, self.bg)

        # drawText returns None if the image ran to the end of the page. If it
        # didn't, then it's time to bring in the new one.
        if end is not None:
            self.typeface.drawText(matrix, end, y,
                                   self.nextMessage, self.fg, self.bg)
            if end == 1:
                # this is the final pixel for the original text. So next time
                # through, next message is the active messge.

# Path: opc/text.py
# class WidthCache(object):
# class OPCText(object):
#     def __init__(self, space):
#     def add(self, char, width):
#     def get(self, char):
#     def __init__(self, typeface):
#     def drawHalfChar(self, matrix, x, y, char, offset, fg, bg):
#     def drawChar(self, matrix, x, y, c, fg, bg):
#     def drawText(self, matrix, x, y, string, fg, bg):


# Path: art/baseclasses/scrolltext.py
from .. _baseclass import ArtBaseClass
from opc.text import OPCText, typeface_bbc

        self.nextMessage = self._getText()

        self.typeface = OPCText(typeface_bbc)
        self.base = 0

    def _initText(self):
        raise NotImplementedError

    def _getText(self):
        raise NotImplementedError

    def start(self, matrix):
        matrix.setFirmwareConfig(nointerp=True)

    def refresh(self, matrix):
        matrix.clear(self.bg)

        y = matrix.height/2 - 4

        end = self.typeface.drawText(matrix, 0-self.base, y,
                                     self.thisMessage, self.fg, self.bg)

        # drawText returns None if the image ran to the end of the page. If it
        # didn't, then it's time to bring in the new one.
        if end is not None:
            self.typeface.drawText(matrix, end, y,
                                   self.nextMessage, self.fg, self.bg)
            if end == 1:
                # this is the final pixel for the original text. So next time
                # through, next message is the active messge.

                self.thisMessage = self.nextMessage